Skip to content

Commit

Permalink
Bug 1685963 - Update test_scrollbar_colors.html pixel counts for non-…
Browse files Browse the repository at this point in the history
…native theme. r=spohl

Differential Revision: https://phabricator.services.mozilla.com/D101326
  • Loading branch information
heycam committed Jan 14, 2021
1 parent 9e9b090 commit fe9ce42
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions widget/tests/test_scrollbar_colors.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
return result;
}

// == Native theme ==

const WIN_REFERENCES = [
// Yellow background
["255,255,0", 6889],
Expand Down Expand Up @@ -65,6 +67,28 @@
["0,255,255", 1152],
];

// == Non-native theme ==

const WIN_NNT_REFERENCES = [
// Yellow background
["255,255,0", 7396],
// Blue scrollbar face
["0,0,255", 1272],
// Cyan scrollbar track
["0,255,255", 1204],
];

const MAC_NNT_REFERENCES = MAC_REFERENCES;

const LINUX_NNT_REFERENCES = [
// Yellow background
["255,255,0", 7744],
// Blue scrollbar face
["0,0,255", 368],
// Cyan scrollbar track
["0,255,255", 1852],
];

let outer = document.querySelector(".outer");
let outerRect = outer.getBoundingClientRect();
if (outerRect.width == outer.clientWidth &&
Expand All @@ -77,13 +101,14 @@

let canvas = snapshotRect(window, outerRect);
let stats = countPixels(canvas);
let isNNT = SpecialPowers.getBoolPref("widget.disable-native-theme-for-content");
let references;
if (navigator.platform.startsWith("Win")) {
references = WIN_REFERENCES;
references = isNNT ? WIN_NNT_REFERENCES : WIN_REFERENCES;
} else if (navigator.platform.startsWith("Mac")) {
references = MAC_REFERENCES;
references = isNNT ? MAC_NNT_REFERENCES : MAC_REFERENCES;
} else if (navigator.platform.startsWith("Linux")) {
references = LINUX_REFERENCES;
references = isNNT ? LINUX_NNT_REFERENCES : LINUX_REFERENCES;
} else {
ok(false, "Unsupported platform");
}
Expand Down

0 comments on commit fe9ce42

Please sign in to comment.