2010-10-28 09:01:37 -07:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Mihai Șucan <mihai.sucan@gmail.com>
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2012-05-10 06:15:10 -07:00
|
|
|
function consoleOpened(HUD) {
|
|
|
|
HUD.jsterm.clearOutput();
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
let longMessage = "";
|
2010-11-16 13:34:53 -08:00
|
|
|
for (let i = 0; i < 50; i++) {
|
2010-10-28 09:01:37 -07:00
|
|
|
longMessage += "LongNonwrappingMessage";
|
|
|
|
}
|
|
|
|
|
2010-11-16 13:34:53 -08:00
|
|
|
for (let i = 0; i < 50; i++) {
|
2012-05-31 03:30:56 -07:00
|
|
|
content.console.log("test message " + i);
|
2010-10-28 09:01:37 -07:00
|
|
|
}
|
|
|
|
|
2012-05-31 03:30:56 -07:00
|
|
|
content.console.log(longMessage);
|
2010-10-28 09:01:37 -07:00
|
|
|
|
2010-11-16 13:34:53 -08:00
|
|
|
for (let i = 0; i < 50; i++) {
|
2012-05-31 03:30:56 -07:00
|
|
|
content.console.log("test message " + i);
|
2010-10-28 09:01:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
HUD.jsterm.execute("1+1");
|
|
|
|
|
2012-05-10 06:15:10 -07:00
|
|
|
function performTest() {
|
2010-12-23 07:59:19 -08:00
|
|
|
let scrollBox = HUD.outputNode.scrollBoxObject.element;
|
|
|
|
isnot(scrollBox.scrollTop, 0, "scroll location is not at the top");
|
2010-10-28 09:01:37 -07:00
|
|
|
|
2010-12-23 07:59:19 -08:00
|
|
|
let node = HUD.outputNode.getItemAtIndex(HUD.outputNode.itemCount - 1);
|
2010-10-28 09:01:37 -07:00
|
|
|
let rectNode = node.getBoundingClientRect();
|
|
|
|
let rectOutput = HUD.outputNode.getBoundingClientRect();
|
|
|
|
|
|
|
|
// Visible scroll viewport.
|
2010-12-23 07:59:19 -08:00
|
|
|
let height = scrollBox.scrollHeight - scrollBox.scrollTop;
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
// Top position of the last message node, relative to the outputNode.
|
|
|
|
let top = rectNode.top - rectOutput.top;
|
|
|
|
|
|
|
|
// Bottom position of the last message node, relative to the outputNode.
|
|
|
|
let bottom = rectNode.bottom - rectOutput.top;
|
|
|
|
|
2010-12-23 07:59:19 -08:00
|
|
|
ok(top >= 0 && Math.floor(bottom) <= height + 1,
|
|
|
|
"last message is visible");
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
finishTest();
|
2012-05-10 06:15:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
waitForSuccess({
|
|
|
|
name: "console output displayed",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
2012-06-12 04:25:07 -07:00
|
|
|
return HUD.outputNode.itemCount >= 103;
|
2012-05-10 06:15:10 -07:00
|
|
|
},
|
|
|
|
successFn: performTest,
|
2012-06-12 04:25:07 -07:00
|
|
|
failureFn: function() {
|
|
|
|
info("itemCount: " + HUD.outputNode.itemCount);
|
|
|
|
finishTest();
|
|
|
|
},
|
2010-10-28 09:01:37 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function test() {
|
2012-03-24 04:34:42 -07:00
|
|
|
addTab("data:text/html;charset=utf-8,Web Console test for bug 601352");
|
2012-05-10 06:15:10 -07:00
|
|
|
browser.addEventListener("load", function tabLoad(aEvent) {
|
|
|
|
browser.removeEventListener(aEvent.type, tabLoad, true);
|
2012-05-10 08:01:37 -07:00
|
|
|
openConsole(null, consoleOpened);
|
2012-05-10 06:15:10 -07:00
|
|
|
}, true);
|
2010-10-28 09:01:37 -07:00
|
|
|
}
|
|
|
|
|