Bug 1933958 - Add a test for the widget opaque region. r=gfx-reviewers,aosmond
This will prevent regressions like bug 1933952.
Differential Revision: https://phabricator.services.mozilla.com/D230523
This commit is contained in:
@@ -39,6 +39,8 @@ skip-if = [
|
||||
|
||||
["browser_hiddenwindow_existence.js"]
|
||||
|
||||
["browser_opaque_region.js"]
|
||||
|
||||
["browser_panel_vsync.js"]
|
||||
support-files = ["!/browser/components/downloads/test/browser/head.js"]
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_opaque_region() {
|
||||
// Ensure we've painted.
|
||||
await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
|
||||
|
||||
let contentRect = document
|
||||
.getElementById("tabbrowser-tabbox")
|
||||
.getBoundingClientRect();
|
||||
let opaqueRegion = window.windowUtils.getWidgetOpaqueRegion();
|
||||
|
||||
info(`Got opaque region: ${JSON.stringify(opaqueRegion)}`);
|
||||
isnot(opaqueRegion.length, 0, "Should have some part of the window opaque");
|
||||
|
||||
let anyContainsContentRect = false;
|
||||
let containsContentRect = opaqueRect => {
|
||||
return (
|
||||
opaqueRect.x <= contentRect.x &&
|
||||
opaqueRect.y <= contentRect.y &&
|
||||
opaqueRect.width >= contentRect.width &&
|
||||
opaqueRect.height >= contentRect.height
|
||||
);
|
||||
};
|
||||
|
||||
for (let opaqueRect of opaqueRegion) {
|
||||
anyContainsContentRect |= containsContentRect(opaqueRect);
|
||||
}
|
||||
|
||||
ok(
|
||||
anyContainsContentRect,
|
||||
"The browser area should be considered opaque by widget"
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user