Add basic JavaScript test for XFA exclgroup methods.
Cover the entry points and argument validation at a minimum.
Change-Id: Ib66acc23ae03ea2e36cacfdb55323812605cfe69
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68410
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_exclgroup.in b/testing/resources/javascript/xfa_specific/xfa_exclgroup.in
new file mode 100644
index 0000000..d63b4df
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_exclgroup.in
@@ -0,0 +1,71 @@
+{{header}}
+{{include ../../xfa_catalog_1_0.fragment}}
+{{include ../../xfa_object_2_0.fragment}}
+{{include ../../xfa_preamble_3_0.fragment}}
+{{include ../../xfa_config_4_0.fragment}}
+{{object 5 0}} <<
+ {{streamlen}}
+>>
+stream
+<template>
+ <subform layout="tb">
+ <exclGroup name="RadioButtonList" layout="lr-tb">
+ <field w="30mm" h="6mm" name="yes">
+ <ui>
+ <checkButton shape="round">
+ </checkButton>
+ </ui>
+ <items>
+ <text>Agree</text>
+ </items>
+ </field>
+ <field w="30mm" h="6mm" name="no">
+ <ui>
+ <checkButton shape="round">
+ </checkButton>
+ </ui>
+ <items>
+ <text>Disagree</text>
+ </items>
+ </field>
+ <validate nullTest="error"/>
+ </exclGroup>
+ <event activity="initialize">
+ <script contentType="application/x-javascript"><![CDATA[
+ {{include ../expect.js}}
+ expect("RadioButtonList.className", "exclGroup");
+
+ expectError("RadioButtonList.execEvent()");
+ expectError("RadioButtonList.execEvent(1, 2)");
+ expect("RadioButtonList.execEvent('nonesuch')", null);
+ expect("RadioButtonList.execEvent('initialize')", null);
+
+ expectError("RadioButtonList.execInitialize('badarg')");
+ expect("RadioButtonList.execInitialize()", null);
+
+ expectError("RadioButtonList.execCalculate('badarg')");
+ expect("RadioButtonList.execCalculate()", null);
+
+ expectError("RadioButtonList.execValidate('badarg')");
+ expect("RadioButtonList.execValidate()", true);
+
+ expectError("RadioButtonList.selectedMember('badarg')");
+ expect("RadioButtonList.selectedMember()", null);
+
+ expect("RadioButtonList.defaultValue", undefined);
+ expect("RadioButtonList.rawValue", null);
+ expect("RadioButtonList.transient", undefined);
+ expect("RadioButtonList.errorText", undefined);
+ ]]></script>
+ </event>
+ </subform>
+</template>
+endstream
+endobj
+{{include ../../xfa_locale_6_0.fragment}}
+{{include ../../xfa_postamble_7_0.fragment}}
+{{include ../../xfa_pages_8_0.fragment}}
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/javascript/xfa_specific/xfa_exclgroup_expected.txt b/testing/resources/javascript/xfa_specific/xfa_exclgroup_expected.txt
new file mode 100644
index 0000000..d92bc94
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_exclgroup_expected.txt
@@ -0,0 +1,17 @@
+Alert: PASS: RadioButtonList.className = exclGroup
+Alert: PASS: RadioButtonList.execEvent() threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.execEvent(1, 2) threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.execEvent('nonesuch') = undefined
+Alert: PASS: RadioButtonList.execEvent('initialize') = undefined
+Alert: PASS: RadioButtonList.execInitialize('badarg') threw XFAObject.execInitialize: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.execInitialize() = undefined
+Alert: PASS: RadioButtonList.execCalculate('badarg') threw XFAObject.execCalculate: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.execCalculate() = undefined
+Alert: PASS: RadioButtonList.execValidate('badarg') threw XFAObject.execValidate: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.execValidate() = true
+Alert: PASS: RadioButtonList.selectedMember('badarg') threw XFAObject.selectedMember: Incorrect number of parameters passed to function.
+Alert: PASS: RadioButtonList.selectedMember() = null
+Alert: PASS: RadioButtonList.defaultValue = undefined
+Alert: PASS: RadioButtonList.rawValue = null
+Alert: PASS: RadioButtonList.transient = undefined
+Alert: PASS: RadioButtonList.errorText = undefined