diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-03-19 21:21:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-19 21:21:46 +0000 |
commit | 20830920ca028f551dcdb54e5170317d61254419 (patch) | |
tree | 61900617f099bf079ee7a569a9e4938e0b16efe1 | |
parent | ef44194f4f4c71b6e1bbaecb5ffff503d780766c (diff) | |
download | pdfium-20830920ca028f551dcdb54e5170317d61254419.tar.xz |
Add more options to combobox_form.pdf resource.
This causes a scrollbar to appear. We need a test case that contains
an AcroForm combobox with a popup that is large enough to create a
scrollbar.
Bug: chromium:823378, chromium:820278
Change-Id: I6e93bda5b938f9f7c08ceeef7989794ea7764532
Reviewed-on: https://pdfium-review.googlesource.com/28750
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | fpdfsdk/fpdfannot_embeddertest.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/fpdfformfill_embeddertest.cpp | 15 | ||||
-rw-r--r-- | testing/resources/combobox_form.in | 15 | ||||
-rw-r--r-- | testing/resources/combobox_form.pdf | 21 |
4 files changed, 33 insertions, 24 deletions
diff --git a/fpdfsdk/fpdfannot_embeddertest.cpp b/fpdfsdk/fpdfannot_embeddertest.cpp index 4e32b19ff9..61cd2aae3d 100644 --- a/fpdfsdk/fpdfannot_embeddertest.cpp +++ b/fpdfsdk/fpdfannot_embeddertest.cpp @@ -1384,7 +1384,7 @@ TEST_F(FPDFAnnotEmbeddertest, GetFormAnnotAndCheckFlagsComboBox) { { // Retrieve user-editable combobox annotation. std::unique_ptr<void, FPDFAnnotationDeleter> annot( - FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 63)); + FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 363)); ASSERT_TRUE(annot); // Check that interactive form annotation flag values are as expected. @@ -1397,7 +1397,7 @@ TEST_F(FPDFAnnotEmbeddertest, GetFormAnnotAndCheckFlagsComboBox) { { // Retrieve regular combobox annotation. std::unique_ptr<void, FPDFAnnotationDeleter> annot( - FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 113)); + FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 413)); ASSERT_TRUE(annot); // Check that interactive form annotation flag values are as expected. @@ -1410,7 +1410,7 @@ TEST_F(FPDFAnnotEmbeddertest, GetFormAnnotAndCheckFlagsComboBox) { { // Retrieve read-only combobox annotation. std::unique_ptr<void, FPDFAnnotationDeleter> annot( - FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 213)); + FPDFAnnot_GetFormFieldAtPoint(form_handle(), page, 102, 513)); ASSERT_TRUE(annot); // Check that interactive form annotation flag values are as expected. diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp index 8b81467822..709bc39bfa 100644 --- a/fpdfsdk/fpdfformfill_embeddertest.cpp +++ b/fpdfsdk/fpdfformfill_embeddertest.cpp @@ -224,10 +224,14 @@ class FPDFFormFillComboBoxFormEmbeddertest } void SelectEditableFormOption(int item_index) { + ASSERT(item_index >= 0); + ASSERT(item_index < 3); SelectOption(item_index, EditableFormDropDown()); } void SelectNonEditableFormOption(int item_index) { + ASSERT(item_index >= 0); + ASSERT(item_index < 26); SelectOption(item_index, NonEditableFormDropDown()); } @@ -281,10 +285,6 @@ class FPDFFormFillComboBoxFormEmbeddertest // Selects one of the pre-selected values from a combobox with three options. // Options are specified by |item_index|, which is 0-based. void SelectOption(int item_index, const CFX_PointF& point) { - // Only relevant for comboboxes with three choices and the same dimensions - // as those in combobox_form.pdf. - ASSERT(item_index >= 0); - ASSERT(item_index < 3); // Navigate to button for drop down and click mouse to reveal options. ClickOnFormFieldAtPoint(point); @@ -294,6 +294,9 @@ class FPDFFormFillComboBoxFormEmbeddertest CFX_PointF option_point = point; option_point.y -= kChoiceHeight * (item_index + 1); + // Move left to avoid scrollbar. + option_point.x -= 20; + // Navigate to option and click mouse to select it. ClickOnFormFieldAtPoint(option_point); } @@ -301,8 +304,8 @@ class FPDFFormFillComboBoxFormEmbeddertest static constexpr float kFormBeginX = 102.0; static constexpr float kFormEndX = 183.0; static constexpr float kFormDropDownX = 192.0; - static constexpr float kEditableFormY = 60.0; - static constexpr float kNonEditableFormY = 110.0; + static constexpr float kEditableFormY = 360.0; + static constexpr float kNonEditableFormY = 410.0; }; TEST_F(FPDFFormFillEmbeddertest, FirstTest) { diff --git a/testing/resources/combobox_form.in b/testing/resources/combobox_form.in index 77085f2861..4d243b0fa6 100644 --- a/testing/resources/combobox_form.in +++ b/testing/resources/combobox_form.in @@ -14,7 +14,7 @@ endobj /Type /Page /Parent 2 0 R /Resources 4 0 R - /MediaBox [ 0 0 300 300 ] + /MediaBox [ 0 0 300 600 ] /Contents 7 0 R /Annots [ 8 0 R 9 0 R 10 0 R ] >> @@ -38,7 +38,7 @@ stream BT 0 0 0 rg /F1 12 Tf -100 150 Td +100 450 Td (Test Form) Tj ET endstream @@ -50,7 +50,7 @@ endobj /Ff 393216 /T (Combo_Editable) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 50 200 80 ] + /Rect [ 100 350 200 380 ] /Subtype /Widget /Opt [[(foo) (Foo)] [(bar) (Bar)] [(qux) (Qux)]] >> @@ -62,9 +62,12 @@ endobj /Ff 131072 /T (Combo1) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 100 200 130 ] + /Rect [ 100 400 200 430 ] /Subtype /Widget - /Opt [(Apple) (Banana) (Cherry)] + /Opt [(Apple) (Banana) (Cherry) (Date) (Elderberry) (Fig) (Guava) (Honeydew) + (Indian Fig) (Jackfruit) (Kiwi) (Lemon) (Mango) (Nectarine) (Orange) + (Persimmon) (Quince) (Raspberry) (Strawberry) (Tamarind) (Ugli Fruit) + (Voavanga) (Wolfberry) (Xigua) (Yangmei) (Zucchini)] /V (Banana) >> endobj @@ -75,7 +78,7 @@ endobj /Ff 131073 /T (Combo_ReadOnly) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 200 200 230 ] + /Rect [ 100 500 200 530 ] /Subtype /Widget /Opt [(Dog) (Elephant) (Frog)] >> diff --git a/testing/resources/combobox_form.pdf b/testing/resources/combobox_form.pdf index 5249276b62..1f0e895643 100644 --- a/testing/resources/combobox_form.pdf +++ b/testing/resources/combobox_form.pdf @@ -15,7 +15,7 @@ endobj /Type /Page /Parent 2 0 R /Resources 4 0 R - /MediaBox [ 0 0 300 300 ] + /MediaBox [ 0 0 300 600 ] /Contents 7 0 R /Annots [ 8 0 R 9 0 R 10 0 R ] >> @@ -39,7 +39,7 @@ stream BT 0 0 0 rg /F1 12 Tf -100 150 Td +100 450 Td (Test Form) Tj ET endstream @@ -51,7 +51,7 @@ endobj /Ff 393216 /T (Combo_Editable) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 50 200 80 ] + /Rect [ 100 350 200 380 ] /Subtype /Widget /Opt [[(foo) (Foo)] [(bar) (Bar)] [(qux) (Qux)]] >> @@ -63,9 +63,12 @@ endobj /Ff 131072 /T (Combo1) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 100 200 130 ] + /Rect [ 100 400 200 430 ] /Subtype /Widget - /Opt [(Apple) (Banana) (Cherry)] + /Opt [(Apple) (Banana) (Cherry) (Date) (Elderberry) (Fig) (Guava) (Honeydew) + (Indian Fig) (Jackfruit) (Kiwi) (Lemon) (Mango) (Nectarine) (Orange) + (Persimmon) (Quince) (Raspberry) (Strawberry) (Tamarind) (Ugli Fruit) + (Voavanga) (Wolfberry) (Xigua) (Yangmei) (Zucchini)] /V (Banana) >> endobj @@ -76,7 +79,7 @@ endobj /Ff 131073 /T (Combo_ReadOnly) /DA (0 0 0 rg /F1 12 Tf) - /Rect [ 100 200 200 230 ] + /Rect [ 100 500 200 530 ] /Subtype /Widget /Opt [(Dog) (Elephant) (Frog)] >> @@ -92,9 +95,9 @@ xref 0000000399 00000 n 0000000475 00000 n 0000000575 00000 n -0000000779 00000 n -0000000975 00000 n +0000000781 00000 n +0000001237 00000 n trailer<< /Root 1 0 R /Size 11 >> startxref -1164 +1426 %%EOF |