Bug 1166147 - Part4: Add a reftest for this bug. r?dholbert draft
authorNeerja Pancholi <npancholi@mozilla.com>
Mon, 30 Jan 2017 13:29:50 -0800
changeset 468320 e4961a4bb44bae7ebed2f5b5dd5aaceb220debf1
parent 468256 9fd0800f2e39e5eb513fcbe875bdcb6d543a6577
child 543905 6a31d8c5fc7d55c7ae42063deea7008c5342ee22
push id43418
push userbmo:npancholi@mozilla.com
push dateTue, 31 Jan 2017 01:05:06 +0000
reviewersdholbert
bugs1166147
milestone54.0a1
Bug 1166147 - Part4: Add a reftest for this bug. r?dholbert MozReview-Commit-ID: JsVhk5eoDgT
layout/reftests/printing/1166147-ref.html
layout/reftests/printing/1166147.html
layout/reftests/printing/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/printing/1166147-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+This test passes if the pages generated are identical for both vertical-lr and
+horizontal-tb writing-modes by means of making the size of the content we are
+printing equal to exactly the same number of pages being generated in each
+writing mode. 
+This sizing calculated like so:
+
+1. It is important to note that irrespective of the writing-mode, the print
+   preview always lays out printed pages vertically. Therefore, it is possible
+   to equate the printed content of two differnet writing modes if both
+   cases generate the exact same number of pages (and of course no text on
+   the pages, which is why we use background color since it is independent 
+   of writing mode).
+2. To avoid an unnecessary vertical scrollbar (since scrolled content will be
+   clipped anyway in the reftest snapshot), the maximum number of 5X3in pages
+   that we should generate for the reftest snapshot are equal to 3.
+2. Considering a margin of 0.5in on each side of the 5X3in page, we get the
+   size of the page content area to be 4X2in per page and to generate exactly 3
+   printed pages from this in horizontal-tb writing mode, we need a pritable
+   area of 4X6in (as used below).
+
+Similarly, the size for the test case printable area is calculated, only
+considering a vertical-rl writing mode.
+
+It is important to note here that when printing this test outside of the test
+harness, the background color will not show since we omit printing and
+previewing of background colors by default via the browser printing path.
+-->
+<html class="reftest-print">
+  <body style="margin:0;">
+    <div style="background: teal; width:4in; height:6in;">
+    </div>
+  </body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/layout/reftests/printing/1166147.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<!--
+This test checks if content is paginated correctly in the horizontal
+direction when printing. The test passes if the pages generated
+are identical for both vertical-lr and horizontal-tb writing-modes by means of
+making the size of the content we are printing equal to exactly the same number
+of pages being generated in each writing mode.
+This sizing is calculated like so:
+
+1. It is important to note that irrespective of the writing-mode, the print
+   preview always lays out printed pages vertically. Therefore, it is possible
+   to equate the printed content of two differnet writing modes if both
+   cases generate the exact same number of pages (and of course no text on
+   the pages, which is why we use background color since it is independent
+   of writing mode).
+2. To avoid an unnecessary vertical scrollbar (since scrolled content will be
+   clipped anyway in the reftest snapshot), the maximum number of 5X3in pages
+   that we should generate for the reftest snapshot are equal to 3.
+2. Considering a margin of 0.5in on each side of the 5X3in page, we get the
+   size of the page content area to be 4X2in per page and to generate exactly 3
+   printed pages from this in the vertical-rl writing mode, we need a pritable
+   area of 12X2in (as used below).
+
+Similarly, the size for the reference printable area is calculated, only
+considering a horizontal-tb writing mode.
+
+It is important to note here that when printing this test outside of the test
+harness, the background color will not show since we omit printing and
+previewing of background colors by default via the browser printing path.
+-->
+<html class="reftest-print" style="writing-mode: vertical-rl;">
+  <body style="margin:0;">
+    <div style="background: teal; width:12in; height:2in;">
+    </div>
+  </body>
+</html>
\ No newline at end of file
--- a/layout/reftests/printing/reftest.list
+++ b/layout/reftests/printing/reftest.list
@@ -30,10 +30,13 @@
 fuzzy-if(cocoaWidget,1,5000) == 745025-1.html 745025-1-ref.html
 == 820496-1.html 820496-1-ref.html
 
 # NOTE: These tests don't yet rigorously test what they're
 # trying to test (shrink-to-fit behavior), due to bug 967311.
 == 960822.html 960822-ref.html
 == 966419-1.html 966419-1-ref.html
 == 966419-2.html 966419-2-ref.html
+
+== 1166147.html 1166147-ref.html
+
 # asserts(3) HTTP(..) fails 1108104.html 1108104-ref.html # bug 1067755, 1135556
 == 1321803-1a.html 1321803-1-ref.html