Consolidate common code in checkbox_radiobutton tests
Change-Id: I46379e8b6103f339bd71ef6aeffec9048612e127
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/93372
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/pixel/checkbox_radiobutton.fragment b/testing/resources/pixel/checkbox_radiobutton.fragment
new file mode 100644
index 0000000..013992e
--- /dev/null
+++ b/testing/resources/pixel/checkbox_radiobutton.fragment
@@ -0,0 +1,187 @@
+{{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
diff --git a/testing/resources/pixel/checkbox_radiobutton.in b/testing/resources/pixel/checkbox_radiobutton.in
index 59d73a2..116c638 100644
--- a/testing/resources/pixel/checkbox_radiobutton.in
+++ b/testing/resources/pixel/checkbox_radiobutton.in
@@ -7,192 +7,7 @@
>>
>>
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
- /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
+{{include checkbox_radiobutton.fragment}}
{{xref}}
{{trailer}}
{{startxref}}
diff --git a/testing/resources/pixel/checkbox_radiobutton_hide.in b/testing/resources/pixel/checkbox_radiobutton_hide.in
index 2216d25..340b6d5 100644
--- a/testing/resources/pixel/checkbox_radiobutton_hide.in
+++ b/testing/resources/pixel/checkbox_radiobutton_hide.in
@@ -8,193 +8,7 @@
/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
+{{include checkbox_radiobutton.fragment}}
% Make some buttons be hidden. Note that /T as an array of dict references
% does not seem to work as expected.
{{object 13 0}} <<
diff --git a/testing/resources/pixel/checkbox_radiobutton_reset.in b/testing/resources/pixel/checkbox_radiobutton_reset.in
index 4154ef2..869107a 100644
--- a/testing/resources/pixel/checkbox_radiobutton_reset.in
+++ b/testing/resources/pixel/checkbox_radiobutton_reset.in
@@ -8,193 +8,7 @@
/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
+{{include checkbox_radiobutton.fragment}}
% Make some buttons be reset. Note that /T as an array of dict references
% does not seem to work as expected. /Flags 1 means all fields *except*
% those listed.