Add JavaScript test for CJX_Subform object.

Change-Id: Ie0348c598cef7a9c9aaf2d78b864eba8df8fbde6
Reviewed-on: https://pdfium-review.googlesource.com/c/50230
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_subform.in b/testing/resources/javascript/xfa_specific/xfa_subform.in
new file mode 100644
index 0000000..4cc2305
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_subform.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}} <<
+>>
+stream
+<template>
+  <subform layout="tb" name="my_doc">
+    <pageSet id="page" relation="orderedOccurrence">
+      <occur initial="1" max="1" min="1"/>
+      <pageArea id="Page1" name="Page1">
+        <occur max="1" min="1"/>
+        <contentArea h="100mm" w="200mm" x="0.25in" y="0.25in"/>
+      </pageArea>
+      <pageArea id="Page2" name="Page2">
+        <occur max="1" min="1"/>
+        <contentArea h="100mm" w="200mm" x="0.25in" y="0.25in"/>
+      </pageArea>
+    </pageSet>
+    <event activity="docReady" ref="$host">
+      <script contentType="application/x-javascript">
+        {{include ../expect.js}}
+        {{include ../property_test_helpers.js}}
+        testRWProperty(my_doc, "locale", "en_US", "FR");
+        testRIProperty(my_doc, "instanceIndex", 0);
+        testRWProperty(my_doc, "layout", "tb", "landscape");
+        testRWProperty(my_doc, "validationMessage", "", "totally valid");
+        expect("typeof my_doc.execEvent", "function");
+        expect("typeof my_doc.execInitialize", "function");
+        expect("typeof my_doc.execCalculate", "function");
+        expect("typeof my_doc.execValidate", "function");
+        expectError("my_doc.execEvent()");
+        expectError("my_doc.execEvent('foo', 'bar')");
+        expect("my_doc.execEvent(undefined)", undefined);
+        expect("my_doc.execEvent({value: 'bogus'})", undefined);
+        expect("my_doc.execEvent('bogus')", undefined);
+        expect("my_doc.execEvent('change')", undefined);
+        expect("my_doc.execEvent('click')", undefined);
+        expect("my_doc.execEvent('enter')", undefined);
+        expect("my_doc.execEvent('exit')", undefined);
+        expect("my_doc.execEvent('full')", undefined);
+        expect("my_doc.execEvent('indexChange')", undefined);
+        expect("my_doc.execEvent('initialize')", undefined);
+        expect("my_doc.execEvent('mouseDown')", undefined);
+        expect("my_doc.execEvent('mouseEnter')", undefined);
+        expect("my_doc.execEvent('mouseExit')", undefined);
+        expect("my_doc.execEvent('postOpen')", undefined);
+        expect("my_doc.execEvent('postSign')", undefined);
+        expect("my_doc.execEvent('preOpen')", undefined);
+        expect("my_doc.execEvent('preSign')", undefined);
+        expectError("my_doc.execInitialize('foo')");
+        expect("my_doc.execInitialize()", undefined);
+        expectError("my_doc.execCalculate('foo')");
+        expect("my_doc.execCalculate()", undefined);
+        expectError("my_doc.execValidate('foo')");
+        expect("my_doc.execValidate()", true);
+      </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_subform_expected.txt b/testing/resources/javascript/xfa_specific/xfa_subform_expected.txt
new file mode 100644
index 0000000..68b2b24
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_subform_expected.txt
@@ -0,0 +1,37 @@
+Alert: PASS: locale = en_US
+Alert: PASS: locale = FR
+Alert: PASS: instanceIndex = 0
+Alert: PASS: instanceIndex = 0
+Alert: PASS: layout = tb
+Alert: PASS: layout = landscape
+Alert: PASS: validationMessage = 
+Alert: PASS: validationMessage = totally valid
+Alert: PASS: typeof my_doc.execEvent = function
+Alert: PASS: typeof my_doc.execInitialize = function
+Alert: PASS: typeof my_doc.execCalculate = function
+Alert: PASS: typeof my_doc.execValidate = function
+Alert: PASS: my_doc.execEvent() threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: my_doc.execEvent('foo', 'bar') threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: my_doc.execEvent(undefined) = undefined
+Alert: PASS: my_doc.execEvent({value: 'bogus'}) = undefined
+Alert: PASS: my_doc.execEvent('bogus') = undefined
+Alert: PASS: my_doc.execEvent('change') = undefined
+Alert: PASS: my_doc.execEvent('click') = undefined
+Alert: PASS: my_doc.execEvent('enter') = undefined
+Alert: PASS: my_doc.execEvent('exit') = undefined
+Alert: PASS: my_doc.execEvent('full') = undefined
+Alert: PASS: my_doc.execEvent('indexChange') = undefined
+Alert: PASS: my_doc.execEvent('initialize') = undefined
+Alert: PASS: my_doc.execEvent('mouseDown') = undefined
+Alert: PASS: my_doc.execEvent('mouseEnter') = undefined
+Alert: PASS: my_doc.execEvent('mouseExit') = undefined
+Alert: PASS: my_doc.execEvent('postOpen') = undefined
+Alert: PASS: my_doc.execEvent('postSign') = undefined
+Alert: PASS: my_doc.execEvent('preOpen') = undefined
+Alert: PASS: my_doc.execEvent('preSign') = undefined
+Alert: PASS: my_doc.execInitialize('foo') threw XFAObject.execInitialize: Incorrect number of parameters passed to function.
+Alert: PASS: my_doc.execInitialize() = undefined
+Alert: PASS: my_doc.execCalculate('foo') threw XFAObject.execCalculate: Incorrect number of parameters passed to function.
+Alert: PASS: my_doc.execCalculate() = undefined
+Alert: PASS: my_doc.execValidate('foo') threw XFAObject.execValidate: Incorrect number of parameters passed to function.
+Alert: PASS: my_doc.execValidate() = true