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
|
|
|
}
|
|
|
|
|
2013-09-10 11:37:48 -07:00
|
|
|
HUD.jsterm.execute("1+1", performTest);
|
2010-10-28 09:01:37 -07:00
|
|
|
|
2013-09-10 11:37:48 -07:00
|
|
|
function performTest(node) {
|
|
|
|
let scrollNode = HUD.outputNode.parentNode;
|
|
|
|
isnot(scrollNode.scrollTop, 0, "scroll location is not at the top");
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
let rectNode = node.getBoundingClientRect();
|
2013-09-10 11:37:48 -07:00
|
|
|
let rectOutput = scrollNode.getBoundingClientRect();
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
// Visible scroll viewport.
|
2013-09-10 11:37:48 -07:00
|
|
|
let height = scrollNode.scrollHeight - scrollNode.scrollTop;
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
// Top position of the last message node, relative to the outputNode.
|
2013-09-10 11:37:48 -07:00
|
|
|
let top = rectNode.top + scrollNode.scrollTop;
|
|
|
|
let bottom = top + node.clientHeight;
|
|
|
|
info("output height " + height + " node top " + top + " node bottom " + bottom + " node height " + node.clientHeight);
|
2010-10-28 09:01:37 -07:00
|
|
|
|
2013-09-10 11:37:48 -07:00
|
|
|
ok(top >= 0 && bottom <= height, "last message is visible");
|
2010-10-28 09:01:37 -07:00
|
|
|
|
|
|
|
finishTest();
|
2012-05-10 06:15:10 -07:00
|
|
|
};
|
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
|
|
|
}
|
|
|
|
|