Test extracting values from variables contexts.
First attempt at covering parts of CFXJSE_Engine that are uncovered,
however it is not clear if this increases coverage. We didn't seem to
have any tests that covered a non-empty variables element before, though.
Change-Id: Ib751dc27fbcd82dbf10c08ee148b6c05ff792956
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67691
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_variables.in b/testing/resources/javascript/xfa_specific/xfa_variables.in
new file mode 100644
index 0000000..e812aed
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_variables.in
@@ -0,0 +1,49 @@
+{{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" name="my_doc">
+ <variables>
+ <text name="xx01">123</text>
+ <text name="xx02">456</text>
+ <integer name="xx03">123</integer>
+ <integer name="xx04">456</integer>
+ </variables>
+ <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">
+ try {
+ app.alert('We search variables context ' + (xx01.value + xx02.value));
+ app.alert('We search variables context ' + (xx03.value + xx04.value));
+ } catch (e) {
+ app.alert('Error: ' + e);
+ }
+ </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_variables_expected.txt b/testing/resources/javascript/xfa_specific/xfa_variables_expected.txt
new file mode 100644
index 0000000..1931ce7
--- /dev/null
+++ b/testing/resources/javascript/xfa_specific/xfa_variables_expected.txt
@@ -0,0 +1,2 @@
+Alert: We search variables context 123456
+Alert: We search variables context 579