Bug 1658173 part 1: Increase the height of the print-preview viewport in automated test. r=emilio

This hange ensures that the upper-left corner of this test's print-preview
area continues to show the previewed sheet (rather than the uninteresting gray
print preview background color).

Without this test change, the next patch in this series would cause this test's
print-previewed-sheet to be scaled down vertically (and shifted over
horizontally); and the shift is sizeable enough to push the sheet "out of
frame" of the relatively-small area that this test snapshots when doing
screenshot comparisons.  We obviously don't want that to happen; that would
nerf this test's screenshot-equality comparisons, and it would also cause this
test's screenshot-not-equal comparisons to start failing.

As noted in the included code-comment in the test: we can probably revert this
change once we've fixed this test to make it compare a larger area of the
print-preview rendering, in bug 1602410.

Differential Revision: https://phabricator.services.mozilla.com/D87317
This commit is contained in:
Daniel Holbert 2020-08-17 21:08:29 +00:00
Родитель 811a48a03b
Коммит 1cc2b45cc6
1 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@ -4,8 +4,17 @@
type="text/css"?>
<window onload="runTests()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<iframe height="200" width="600" type="content"></iframe>
<iframe height="200" width="600" type="content"></iframe>
<!-- XXXdholbert this wrapper-div and the 'min-height' below are temporary
hacks, to be removed when bug 1602410 lands. They only exist so that
the print-preview area can be sufficiently tall for the previewed
content to be visible in the top left corner of print-preview, in the
face of the "contain"-style scaling & centering that we do.
-->
<div style="overflow:hidden; height: 200px;">
<iframe height="200" width="600" type="content"></iframe>
<iframe height="200" width="600" type="content"
style="min-height:500px"></iframe>
</div>
<script type="application/javascript">
<![CDATA[
// Note: We can't use window.frames directly here because the type="content"
@ -490,13 +499,23 @@ async function runTest15() {
// Various image tests.
async function runTest16() {
// fuzzy: SVG image in the test pixel-snaps different than <div> in the ref.
await compareFiles("printpreview_images.html", "printpreview_images_ref.html", { maxDifferent: 118, maxDifference: 177 });
// (And on WebRender, the pixel-snapping seems to shift some pixels over a
// bit such that they're fully white vs. fully blue; hence 255 as the allowed
// color-channel difference.)
// XXXdholbert We should revisit this and adjust these thresholds (hopefully
// lower) after bug 1602410 lands.
await compareFiles("printpreview_images.html", "printpreview_images_ref.html", { maxDifferent: 118, maxDifference: 255 });
requestAnimationFrame(function() { setTimeout(runTest17); } );
}
async function runTest17() {
// fuzzy: SVG image in the test pixel-snaps different than <div> in the ref.
await compareFiles("printpreview_images_sw.html", "printpreview_images_sw_ref.html", { waitForMessage: true, maxDifferent: 118, maxDifference: 177 });
// (And on WebRender, the pixel-snapping seems to shift some pixels over a
// bit such that they're fully white vs. fully blue; hence 255 as the allowed
// color-channel difference.)
// XXXdholbert We should revisit this and adjust these thresholds (hopefully
// lower) after bug 1602410 lands.
await compareFiles("printpreview_images_sw.html", "printpreview_images_sw_ref.html", { waitForMessage: true, maxDifferent: 118, maxDifference: 255 });
requestAnimationFrame(() => setTimeout(runTest18));
}