Add test case for a bunch of shading type 7 (and 6) corner cases.

See https://crbug.com/407070894#comment7 for details.

The white holes in the skia baselines related to issue 416702486.
With the diff in comment 1 there, they go away.

Bug: 407070894,416702486
Change-Id: I053c84ce0b040c6cef41081e00caf2c41334a83d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/131970
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/pixel/shade-tensor.in b/testing/resources/pixel/shade-tensor.in
new file mode 100644
index 0000000..5cb0d27
--- /dev/null
+++ b/testing/resources/pixel/shade-tensor.in
@@ -0,0 +1,423 @@
+{{header}}
+{{object 1 0}} <<
+  /Type /Catalog
+  /Pages 2 0 R
+>>
+endobj
+
+{{object 2 0}} <<
+  /Type /Pages
+  /Count 1
+  /Kids [3 0 R]
+>>
+endobj
+
+{{object 3 0}} <<
+  /Type /Page
+  /Parent 2 0 R
+  /MediaBox [0 0 200 500]
+  /Contents 4 0 R
+  /Resources <<
+    /Shading <<
+      /Sha 5 0 R
+      /Shb 6 0 R
+      /Shc 7 0 R
+      /Shd 8 0 R
+      /She 9 0 R
+      /Shf 10 0 R
+      /Shg 11 0 R
+      /Shh 12 0 R
+      /Shi 13 0 R
+      /Shj 14 0 R
+      /Shk 15 0 R
+      /Shl 16 0 R
+    >>
+  >>
+>>
+endobj
+
+{{object 4 0}} <<
+  {{streamlen}}
+>>
+stream
+
+q
+1 0 0 1 0 400 cm
+0 0 100 100 re W n
+/Sha sh
+Q
+
+q
+1 0 0 1 100 400 cm
+0 0 100 100 re W n
+/Shb sh
+Q
+
+q
+1 0 0 1 0 300 cm
+0 0 100 100 re W n
+/Shc sh
+Q
+
+q
+1 0 0 1 100 300 cm
+0 0 100 100 re W n
+/Shd sh
+Q
+
+q
+1 0 0 1 0 200 cm
+0 0 100 100 re W n
+/She sh
+Q
+
+q
+1 0 0 1 100 200 cm
+0 0 100 100 re W n
+/Shf sh
+Q
+
+q
+1 0 0 1 0 100 cm
+0 0 100 100 re W n
+/Shg sh
+Q
+
+q
+1 0 0 1 100 100 cm
+0 0 100 100 re W n
+/Shh sh
+Q
+
+q
+1 0 0 1 0 0 cm
+0 0 100 100 re W n
+/Shi sh
+Q
+
+q
+1 0 0 1 80 30 cm
+0 0 100 100 re W n
+/Shj sh
+Q
+q
+1 0 0 1 120 30 cm
+0 0 100 100 re W n
+/Shk sh
+Q
+q
+1 0 0 1 100 -20 cm
+0 0 100 100 re W n
+/Shl sh
+Q
+
+endstream
+endobj
+
+{{object 5 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 100 0 100 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+           0ccd 0ccd  0219 8058
+1500 80ff  2800 d72a  a000 f0a7
+90f3 e20c  cdf2 f300  ff09 58d5
+c7ff 90ff  ffa7 2a58  2f00 4332
+f332 0dfe
+0000 f000  f000 f000  f000 0000  0000 0000
+ff00ff
+00ffff
+80ff00
+ffff00
+>
+endstream
+endobj
+
+{{object 6 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 100 0 100 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+           0ccd 0ccd  0219 8058
+1500 80ff  2800 d72a  a000 f0a7
+90f3 e20c  cdf2 f300  ff09 58d5
+c7ff 90ff  ffa7 2a58  2f00 4332
+f332 0dfe
+0000 f000  f000 f000  f000 0000  0000 0000
+80ff00
+80ff00
+80ff00
+80ff00
+>
+endstream
+endobj
+
+{{object 7 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+012C 0128  0096 015E
+0096 00FA  012E 0127
+00FA 0096  015E 0096
+012F 0126  01C2 00FA
+01C2 015E  01C2 01C2
+015E 01C2  00FA 01C2
+0010 0253  015E 015E
+024B 0004  0244 024C
+
+64 96 FF  FF 78 78  FF FF 64  64 DC 64
+>
+endstream
+endobj
+
+{{object 8 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+012C 0128  0096 015E
+0096 00FA  012E 0127
+00FA 0096  015E 0096
+012F 0126  01C2 00FA
+01C2 015E  01C2 01C2
+015E 01C2  00FA 01C2
+0010 0253  015E 015E
+024B 0004  0244 024C
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{object 9 0}} <<
+  /ShadingType 6
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+0096 0096  0249 0004
+000F 0007  01C2 0096
+0246 0242  024C 0009
+01C2 01C2  0010 0251
+024F 024B  0096 01C2
+000C 0005  0010 0253
+
+64 96 FF  FF 78 78  FF FF 64  64 DC 64
+>
+endstream
+endobj
+
+{{object 10 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+0096 01C2  000C 0005
+0010 0253  0096 0096
+0249 0004  000F 0007
+01C2 0096  0246 0242
+024C 0009  01C2 01C2
+0010 0251  024F 024B
+0230 0025  022F 0019
+0231 001A  022A 0025
+
+64 96 FF  FF 78 78  FF FF 64  64 DC 64
+>
+endstream
+endobj
+
+{{object 11 0}} <<
+  /ShadingType 6
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+0096 0096  0249 0004
+000F 0007  01C2 0096
+0246 0242  024C 0009
+01C2 01C2  0010 0251
+024F 024B  0096 01C2
+000C 0005  0010 0253
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{object 12 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+0096 01C2  000C 0005
+0010 0253  0096 0096
+0249 0004  000F 0007
+01C2 0096  0246 0242
+024C 0009  01C2 01C2
+0010 0251  024F 024B
+0230 0025  022F 0019
+0231 001A  022A 0025
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{object 13 0}} <<
+  /ShadingType 7
+  /ColorSpace /DeviceCMYK
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 100 0 100 0 1 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+           0ccd 0ccd  0219 8058
+1500 80ff  2800 d72a  a000 f0a7
+90f3 e20c  cdf2 f300  ff09 58d5
+c7ff 90ff  ffa7 2a58  2f00 4332
+f332 0dfe
+0000 f000  f000 f000  f000 0000  0000 0000
+
+ff00ff00
+00ff0000
+00ff0000
+ff00ff00
+>
+endstream
+endobj
+
+{{object 14 0}} <<
+  /ShadingType 6
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+0129 012C  00FA 0096
+015E 0096  0129 012C
+01C2 00FA  01C2 015E
+0128 012C  015E 01C2
+00FA 01C2  0128 012B
+0096 015E  0096 00FA
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{object 15 0}} <<
+  /ShadingType 6
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+015A 0158  00FA 0096
+015E 0096  0100 0157
+01C2 00FA  01C2 015E
+0100 00FC  015E 01C2
+00FA 01C2  0159 00FB
+0096 015E  0096 00FA
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{object 16 0}} <<
+  /ShadingType 6
+  /ColorSpace /DeviceRGB
+  /BitsPerCoordinate 16
+  /BitsPerComponent 8
+  /BitsPerFlag 8
+  /Decode [0 10000 0 10000 0 1 0 1 0 1]
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00
+012C 0128  0096 015E
+0096 00FA  012E 0127
+00FA 0096  015E 0096
+012F 0126  01C2 00FA
+01C2 015E  01C2 01C2
+015E 01C2  00FA 01C2
+
+80ff00 80ff00 80ff00 80ff00
+>
+endstream
+endobj
+
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/shade-tensor_expected.pdf.0.png b/testing/resources/pixel/shade-tensor_expected.pdf.0.png
new file mode 100644
index 0000000..5dcd241
--- /dev/null
+++ b/testing/resources/pixel/shade-tensor_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/shade-tensor_expected_gdi_skia.pdf.0.png b/testing/resources/pixel/shade-tensor_expected_gdi_skia.pdf.0.png
new file mode 100644
index 0000000..52e17a8
--- /dev/null
+++ b/testing/resources/pixel/shade-tensor_expected_gdi_skia.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/shade-tensor_expected_skia.pdf.0.png b/testing/resources/pixel/shade-tensor_expected_skia.pdf.0.png
new file mode 100644
index 0000000..e41dc79
--- /dev/null
+++ b/testing/resources/pixel/shade-tensor_expected_skia.pdf.0.png
Binary files differ