fune/browser/base/content/test/popups/browser_popup_linux_move.js
Matthias Camenzind 3dfa3a3d4c Bug 1803611 - Popup resize and move tests for Linux. r=emilio
On X11 `mozInnerScreenX/Y` are ignored for the first test that runs in a
new popup. For Wayland positions during resize tests are ignored, and
`browser_popup_linux_move.js` is just a todo checking whether we can
move a window at all.

Also allows to run the tests with `resizeTo` and `moveTo` when size and
position property setters are disabled.

Differential Revision: https://phabricator.services.mozilla.com/D169963
2023-02-19 19:24:56 +00:00

55 lines
1.6 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function createLinuxMoveTests(aFirstValue, aSecondValue, aMsg) {
for (let prop of ["screenX", "screenY"]) {
let first = {};
first[prop] = aFirstValue;
let second = {};
second[prop] = aSecondValue;
new ResizeMoveTest(
[first, second],
/* aInstant */ true,
`${aMsg} ${prop},${prop}`
);
new ResizeMoveTest(
[first, second],
/* aInstant */ false,
`${aMsg} ${prop},${prop}`
);
}
}
if (AppConstants.platform == "linux" && gfxInfo.windowProtocol == "wayland") {
add_task(async () => {
let tab = await ResizeMoveTest.GetOrCreateTab();
let browsingContext = await ResizeMoveTest.GetOrCreatePopupBrowsingContext();
let win = browsingContext.topChromeWindow;
let targetX = win.screenX + 10;
win.moveTo(targetX, win.screenY);
await BrowserTestUtils.waitForCondition(
() => win.screenX == targetX
).catch(() => {});
todo(win.screenX == targetX, "Moving windows on wayland.");
win.close();
await BrowserTestUtils.removeTab(tab);
});
} else {
createLinuxMoveTests(9, 10, "Move");
createLinuxMoveTests(10, 0, "Move revert");
createLinuxMoveTests(10, 10, "Move repeat");
new ResizeMoveTest(
[{ screenX: 10 }, { screenY: 10 }, { screenX: 20 }],
/* aInstant */ true,
"Move sequence",
/* aWaitForCompletion */ true
);
new ResizeMoveTest(
[{ screenX: 10 }, { screenY: 10 }, { screenX: 20 }],
/* aInstant */ false,
"Move sequence",
/* aWaitForCompletion */ true
);
}