forked from mirrors/gecko-dev
MozReview-Commit-ID: FS6yrGggD7o --HG-- extra : rebase_source : c4b5c404292dd2c70d2c2933cdd429e903012143
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
add_task(async function test() {
|
|
const win = await BrowserTestUtils.openNewBrowserWindow();
|
|
|
|
async function changeSizeMode(mode) {
|
|
let promise = BrowserTestUtils.waitForEvent(win, "sizemodechange");
|
|
win[mode]();
|
|
await promise;
|
|
}
|
|
if (win.windowState != win.STATE_NORMAL) {
|
|
await changeSizeMode("restore");
|
|
}
|
|
|
|
const {outerWidth, outerHeight, screenX, screenY} = win;
|
|
function checkCurrentState(sizemode) {
|
|
let state = JSON.parse(ss.getWindowState(win));
|
|
let winState = state.windows[0];
|
|
let msgSuffix = ` should match on ${sizemode} mode`;
|
|
is(winState.width, outerWidth, "width" + msgSuffix);
|
|
is(winState.height, outerHeight, "height" + msgSuffix);
|
|
// The position attributes seem to be affected on macOS when the
|
|
// window gets maximized, so skip checking them for now.
|
|
if (AppConstants.platform != "macosx" || sizemode == "normal") {
|
|
is(winState.screenX, screenX, "screenX" + msgSuffix);
|
|
is(winState.screenY, screenY, "screenY" + msgSuffix);
|
|
}
|
|
is(winState.sizemode, sizemode, "sizemode should match");
|
|
}
|
|
|
|
checkCurrentState("normal");
|
|
|
|
await changeSizeMode("maximize");
|
|
checkCurrentState("maximized");
|
|
|
|
await changeSizeMode("minimize");
|
|
checkCurrentState("minimized");
|
|
|
|
// Clean up.
|
|
await BrowserTestUtils.closeWindow(win);
|
|
});
|