summaryrefslogtreecommitdiffstats
path: root/layout/reftests/printing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--layout/reftests/printing/print.css7
-rw-r--r--layout/reftests/printing/reftest.list20
-rw-r--r--layout/reftests/printing/test-async-print.html16
-rw-r--r--layout/reftests/printing/test-color-text-01.html9
-rw-r--r--layout/reftests/printing/test-missing-text-noref.html13
-rw-r--r--layout/reftests/printing/test-missing-text.html12
-rw-r--r--layout/reftests/printing/test-number-of-pages-noref.html13
-rw-r--r--layout/reftests/printing/test-number-of-pages.html12
-rw-r--r--layout/reftests/printing/test-print-range-complex-ref.html12
-rw-r--r--layout/reftests/printing/test-print-range-complex.html15
-rw-r--r--layout/reftests/printing/test-print-range-ref.html11
-rw-r--r--layout/reftests/printing/test-print-range.html13
-rw-r--r--layout/reftests/printing/test-print-selection-iframe.html20
-rw-r--r--layout/reftests/printing/test-print-selection-shadow-dom.html25
-rw-r--r--layout/reftests/printing/test-print-selection.html20
-rw-r--r--layout/reftests/printing/test-print-single-page-noref.html11
-rw-r--r--layout/reftests/printing/test-print-single-page.html13
-rw-r--r--layout/reftests/printing/test-text-noref.html10
-rw-r--r--layout/reftests/printing/test-text-ref.html10
-rw-r--r--layout/reftests/printing/test-text.html10
-rw-r--r--layout/reftests/printing/test-unexpected-text-noref.html12
-rw-r--r--layout/reftests/printing/test-unexpected-text.html13
22 files changed, 297 insertions, 0 deletions
diff --git a/layout/reftests/printing/print.css b/layout/reftests/printing/print.css
new file mode 100644
index 0000000000..62f475ea2b
--- /dev/null
+++ b/layout/reftests/printing/print.css
@@ -0,0 +1,7 @@
+@page {
+ margin: 0;
+}
+
+p {
+ page-break-after: always;
+}
diff --git a/layout/reftests/printing/reftest.list b/layout/reftests/printing/reftest.list
new file mode 100644
index 0000000000..145b5190d3
--- /dev/null
+++ b/layout/reftests/printing/reftest.list
@@ -0,0 +1,20 @@
+# Note: The 'print' tests below that are annotated as 'fails' are really just
+# testing the integrity of the reftest harness. Their testcases & reference
+# case are known to differ, and we're testing that the harness correctly
+# detects them as differing & correctly handles the 'fails' annotation.
+# Some of these tests are used as their own reference to confirm basic
+# text and page number matching works as expected.
+print test-text.html test-text.html
+fails print test-text.html test-text-noref.html
+print test-number-of-pages.html test-number-of-pages.html
+fails print test-number-of-pages.html test-number-of-pages-noref.html
+print test-print-selection.html test-text-ref.html
+print test-print-selection-shadow-dom.html test-text-ref.html
+print test-print-selection-iframe.html test-text-ref.html
+print test-print-range.html test-print-range-ref.html
+print test-print-range-complex.html test-print-range-complex-ref.html
+fails print test-print-single-page.html test-print-single-page-noref.html
+print test-async-print.html test-text-ref.html
+fails print test-unexpected-text.html test-unexpected-text-noref.html
+fails print test-missing-text.html test-missing-text-noref.html
+test-pref(print.print_in_color,false) fails print test-color-text-01.html test-color-text-01.html
diff --git a/layout/reftests/printing/test-async-print.html b/layout/reftests/printing/test-async-print.html
new file mode 100644
index 0000000000..b2ddec6449
--- /dev/null
+++ b/layout/reftests/printing/test-async-print.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+ <script>
+ window.addEventListener("MozReftestInvalidate", function() {
+ document.getElementById("page1").innerText = 'This text should appear on page 1';
+ document.documentElement.className = "";
+ });
+ </script>
+</head>
+<body>
+ <p id="page1"></p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-color-text-01.html b/layout/reftests/printing/test-color-text-01.html
new file mode 100644
index 0000000000..bb51f10fab
--- /dev/null
+++ b/layout/reftests/printing/test-color-text-01.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<style>
+@media (monochrome) {
+ p { display: none }
+}
+</style>
+<p style="color: red">
+ Red
+</p>
diff --git a/layout/reftests/printing/test-missing-text-noref.html b/layout/reftests/printing/test-missing-text-noref.html
new file mode 100644
index 0000000000..364ac7fabe
--- /dev/null
+++ b/layout/reftests/printing/test-missing-text-noref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>
+ <span>This text appears in both the testcase and non-reference case.</span>
+ <b>But this text ONLY appears in the non-reference.</b>
+ </p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-missing-text.html b/layout/reftests/printing/test-missing-text.html
new file mode 100644
index 0000000000..ba2ecf9c55
--- /dev/null
+++ b/layout/reftests/printing/test-missing-text.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>
+ <span>This text appears in both the testcase and non-reference case.</span>
+ </p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-number-of-pages-noref.html b/layout/reftests/printing/test-number-of-pages-noref.html
new file mode 100644
index 0000000000..b6aee19ccc
--- /dev/null
+++ b/layout/reftests/printing/test-number-of-pages-noref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should appear on page 3</p>
+ <p>There shouldn't be another page</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-number-of-pages.html b/layout/reftests/printing/test-number-of-pages.html
new file mode 100644
index 0000000000..27daa5988e
--- /dev/null
+++ b/layout/reftests/printing/test-number-of-pages.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should appear on page 3</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-range-complex-ref.html b/layout/reftests/printing/test-print-range-complex-ref.html
new file mode 100644
index 0000000000..27daa5988e
--- /dev/null
+++ b/layout/reftests/printing/test-print-range-complex-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should appear on page 3</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-range-complex.html b/layout/reftests/printing/test-print-range-complex.html
new file mode 100644
index 0000000000..6d829e6670
--- /dev/null
+++ b/layout/reftests/printing/test-print-range-complex.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html reftest-print-range="2-2,4-5">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should not be here</p>
+ <p>This text should appear on page 1</p>
+ <p>This text should not be here</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should appear on page 3</p>
+ <p>This text should not be here</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-range-ref.html b/layout/reftests/printing/test-print-range-ref.html
new file mode 100644
index 0000000000..fb0df54721
--- /dev/null
+++ b/layout/reftests/printing/test-print-range-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-range.html b/layout/reftests/printing/test-print-range.html
new file mode 100644
index 0000000000..7736db6da4
--- /dev/null
+++ b/layout/reftests/printing/test-print-range.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html reftest-print-range="2-3">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should not be here</p>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should not be here</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-selection-iframe.html b/layout/reftests/printing/test-print-selection-iframe.html
new file mode 100644
index 0000000000..b3d39c2c52
--- /dev/null
+++ b/layout/reftests/printing/test-print-selection-iframe.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html reftest-print-range="selection">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+ <script>
+ function selectNodeById(id) {
+ var node = document.getElementById(id);
+ var rng = document.createRange();
+ rng.selectNode(node);
+ window.getSelection().addRange(rng);
+ }
+ </script>
+</head>
+<body onload="selectNodeById('selection')">
+ <p>This text should not be there</p>
+ <p id="selection">This text should appear on page 1</p>
+ <iframe src="data:text/html,"></iframe>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-selection-shadow-dom.html b/layout/reftests/printing/test-print-selection-shadow-dom.html
new file mode 100644
index 0000000000..c268131994
--- /dev/null
+++ b/layout/reftests/printing/test-print-selection-shadow-dom.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html reftest-print-range="selection">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+ <script>
+ function selectNodesInShadowTree() {
+ let host = document.getElementById("host");
+ host.attachShadow({ mode: "open" }).innerHTML = `
+ <p>This text should not be there</p>
+ <p id="selection">This text should appear on page 1</p>
+ <p>This text should not be there</p>
+ `;
+ let rng = document.createRange();
+ rng.selectNode(host.shadowRoot.getElementById("selection"));
+ window.getSelection().addRange(rng);
+ }
+ </script>
+</head>
+<body onload="selectNodesInShadowTree()">
+ <p>This text should not be there</p>
+ <div id="host">Shouldn't show up (in the shadows)</div>
+ <p>This text should not be there</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-selection.html b/layout/reftests/printing/test-print-selection.html
new file mode 100644
index 0000000000..ee1b02d3e5
--- /dev/null
+++ b/layout/reftests/printing/test-print-selection.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html reftest-print-range="selection">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+ <script>
+ function selectNodeById(id) {
+ var node = document.getElementById(id);
+ var rng = document.createRange();
+ rng.selectNode(node);
+ window.getSelection().addRange(rng);
+ }
+ </script>
+</head>
+<body onload="selectNodeById('selection')">
+ <p>This text should not be there</p>
+ <p id="selection">This text should appear on page 1</p>
+ <p>This text should not be there</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-single-page-noref.html b/layout/reftests/printing/test-print-single-page-noref.html
new file mode 100644
index 0000000000..81edd9511c
--- /dev/null
+++ b/layout/reftests/printing/test-print-single-page-noref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+ <p>There shouldn't be another page</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-print-single-page.html b/layout/reftests/printing/test-print-single-page.html
new file mode 100644
index 0000000000..1eff0fbc27
--- /dev/null
+++ b/layout/reftests/printing/test-print-single-page.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html reftest-print-range="2-2">
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should not be here</p>
+ <p>This text should appear on page 1</p>
+ <p>This text should appear on page 2</p>
+ <p>This text should not be here</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-text-noref.html b/layout/reftests/printing/test-text-noref.html
new file mode 100644
index 0000000000..160310a5db
--- /dev/null
+++ b/layout/reftests/printing/test-text-noref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This is not the text you're looking for</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-text-ref.html b/layout/reftests/printing/test-text-ref.html
new file mode 100644
index 0000000000..bc93680640
--- /dev/null
+++ b/layout/reftests/printing/test-text-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-text.html b/layout/reftests/printing/test-text.html
new file mode 100644
index 0000000000..bc93680640
--- /dev/null
+++ b/layout/reftests/printing/test-text.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>This text should appear on page 1</p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-unexpected-text-noref.html b/layout/reftests/printing/test-unexpected-text-noref.html
new file mode 100644
index 0000000000..ba2ecf9c55
--- /dev/null
+++ b/layout/reftests/printing/test-unexpected-text-noref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>
+ <span>This text appears in both the testcase and non-reference case.</span>
+ </p>
+</body>
+</html>
diff --git a/layout/reftests/printing/test-unexpected-text.html b/layout/reftests/printing/test-unexpected-text.html
new file mode 100644
index 0000000000..8c705dd1bc
--- /dev/null
+++ b/layout/reftests/printing/test-unexpected-text.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link href="print.css" rel="stylesheet">
+</head>
+<body>
+ <p>
+ <span>This text appears in both the testcase and non-reference case.</span>
+ <b>But this text ONLY appears in the testcase.</b>
+ </p>
+</body>
+</html>