summaryrefslogtreecommitdiff
path: root/testing/resources/javascript/document_props.in
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-13 16:54:48 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-13 16:54:48 -0800
commitb7cb36aba7d32c506ee921cb7558b8effd4b2fa1 (patch)
treeaec88bf31f8c449cf289f1d2aa11ce326a79e9bc /testing/resources/javascript/document_props.in
parent92e856b09dd2fcf6cf46b07b1496053eb0e67851 (diff)
downloadpdfium-b7cb36aba7d32c506ee921cb7558b8effd4b2fa1.tar.xz
Merge to XFA: Run javascript/pixel tests via automated script.
This pulls in: 7435e8e Run pixel tests via automated script. 83c87e5 run_javascript_tests.py: Be more flexible about directory layout. 5898509 Test top-level Document JS properties. 9f93baf Create run_javascript_tests.py TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/923293002
Diffstat (limited to 'testing/resources/javascript/document_props.in')
-rw-r--r--testing/resources/javascript/document_props.in143
1 files changed, 143 insertions, 0 deletions
diff --git a/testing/resources/javascript/document_props.in b/testing/resources/javascript/document_props.in
new file mode 100644
index 0000000000..8ab7e3d566
--- /dev/null
+++ b/testing/resources/javascript/document_props.in
@@ -0,0 +1,143 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /OpenAction 10 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 4
+ /Kids [
+ 3 0 R
+ 4 0 R
+ 5 0 R
+ 6 0 R
+ ]
+>>
+endobj
+% Page number 0.
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /MediaBox [0 0 612 792]
+>>
+% Page number 1.
+{{object 4 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /MediaBox [0 0 612 792]
+>>
+% Page number 2.
+{{object 5 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /MediaBox [0 0 612 792]
+>>
+% Page number 3.
+{{object 6 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /MediaBox [0 0 612 792]
+>>
+
+% Info
+{{object 9 0}} <<
+ /Author (Joe Random Author)
+ /Creator (Joe Random Creator)
+>>
+endobj
+% OpenAction action
+{{object 10 0}} <<
+ /Type /Action
+ /S /JavaScript
+ /JS 11 0 R
+>>
+endobj
+% JS program to exexute
+{{object 11 0}} <<
+>>
+stream
+var document_props = [
+ 'ADBE',
+ 'author',
+ 'baseURL',
+ 'bookmarkRoot',
+ 'calculate',
+ 'Collab',
+ 'creationDate',
+ 'creator',
+ 'delay',
+ 'dirty',
+ 'documentFileName',
+ 'external',
+ 'filesize',
+ 'icons',
+ 'info',
+ 'keywords',
+ 'layout',
+ 'media',
+ 'modDate',
+ 'mouseX',
+ 'mouseY',
+ 'numFields',
+ 'numPages',
+ 'pageNum',
+ 'pageWindowRect',
+ 'path',
+ 'producer',
+ 'subject',
+ 'title',
+ 'zoom',
+ 'zoomType',
+];
+
+function testGetProps(props) {
+ try {
+ app.alert('*** Getting properties ***');
+ for (var i = 0; i < props.length; ++i) {
+ var expr1 = "this." + props[i];
+ var expr2 = "typeof " + expr1;
+ app.alert(expr1 + " is " + eval(expr2) + ' ' + eval(expr1));
+ }
+ } catch (e) {
+ app.alert("ERROR: " + e.toString());
+ }
+}
+
+function testSetProps(props) {
+ try {
+ app.alert('*** Setting properties ***');
+ for (var i = 0; i < props.length; ++i) {
+ var expr1 = "this." + props[i] + ' = 3;'
+ app.alert(expr1 + " yields " + eval(expr1));
+ }
+ } catch (e) {
+ app.alert("ERROR: " + e.toString());
+ }
+}
+
+testGetProps(document_props);
+testSetProps(document_props);
+testGetProps(document_props);
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Root 1 0 R
+ /Info 9 0 R
+>>
+{{startxref}}
+%%EOF