Add a pixel test for dashed lines
Add testing/resources/pixel/dashed_lines.in which is partially derived
from testing/resources/dashed_lines.in. It includes more dash patterns
to cover:
1) Negative values.
2) The examples from PDF specs.
This test also demonstrates PDFium:
a) Does not render the additional line dash examples from
ISO 32000-2:2020 correctly.
b) Renders incorrectly at 1X scale with the GDI renderer.
Bug: 370299908, 370546365, 370543469
Change-Id: I7ff4739e356e0ec76d19fa87755962bc6f8134c2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/124797
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/testing/resources/pixel/dashed_lines.in b/testing/resources/pixel/dashed_lines.in
new file mode 100644
index 0000000..cc4b31a
--- /dev/null
+++ b/testing/resources/pixel/dashed_lines.in
@@ -0,0 +1,97 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [0 0 200 150]
+ /Count 1
+ /Kids [3 0 R]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Contents 4 0 R
+>>
+endobj
+{{object 4 0}} <<
+ {{streamlen}}
+>>
+stream
+q
+0 g
+0 G
+
+% Draw all the lines on the LHS first with 4X width.
+q
+4 w
+
+% Solid line.
+10 140 m 90 140 l S
+
+% Random values.
+[6 5 4 3 2 1] 5 d
+10 130 m 90 130 l S
+
+% Negative value.
+[6 5 -4 3 2 1] 5 d
+10 120 m 90 120 l S
+
+% Examples from ISO 32000-1:2008, table 56.
+[] 0 d
+10 80 m 90 80 l S
+[3] 0 d
+10 70 m 90 70 l S
+[2] 1 d
+10 60 m 90 60 l S
+[2 1] 0 d
+10 50 m 90 50 l S
+[3 5] 6 d
+10 40 m 90 40 l S
+[2 3] 11 d
+10 30 m 90 30 l S
+
+% Additional examples from ISO 32000-2:2020, table 55.
+[2 1 3] 0 d
+10 20 m 90 20 l S
+[2 1 3] -2 d
+10 10 m 90 10 l S
+Q
+
+% Draw all the lines again on the RHS at 4X scale.
+q
+4 0 0 4 0 0 cm
+27.5 35 m 47.5 35 l S
+[6 5 4 3 2 1] 5 d
+27.5 32.5 m 47.5 32.5 l S
+[6 5 -4 3 2 1] 5 d
+27.5 30 m 47.5 30 l S
+
+[] 0 d
+27.5 20 m 47.5 20 l S
+[3] 0 d
+27.5 17.5 m 47.5 17.5 l S
+[2] 1 d
+27.5 15 m 47.5 15 l S
+[2 1] 0 d
+27.5 12.5 m 47.5 12.5 l S
+[3 5] 6 d
+27.5 10 m 47.5 10 l S
+[2 3] 11 d
+27.5 7.5 m 47.5 7.5 l S
+[2 1 3] 0 d
+27.5 5 m 47.5 5 l S
+[2 1 3] -2 d
+27.5 2.5 m 47.5 2.4 l S
+Q
+
+Q
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/dashed_lines_expected.pdf.0.png b/testing/resources/pixel/dashed_lines_expected.pdf.0.png
new file mode 100644
index 0000000..81a4356
--- /dev/null
+++ b/testing/resources/pixel/dashed_lines_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/dashed_lines_expected_gdi.pdf.0.png b/testing/resources/pixel/dashed_lines_expected_gdi.pdf.0.png
new file mode 100644
index 0000000..e159270
--- /dev/null
+++ b/testing/resources/pixel/dashed_lines_expected_gdi.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/dashed_lines_expected_skia.pdf.0.png b/testing/resources/pixel/dashed_lines_expected_skia.pdf.0.png
new file mode 100644
index 0000000..1fc9c4d
--- /dev/null
+++ b/testing/resources/pixel/dashed_lines_expected_skia.pdf.0.png
Binary files differ