mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1064843
part 11 - Move checkWindowPureColor helper function from top-layer test to WindowSnapshot.js. r=roc
This commit is contained in:
parent
4da30c76f3
commit
09d5d48035
@ -89,23 +89,6 @@ function ok(cond, msg) {
|
|||||||
opener.ok(cond, "[top-layer] " + msg);
|
opener.ok(cond, "[top-layer] " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generatePureColorCanvas(width, height, color) {
|
|
||||||
const canvas = document.createElement("canvas");
|
|
||||||
canvas.width = width;
|
|
||||||
canvas.height = height;
|
|
||||||
const context = canvas.getContext("2d");
|
|
||||||
context.fillStyle = color;
|
|
||||||
context.fillRect(0, 0, width, height);
|
|
||||||
return canvas;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkWindowPureColor(color) {
|
|
||||||
const snapshot = SpecialPowers.snapshotRect(window);
|
|
||||||
const pureColor =
|
|
||||||
generatePureColorCanvas(snapshot.width, snapshot.height, color);
|
|
||||||
assertSnapshots(snapshot, pureColor, true, null, "snapshot", color);
|
|
||||||
}
|
|
||||||
|
|
||||||
function synthesizeMouseAtWindowCenter() {
|
function synthesizeMouseAtWindowCenter() {
|
||||||
synthesizeMouseAtPoint(innerWidth / 2, innerHeight / 2, {});
|
synthesizeMouseAtPoint(innerWidth / 2, innerHeight / 2, {});
|
||||||
}
|
}
|
||||||
@ -130,7 +113,7 @@ function nextTest() {
|
|||||||
|
|
||||||
ok(!document.mozFullScreen, "Shouldn't be in fullscreen");
|
ok(!document.mozFullScreen, "Shouldn't be in fullscreen");
|
||||||
// check window snapshot
|
// check window snapshot
|
||||||
checkWindowPureColor("red");
|
assertWindowPureColor(window, "red");
|
||||||
// simulate click
|
// simulate click
|
||||||
window.addEventListener("click", firstClick);
|
window.addEventListener("click", firstClick);
|
||||||
synthesizeMouseAtWindowCenter();
|
synthesizeMouseAtWindowCenter();
|
||||||
@ -146,7 +129,7 @@ function firstClick(evt) {
|
|||||||
function enterFullscreen() {
|
function enterFullscreen() {
|
||||||
ok(document.mozFullScreen, "Should now be in fullscreen");
|
ok(document.mozFullScreen, "Should now be in fullscreen");
|
||||||
// check window snapshot
|
// check window snapshot
|
||||||
checkWindowPureColor("green");
|
assertWindowPureColor(window, "green");
|
||||||
// check computed style of #parent
|
// check computed style of #parent
|
||||||
const style = getComputedStyle(gParent);
|
const style = getComputedStyle(gParent);
|
||||||
for (var prop of gParentProperties) {
|
for (var prop of gParentProperties) {
|
||||||
|
@ -75,3 +75,14 @@ function assertSnapshots(s1, s2, expectEqual, fuzz, s1name, s2name) {
|
|||||||
}
|
}
|
||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assertWindowPureColor(win, color) {
|
||||||
|
const snapshot = SpecialPowers.snapshotRect(win);
|
||||||
|
const canvas = document.createElement("canvas");
|
||||||
|
canvas.width = snapshot.width;
|
||||||
|
canvas.height = snapshot.height;
|
||||||
|
const context = canvas.getContext("2d");
|
||||||
|
context.fillStyle = color;
|
||||||
|
context.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
assertSnapshots(snapshot, canvas, true, null, "snapshot", color);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user