Bug 854117 - Re-enable test_resize_move_windows.html and test_resize_move_windows.xul on Linux. rs=Ms2ger

This commit is contained in:
Mounir Lamouri 2013-03-23 18:02:21 +00:00
parent 182393ad6c
commit f74640f5c6
6 changed files with 55 additions and 32 deletions

View File

@ -141,14 +141,7 @@ MOCHITEST_FILES = \
test_bug817476.html \
test_bug823173.html \
test_bug850517.html \
$(NULL)
ifneq (Linux,$(OS_ARCH))
MOCHITEST_FILES += \
test_resize_move_windows.html \
$(NULL)
else
$(filter disabled-on-linux-for-timeouts--bug-677841, test_resize_move_windows.html)
endif
include $(topsrcdir)/config/rules.mk

View File

@ -52,12 +52,14 @@ function getNewHeight(aWindow)
function getNewX(aWindow)
{
return (aWindow.screenX > (screen.width / 2)) ? 0 : screen.width;
return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2))
? 0 : screen.width - aWindow.outerWidth;
}
function getNewY(aWindow)
{
return (aWindow.screenY > (screen.height / 2)) ? 0 : screen.height;
return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2))
? 0 : screen.height - aWindow.outerHeight;
}
/**
@ -180,12 +182,30 @@ function checkChangeIsEnabled(aWindow, aNext)
}
function posChangeCondition() {
// With GTK, sometimes, only one dimension changes.
if (navigator.platform.indexOf('Linux') != -1) {
return aWindow.screenX != prevX || aWindow.screenY != prevY;
}
return aWindow.screenX != prevX && aWindow.screenY != prevY;
}
function posChangeTest() {
// With GTK, sometimes, only one dimension changes.
if (navigator.platform.indexOf('Linux') != -1) {
// With GTK, sometimes, aWindow.screenX changes during two calls.
// So we call it once and save the returned value.
var x = aWindow.screenX;
var y = aWindow.screenY;
if (x != prevX) {
isnot(x, prevX, "Window x position should have changed");
}
if (y != prevY) {
isnot(y, prevY, "Window y position should have changed");
}
} else {
isnot(aWindow.screenX, prevX, "Window x position should have changed");
isnot(aWindow.screenY, prevY, "Window y position should have changed");
}
prevX = aWindow.screenX;
prevY = aWindow.screenY;
@ -235,9 +255,14 @@ function checkChangeIsEnabled(aWindow, aNext)
aWindow.screenY = getNewY(aWindow);
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
prevX = aWindow.screenX;
prevY = aWindow.screenY;
aWindow.moveTo(getNewX(aWindow), getNewY(aWindow));
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
prevX = aWindow.screenX;
prevY = aWindow.screenY;
aWindow.moveBy(getNewX(aWindow) - aWindow.screenX,
getNewY(aWindow) - aWindow.screenY);
@ -283,11 +308,11 @@ SimpleTest.waitForFocus(function() {
" };" +
" is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');" +
" is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');" +
" is_range(window.screenX, 120, 5, 'parameter screenX should be taken into account');" +
" is_range(window.screenY, 120, 5, 'parameter screenY should be taken into account');" +
" is_range(window.screenX, 65, 5, 'parameter screenX should be taken into account');" +
" is_range(window.screenY, 65, 5, 'parameter screenY should be taken into account');" +
" window.opener.checkChangeIsEnabled(window, next);" +
"} <\/script>", '',
'width=170,height=170,screenX=120,screenY=120');
'width=170,height=170,screenX=65,screenY=65');
SimpleTest.waitForFocus(function() {
w.check(function() {

View File

@ -59,6 +59,7 @@ MOCHITEST_CHROME_FILES = \
test_bug830858.xul \
file_bug830858.xul \
test_indexedSetter.html \
test_resize_move_windows.xul \
$(NULL)
ifeq (WINNT,$(OS_ARCH))
@ -68,14 +69,6 @@ MOCHITEST_CHROME_FILES += \
$(NULL)
endif
ifneq (Linux,$(OS_ARCH))
MOCHITEST_CHROME_FILES += \
test_resize_move_windows.xul \
$(NULL)
else
$(filter disabled-on-linux-for-timeouts--bug-834716, test_resize_move_windows.xul)
endif
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
MOCHITEST_CHROME_FILES += \
test_MozEnteredDomFullscreen_event.xul \

View File

@ -49,12 +49,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541
function getNewX(aWindow)
{
return (aWindow.screenX > (screen.width / 2)) ? 0 : screen.width;
return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2))
? 0 : screen.width - aWindow.outerWidth;
}
function getNewY(aWindow)
{
return (aWindow.screenY > (screen.height / 2)) ? 0 : screen.height;
return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2))
? 0 : screen.height - aWindow.outerHeight;
}
/**
@ -110,6 +112,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541
return aWindow.screenX != prevX && aWindow.screenY != prevY;
}
function posChangeConditionIgnoreLinux() {
if (posChangeCondition()) {
return true;
}
if (navigator.platform.indexOf('Linux') != -1) {
return true;
}
}
function posChangeTest() {
// With GTK, sometimes, only one dimension changes.
if (navigator.platform.indexOf('Linux') != -1) {
@ -182,7 +194,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541
aWindow.moveBy(getNewX(aWindow) - aWindow.screenX,
getNewY(aWindow) - aWindow.screenY);
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
hitEventLoop(posChangeConditionIgnoreLinux, posChangeTest, hits, function () {
/**
* Outer width/height checks.
*/
@ -222,11 +234,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541
" };" +
" is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');" +
" is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');" +
" is_range(window.screenX, 120, 5, 'parameter screenX should be taken into account');" +
" is_range(window.screenY, 120, 5, 'parameter screenY should be taken into account');" +
" is_range(window.screenX, 25, 5, 'parameter screenX should be taken into account');" +
" is_range(window.screenY, 25, 5, 'parameter screenY should be taken into account');" +
" checkChangeIsEnabled(window, next);" +
"} <\/script>", '',
'width=170,height=170,screenX=120,screenY=120');
'width=170,height=170,screenX=25,screenY=25');
SimpleTest.waitForFocus(function() {
w.wrappedJSObject.ok = SimpleTest.ok;

View File

@ -184,8 +184,8 @@
"dom/tests/mochitest/bugs/test_bug61098.html": "",
"dom/tests/mochitest/bugs/test_bug641552.html": "",
"dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html": "bug 775227",
"dom/tests/mochitest/bugs/test_resize_move_windows.html": "TIMED_OUT",
"dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "TIMED_OUT",
"dom/tests/mochitest/bugs/test_resize_move_windows.html": "Windows can't change size and position on Android",
"dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "Windows can't change size on Android",
"dom/tests/mochitest/bugs/test_window_bar.html": "",
"dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html": "",
"dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html": "",

View File

@ -359,8 +359,8 @@
"dom/tests/mochitest/bugs/test_bug641552.html":"",
"dom/tests/mochitest/bugs/test_bug642026.html":"",
"dom/tests/mochitest/bugs/test_bug648465.html":"",
"dom/tests/mochitest/bugs/test_sizetocontent_clamp.html":"",
"dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "Windows can't change size on B2G",
"dom/tests/mochitest/bugs/test_resize_move_windows.html": "Windows can't change size and position on B2G",
"dom/tests/mochitest/bugs/test_window_bar.html":"",
"dom/tests/mochitest/general/test_497898.html":"",
"dom/tests/mochitest/general/test_bug628069_1.html":"",