Bug 1567105 - Tests. r=jwatt a=RyanVM
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 23 Jul 2019 19:22:48 +0000
changeset 544713 6fca9f4239e20df1458f23b8284e29f3d11c904f
parent 544712 0142a67ef10d096e9f9a3d90e7204e8b1b5f6168
child 544714 5629476e2815fdfb3e3ba285626c95dd69df54fe
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt, RyanVM
bugs1567105
milestone69.0
Bug 1567105 - Tests. r=jwatt a=RyanVM The reftest-paged tests don't trigger the document clone code-path (I realized that after writing them), but I guess they don't hurt, the printpreview test does fail without the previous patch. Depends on D39053 Differential Revision: https://phabricator.services.mozilla.com/D39054
layout/base/tests/chrome/chrome.ini
layout/base/tests/chrome/printpreview_helper.xul
layout/base/tests/chrome/printpreview_quirks.html
layout/base/tests/chrome/printpreview_quirks_ref.html
layout/reftests/pagination/quirks-notref.html
layout/reftests/pagination/quirks-ref.html
layout/reftests/pagination/quirks.html
layout/reftests/pagination/reftest.list
--- a/layout/base/tests/chrome/chrome.ini
+++ b/layout/base/tests/chrome/chrome.ini
@@ -10,16 +10,18 @@ support-files =
   file_bug458898.html
   printpreview_bug396024_helper.xul
   printpreview_bug482976_helper.xul
   printpreview_helper.xul
   printpreview_font_api.html
   printpreview_font_api_ref.html
   printpreview_font_mozprintcallback.html
   printpreview_font_mozprintcallback_ref.html
+  printpreview_quirks.html
+  printpreview_quirks_ref.html
   file_bug1018265.xul
 
 [test_bug396367-1.html]
 [test_bug396367-2.html]
 [test_bug420499.xul]
 [test_bug458898.html]
 [test_bug465448.xul]
 support-files =
--- a/layout/base/tests/chrome/printpreview_helper.xul
+++ b/layout/base/tests/chrome/printpreview_helper.xul
@@ -386,16 +386,44 @@ async function runTest10() {
   printpreview(true);
   // Wait for the mozprintcallback to finish.
   await mozPrintCallbackDone;
   ctx2.drawWindow(frameElts[1].contentWindow, 0, 0, 400, 400, "rgb(255,255,255)");
 
   exitprintpreview();
   ok(compareCanvases(), "Printing pages with fonts loaded from a mozPrintCallback should be the same.");
 
+  requestAnimationFrame(function() { setTimeout(runTest11); } );
+}
+
+async function compareFiles(src1, src2) {
+  const iframeElement = document.getElementsByTagName("iframe")[0];
+  await new Promise((resolve) => {
+    iframeElement.addEventListener("load", resolve, { capture: true, once: true });
+    iframeElement.setAttribute("src", src1);
+  });
+  printpreview();
+  ctx1.drawWindow(frameElts[1].contentWindow, 0, 0, 400, 400, "rgb(255,255,255)");
+  exitprintpreview();
+
+  await new Promise((resolve) => {
+    iframeElement.addEventListener("load", resolve, { capture: true, once: true });
+    iframeElement.setAttribute("src", src2);
+  });
+
+  printpreview();
+  ctx2.drawWindow(frameElts[1].contentWindow, 0, 0, 400, 400, "rgb(255,255,255)");
+  exitprintpreview();
+
+  ok(compareCanvases(), `Printing ${src1} and ${src2} should produce the same results`);
+}
+
+// bug 1567105
+async function runTest11() {
+  await compareFiles("printpreview_quirks.html", "printpreview_quirks_ref.html");
   finish();
 }
 
 ]]></script>
 <table style="border: 1px solid black;" xmlns="http://www.w3.org/1999/xhtml">
 <tr><th>Print preview canvas 1</th><th>Print preview canvas 2</th></tr>
 <tr>
 <td><canvas height="400" width="400"></canvas></td>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/chrome/printpreview_quirks.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<meta charset="utf-8">
+<style>
+  .HiDdEn { display: none }
+</style>
+<body class="hidden">
+  Some content that I should be able to print.
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/chrome/printpreview_quirks_ref.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<meta charset="utf-8">
+<body>
+  Some content that I should be able to print.
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/quirks-notref.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<!-- bug 1567105 -->
+<html class="reftest-paged">
+<meta charset="utf-8">
+<!-- Intentionally blank -->
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/quirks-ref.html
@@ -0,0 +1,6 @@
+<!doctype html>
+<html class="reftest-paged">
+<meta charset="utf-8">
+<body>
+  Some content that I should be able to print.
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/quirks.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<!-- bug 1567105 -->
+<html class="reftest-paged">
+<meta charset="utf-8">
+<style>
+  .HiDdEn { display: none }
+</style>
+<body class="hidden">
+  Some content that I should be able to print.
+</body>
--- a/layout/reftests/pagination/reftest.list
+++ b/layout/reftests/pagination/reftest.list
@@ -114,8 +114,11 @@ fuzzy-if(cocoaWidget,0-1,0-5000) == 7450
 == 960822.html 960822-ref.html
 == 966419-1.html 966419-1-ref.html
 == 966419-2.html 966419-2-ref.html
 # asserts(3) fails 1108104.html 1108104-ref.html # bug 1067755, 1135556
 == 1166147.html 1166147-ref.html
 == 1321803-1a.html 1321803-1-ref.html
 == content-url-element.html image.html
 == content-url-pseudo.html content-url-pseudo-ref.html
+
+== quirks.html quirks-ref.html
+!= quirks.html quirks-notref.html