Add a test for rendering image object with the correct color space.
Add a pixel test based on the attachments in crbug.com/pdfium/1723
which represents the issue that PDFium should not render the PDF with
the color space in /Resource dictionary instead of the the color space
specified in the image object.
Once the bug is fixed, the rendering result should match the expectation.
Bug: pdfium:1723
Change-Id: I2564a504c00afb3efc7fbb297db7e35382b201ca
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92090
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index b35007b..6911d35 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -353,6 +353,9 @@
# TODO(pdfium:1571): Remove after associated bug is fixed
bug_1571.in * * * *
+# TODO(pdfium:1723): Remove after associated bug is fixed
+bug_1723.in * * * *
+
# TODO(pdfium:1746): Remove after associated bug is fixed
bug_1746.in * * * skia
diff --git a/testing/resources/pixel/bug_1723.in b/testing/resources/pixel/bug_1723.in
new file mode 100644
index 0000000..aac04d2
--- /dev/null
+++ b/testing/resources/pixel/bug_1723.in
@@ -0,0 +1,61 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 1
+ /Kids [3 0 R]
+ /MediaBox [0 0 300 400]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Contents [4 0 R]
+ /Resources <<
+ /ColorSpace <<
+ /DefaultCMYK /DeviceRGB
+ >>
+ /XObject <<
+ /Img 5 0 R
+ >>
+ >>
+>>
+endobj
+{{object 4 0}} <<
+ {{streamlen}}
+>>
+stream
+200 0 0 300 50 50 cm
+/Img Do
+endstream
+endobj
+{{object 5 0}} <<
+ /Type /XObject
+ /Subtype /Image
+ /BitsPerComponent 8
+ /ColorSpace /DeviceCMYK
+ /Filter /ASCIIHexDecode
+ /Height 8
+ /Width 8
+ {{streamlen}}
+>>
+stream
+FF000000 FF000000 FF000000 FF000000 00FF0000 00FF0000 00FF0000 00FF0000
+FF000000 FF000000 FF000000 FF000000 00FF0000 00FF0000 00FF0000 00FF0000
+FF000000 FF000000 FF000000 FF000000 00FF0000 00FF0000 00FF0000 00FF0000
+FF000000 FF000000 FF000000 FF000000 00FF0000 00FF0000 00FF0000 00FF0000
+
+0000FF00 0000FF00 0000FF00 0000FF00 000000FF 000000FF 000000FF 000000FF
+0000FF00 0000FF00 0000FF00 0000FF00 000000FF 000000FF 000000FF 000000FF
+0000FF00 0000FF00 0000FF00 0000FF00 000000FF 000000FF 000000FF 000000FF
+0000FF00 0000FF00 0000FF00 0000FF00 000000FF 000000FF 000000FF 000000FF
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1723_expected.pdf.0.png b/testing/resources/pixel/bug_1723_expected.pdf.0.png
new file mode 100644
index 0000000..46dceb7
--- /dev/null
+++ b/testing/resources/pixel/bug_1723_expected.pdf.0.png
Binary files differ