Add multiple select to field.fragment.
Use it to test {get,set}_current_value_indices().
Change-Id: Icc3493d210801a928371fcf06e30f907d12b80ac
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52732
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/javascript/field.fragment b/testing/resources/javascript/field.fragment
index 7aed37f..f1b0fd9 100644
--- a/testing/resources/javascript/field.fragment
+++ b/testing/resources/javascript/field.fragment
@@ -2,7 +2,7 @@
/Type /Catalog
/Pages 2 0 R
/AcroForm 4 0 R
- /OpenAction 10 0 R
+ /OpenAction 15 0 R
>>
endobj
{{object 2 0}} <<
@@ -24,6 +24,7 @@
7 0 R
8 0 R
9 0 R
+ 10 0 R
]
>>
endobj
@@ -43,6 +44,7 @@
7 0 R
8 0 R
9 0 R
+ 10 0 R
]
>>
endobj
@@ -85,8 +87,20 @@
/Rect [260 260 280 280]
>>
endobj
-% OpenAction action
{{object 10 0}} <<
+ /FT /Ch
+ /Ff 2097152
+ /Parent 5 0 R
+ /T (MyMultiSelect)
+ /Type /Annot
+ /Subtype /Widget
+ /Rect [ 280 280 300 300 ]
+ /Opt [ (foo) (bar) (qux) ]
+ /V (qux)
+>>
+
+% OpenAction action
+{{object 15 0}} <<
/Type /Action
/S /JavaScript
/JS 16 0 R
diff --git a/testing/resources/javascript/field_methods_expected.txt b/testing/resources/javascript/field_methods_expected.txt
index ca41d7f..1183012 100644
--- a/testing/resources/javascript/field_methods_expected.txt
+++ b/testing/resources/javascript/field_methods_expected.txt
@@ -1,8 +1,9 @@
Alert: field is MyField
Alert: button is MyField.MyPushButton
Alert: nonesuch is undefined
-Alert: found 4 sub-fields:
+Alert: found 5 sub-fields:
Alert: MyField.MyCheckBox
+Alert: MyField.MyMultiSelect
Alert: MyField.MyPushButton
Alert: MyField.MyRadio
Alert: MyField.MyText
diff --git a/testing/resources/javascript/field_properties.in b/testing/resources/javascript/field_properties.in
index 9999dd7..5ba47ec 100644
--- a/testing/resources/javascript/field_properties.in
+++ b/testing/resources/javascript/field_properties.in
@@ -13,6 +13,7 @@
var text = this.getField("MyField.MyText");
var button = this.getField("MyField.MyPushButton");
var radio = this.getField("MyField.MyRadio");
+ var list = this.getField("MyField.MyMultiSelect");
var check = this.getField("MyField.MyCheckBox");
app.alert('Testing properties under delay');
testRWProperty(field, "delay", false, true);
@@ -24,6 +25,7 @@
testPushButtonPropertiesCase(button);
testRadioButtonPropertiesCase(radio);
testCheckBoxPropertiesCase(check);
+ testListBoxPropertiesCase(list);
} catch (e) {
app.alert("Unexpected error: " + e);
}
@@ -118,6 +120,14 @@
}
}
+function testListBoxPropertiesCase(field) {
+ try {
+ testRWProperty(field, "currentValueIndices", 2, 1);
+ } catch (e) {
+ app.alert("Unexpected error: " + e);
+ }
+}
+
testProperties();
endstream
endobj
diff --git a/testing/resources/javascript/field_properties_expected.txt b/testing/resources/javascript/field_properties_expected.txt
index 3e06195..104e437 100644
--- a/testing/resources/javascript/field_properties_expected.txt
+++ b/testing/resources/javascript/field_properties_expected.txt
@@ -108,3 +108,5 @@
Alert: PASS: value = Off
Alert: PASS: valueAsString = Off
Alert: PASS: valueAsString threw Field.valueAsString: Operation not supported.
+Alert: PASS: currentValueIndices = 2
+Alert: PASS: currentValueIndices = 1