Add test case for /Hide actions
Test can be run now that OpenActions are present for non-js
Change-Id: Ib5b93ccd6facd4a59180e8ee5626797cdd6cede8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93312
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/pixel/checkbox_radiobutton_hide.in b/testing/resources/pixel/checkbox_radiobutton_hide.in
new file mode 100644
index 0000000..2216d25
--- /dev/null
+++ b/testing/resources/pixel/checkbox_radiobutton_hide.in
@@ -0,0 +1,209 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /AcroForm <<
+ /Fields [5 0 R 6 0 R 7 0 R 9 0 R]
+ >>
+ /OpenAction 13 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 300 300]
+ /Contents 4 0 R
+ /Annots [5 0 R 6 0 R 8 0 R 10 0 R]
+>>
+endobj
+{{object 4 0}} <<
+ {{streamlen}}
+>>
+stream
+q
+q
+1 w
+1 0 1 RG
+1 .752941 .796078 rg
+n 135.5 250.5 19 19 re B*
+Q
+q
+2 w
+.1 .1 .1 RG
+.8 .843 1 rg
+n 136 211 18 18 re B*
+Q
+q
+2 w
+0 .501961 0 RG
+0 0 1 rg
+n
+104 110 m
+104 114.9706 99.97056 119 95 119 c
+90.02944 119 86 114.9706 86 110 c
+86 105.0294 90.02944 101 95 101 c
+99.97056 101 104 105.0294 104 110 c
+B*
+Q
+q
+2 w
+0 .501961 0 RG
+0 0 1 rg
+n
+104 60 m
+104 64.97056 99.97056 69 95 69 c
+90.02944 69 86 64.97056 86 60 c
+86 55.02944 90.02944 51 95 51 c
+99.97056 51 104 55.02944 104 60 c
+B*
+Q
+Q
+endstream
+endobj
+{{object 5 0}} <<
+ /Type /Annot
+ /Subtype /Widget
+ /FT /Btn
+ /Ff 1
+ /Rect [135 250 155 270]
+ /T (readOnlyCheckbox)
+ /AP <<
+ /N <<
+ /Yes 11 0 R
+ >>
+ >>
+ /AS /Off
+>>
+endobj
+{{object 6 0}} <<
+ /Type /Annot
+ /Subtype /Widget
+ /FT /Btn
+ /Ff 2
+ /Rect [135 210 155 230]
+ /T (checkbox)
+ /AP <<
+ /N <<
+ /Yes 11 0 R
+ >>
+ >>
+ /AS /Off
+>>
+endobj
+{{object 7 0}} <<
+ /FT /Btn
+ /Ff 49153
+ /T (readOnlyRadioButton)
+ /Kids [8 0 R]
+>>
+endobj
+{{object 8 0}} <<
+ /Type /Annot
+ /Subtype /Widget
+ /T (Widget8)
+ /FT /Btn
+ /Parent 7 0 R
+ /Rect [85 100 105 120]
+ /AP <<
+ /N <<
+ /value1 12 0 R
+ >>
+ >>
+ /AS /Off
+>>
+endobj
+{{object 9 0}} <<
+ /FT /Btn
+ /Ff 49154
+ /T (radioButton)
+ /Kids [10 0 R]
+>>
+endobj
+{{object 10 0}} <<
+ /Type /Annot
+ /Subtype /Widget
+ /FT /Btn
+ /Parent 9 0 R
+ /Rect [85 50 105 70]
+ /AP <<
+ /N <<
+ /value1 12 0 R
+ >>
+ >>
+ /AS /Off
+>>
+endobj
+{{object 11 0}} <<
+ /Type /XObject
+ /Subtype /Form
+ /FormType 1
+ /BBox [0 0 20 20]
+ {{streamlen}}
+>>
+stream
+q
+.1 .1 .1 rg .1 .1 .1 RG
+17.2 15.95145 m
+11.20694 10 l
+17.2 4.027746 l
+15.97225 2.8 l
+10 8.793064 l
+4.027746 2.8 l
+2.8 4.027746 l
+8.813873 10 l
+2.8 15.97225 l
+4.027746 17.2 l
+10 11.20694 l
+15.97225 17.2 l
+17.2 15.95145 l
+h
+f
+Q
+endstream
+endobj
+{{object 12 0}} <<
+ /Type /XObject
+ /Subtype /Form
+ /FormType 1
+ /BBox [0 0 20 20]
+ {{streamlen}}
+>>
+stream
+q
+1 .752941 .796078 rg 1 .752941 .796078 RG
+17.2 15.95145 m
+11.20694 10 l
+17.2 4.027746 l
+15.97225 2.8 l
+10 8.793064 l
+4.027746 2.8 l
+2.8 4.027746 l
+8.813873 10 l
+2.8 15.97225 l
+4.027746 17.2 l
+10 11.20694 l
+15.97225 17.2 l
+17.2 15.95145 l
+h
+f
+Q
+endstream
+endobj
+% Make some buttons be hidden. Note that /T as an array of dict references
+% does not seem to work as expected.
+{{object 13 0}} <<
+ /Type /Action
+ /S /Hide
+ /T [(readOnlyRadioButton.Widget8) (readOnlyCheckbox)]
+>>
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/checkbox_radiobutton_hide_expected.pdf.0.png b/testing/resources/pixel/checkbox_radiobutton_hide_expected.pdf.0.png
new file mode 100644
index 0000000..361c05f
--- /dev/null
+++ b/testing/resources/pixel/checkbox_radiobutton_hide_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/checkbox_radiobutton_hide_expected_skia.pdf.0.png b/testing/resources/pixel/checkbox_radiobutton_hide_expected_skia.pdf.0.png
new file mode 100644
index 0000000..bdb2d6e
--- /dev/null
+++ b/testing/resources/pixel/checkbox_radiobutton_hide_expected_skia.pdf.0.png
Binary files differ