Bug 1631452 part 5: Add some windows-specific fuzz to pages-per-sheet tests, to account for page-margins not being reliably respected in test_printpreview.xhtml. r=TYLin

This patch is basically a workaround for this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1671036

Depends on D93298

Differential Revision: https://phabricator.services.mozilla.com/D93434
This commit is contained in:
Daniel Holbert 2020-10-14 03:44:29 +00:00
parent 4fdc0fb530
commit dffea8097c

View File

@ -741,8 +741,10 @@ async function runTest30() {
// case with zero page-margins and zero unwritable margins. (This makes it
// tractable to create a reference case without having to account for margins
// that are outside of the content area.)
async function checkSupportedPagesPerSheetValue(src1, src2, numPages) {
async function checkSupportedPagesPerSheetValue(src1, src2, numPages, fuzz) {
await compareFiles(src1, src2, {
maxDifferent: fuzz.maxDifferent,
maxDifference: fuzz.maxDifference,
test: {
settings: {
marginTop: 0,
@ -770,23 +772,41 @@ async function checkSupportedPagesPerSheetValue(src1, src2, numPages) {
},
});
}
// Pages-per-sheet: supported values (4, 9, 16)
// And eventually 2 and 6, per bug 1669905.
async function runTest31() {
// XXXdholbert On windows, our zero-margin settings aren't reliably respected
// for some reason; see bug 1671036. For now, we just account for that with a
// hefty amount of fuzz, guarded behind a platform-specific check so that we
// can keep this strict on other platforms.
let fuzz = navigator.platform.includes("Win") ?
{ maxDifferent: 101278, maxDifference: 255 } :
{ maxDifferent: 0, maxDifference: 0 };
await checkSupportedPagesPerSheetValue("printpreview_pps4.html",
"printpreview_pps4_ref.html", 4);
"printpreview_pps4_ref.html", 4, fuzz);
requestAnimationFrame(() => setTimeout(runTest32));
}
async function runTest32() {
let fuzz = navigator.platform.includes("Win") ?
{ maxDifferent: 121116, maxDifference: 255 } :
{ maxDifferent: 0, maxDifference: 0 };
await checkSupportedPagesPerSheetValue("printpreview_pps9.html",
"printpreview_pps9_ref.html", 9);
"printpreview_pps9_ref.html", 9, fuzz);
requestAnimationFrame(() => setTimeout(runTest33));
}
async function runTest33() {
let fuzz = navigator.platform.includes("Win") ?
{ maxDifferent: 145706, maxDifference: 255 } :
{ maxDifferent: 0, maxDifference: 0 };
await checkSupportedPagesPerSheetValue("printpreview_pps16.html",
"printpreview_pps16_ref.html", 16);
"printpreview_pps16_ref.html", 16,
fuzz);
finish();
}