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

This commit is contained in:
Mounir Lamouri 2013-03-25 18:52:17 +00:00
Родитель c8f6e2e872
Коммит 5ee9ab3bf0
5 изменённых файлов: 54 добавлений и 24 удалений

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

@ -142,14 +142,7 @@ MOCHITEST_FILES = \
test_bug823173.html \
test_bug850517.html \
test_bug848088.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

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

@ -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() {
isnot(aWindow.screenX, prevX, "Window x position should have changed");
isnot(aWindow.screenY, prevY, "Window y position should have changed");
// 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() {

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

@ -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;

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

@ -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": "",

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

@ -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":"",