Bug 640899. Have test_leaf_layers_partition_browser_window.xul test maximized windows as well as normal windows; on Windows XP, don't test normal windows because we know the resizer overlaps there. r=tnikkel

This commit is contained in:
Robert O'Callahan 2011-05-17 11:04:53 +12:00
Родитель 1960414b5f
Коммит ff4a04b32c
1 изменённых файлов: 36 добавлений и 13 удалений

Просмотреть файл

@ -17,46 +17,69 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
// Bug 640889 - the test doesn't like seeing the WinXP resizer.
var version = Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2)
.getProperty("version");
if (navigator.platform.indexOf("Win") == 0 && parseFloat(version) < 6.0) {
todo(false, "Bug 640889 - the test doesn't like seeing the WinXP resizer.");
SimpleTest.finish();
} else {
var winXP = navigator.platform.indexOf("Win") == 0 && parseFloat(version) < 6.0;
var tests = [{maximize:false}, {maximize:true}];
var testIndex = 0;
var win;
function testInfo() {
return tests[testIndex].maximize ? " (maximized)" : " (non-maximized)";
}
function doTest(evt) {
if (tests[testIndex].maximize) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
wm.getMostRecentWindow("navigator:browser").maximize();
}
var initialCount = win.mozPaintCount;
function nextStep() {
if (win.mozPaintCount == initialCount) {
is(win.mozPaintCount, initialCount, "Waiting for mozPaintCount to increase.");
// Do not use SimpleTest.executeSoon() here: give a little more time.
setTimeout(nextStep, 0);
return;
}
isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased");
isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased" + testInfo());
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
ok(utils.leafLayersPartitionWindow(),
"Leaf layers should form a non-overlapping partition of the browser window");
"Leaf layers should form a non-overlapping partition of the browser window" + testInfo());
win.close();
SimpleTest.finish();
++testIndex;
nextTest();
}
SimpleTest.executeSoon(nextStep);
}
// Run the test in a separate window so we get a clean browser window.
var win = window.open("data:text/html,<html style='overflow:scroll'>",
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
win.addEventListener('load', doTest, false);
function nextTest() {
if (testIndex >= tests.length) {
SimpleTest.finish();
return;
}
// Skip non-maximized tests on WinXP since the resizer causes overlapping layers
if (winXP && !tests[testIndex].maximize) {
++testIndex;
nextTest();
return;
}
// Run the test in a separate window so we get a clean browser window.
win = window.open("data:text/html,<html style='overflow:scroll'>",
"", "scrollbars=yes,toolbar,menubar,width=500,height=500");
win.addEventListener('load', doTest, false);
}
nextTest();
]]>
</script>
</window>