summaryrefslogtreecommitdiff
path: root/testing/resources/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'testing/resources/javascript')
-rw-r--r--testing/resources/javascript/app_alert.pdf60
-rw-r--r--testing/resources/javascript/consts.pdf86
-rw-r--r--testing/resources/javascript/document_props.in143
-rw-r--r--testing/resources/javascript/document_props_expected.txt97
4 files changed, 240 insertions, 146 deletions
diff --git a/testing/resources/javascript/app_alert.pdf b/testing/resources/javascript/app_alert.pdf
deleted file mode 100644
index 091992cbd7..0000000000
--- a/testing/resources/javascript/app_alert.pdf
+++ /dev/null
@@ -1,60 +0,0 @@
-%PDF-1.7
-% ò¤ô
-1 0 obj <<
- /Type /Catalog
- /Pages 2 0 R
- /OpenAction 10 0 R
->>
-endobj
-2 0 obj <<
- /Type /Pages
- /Count 1
- /Kids [
- 3 0 R
- ]
->>
-endobj
-% Page number 0.
-3 0 obj <<
- /Type /Page
- /Parent 2 0 R
- /Resources <<
- /Font <</F1 15 0 R>>
- >>
- /Contents [21 0 R]
- /MediaBox [0 0 612 792]
->>
-% OpenAction action
-10 0 obj <<
- /Type /Action
- /S /JavaScript
- /JS 11 0 R
->>
-endobj
-% JS program to exexute
-11 0 obj <<
->>
-stream
-app.alert("This test passes if alert() logs output under the test utiltiy.");
-endstream
-endobj
-xref
-0 12
-0000000000 65535 f
-0000000015 00000 n
-0000000089 00000 n
-0000000177 00000 n
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000334 00000 n
-0000000426 00000 n
-trailer <<
- /Root 1 0 R
->>
-startxref
-543
-%%EOF
diff --git a/testing/resources/javascript/consts.pdf b/testing/resources/javascript/consts.pdf
deleted file mode 100644
index 0e436e5bab..0000000000
--- a/testing/resources/javascript/consts.pdf
+++ /dev/null
@@ -1,86 +0,0 @@
-%PDF-1.7
-% ò¤ô
-1 0 obj <<
- /Type /Catalog
- /Pages 2 0 R
- /OpenAction 10 0 R
->>
-endobj
-2 0 obj <<
- /Type /Pages
- /Count 1
- /Kids [
- 3 0 R
- ]
->>
-endobj
-% Page number 0.
-3 0 obj <<
- /Type /Page
- /Parent 2 0 R
- /Resources <<
- /Font <</F1 15 0 R>>
- >>
- /Contents [21 0 R]
- /MediaBox [0 0 612 792]
->>
-% OpenAction action
-10 0 obj <<
- /Type /Action
- /S /JavaScript
- /JS 11 0 R
->>
-endobj
-% JS program to exexute
-11 0 obj <<
->>
-stream
-
-function doTest(name, props) {
- for (var i = 0; i < props.length; ++i) {
- var expr = name + "." + props[i];
- app.alert(expr + " is " + eval(expr));
- }
-}
-
-try {
- doTest("border", ["s", "b", "d", "i", "u", "nonesuch"]);
- doTest("display", ["visible", "hidden", "noPrint", "noView", "nonesuch"]);
- doTest("font", ["Times", "TimesB", "TimesI", "TimesBI", "Helv", "HelvB",
- "HelvI", "HelvBI", "Cour", "CourB", "CourI", "CourBI",
- "Symbol", "ZapfD", "Nonesuch"]);
-
- doTest("highlight", ["n", "i", "p", "o", "nonesuch"]);
- doTest("position", ["textOnly", "iconOnly", "iconTextV", "textIconV",
- "iconTextH", "textIconH", "overlay", "nonesuch"]);
-
- doTest("scaleHow", ["proportional", "anamorphic", "nonesuch"]);
- doTest("scaleWhen", ["always", "never", "tooBig", "tooSmall", "nonesuch"]);
- doTest("style", ["ch", "cr", "di", "ci", "st", "sq", "nonesuch"]);
- doTest("zoomtype", ["none", "fitP", "fitW", "fitH", "fitV", "pref", "refW",
- "nonesuch"]);
-} catch (e) {
- app.alert("ERROR: " + e.toString());
-}
-endstream
-endobj
-xref
-0 12
-0000000000 65535 f
-0000000015 00000 n
-0000000089 00000 n
-0000000177 00000 n
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000334 00000 n
-0000000426 00000 n
-trailer <<
- /Root 1 0 R
->>
-startxref
-1555
-%%EOF
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
diff --git a/testing/resources/javascript/document_props_expected.txt b/testing/resources/javascript/document_props_expected.txt
new file mode 100644
index 0000000000..38bea97acb
--- /dev/null
+++ b/testing/resources/javascript/document_props_expected.txt
@@ -0,0 +1,97 @@
+Alert: *** Getting properties ***
+Alert: this.ADBE is undefined undefined
+Alert: this.author is string Joe Random Author
+Alert: this.baseURL is string
+Alert: this.bookmarkRoot is undefined undefined
+Alert: this.calculate is boolean true
+Alert: this.Collab is undefined undefined
+Alert: this.creationDate is string
+Alert: this.creator is string Joe Random Creator
+Alert: this.delay is number 0
+Alert: this.dirty is boolean false
+Alert: this.documentFileName is string
+Alert: this.external is number 1
+Alert: this.filesize is number 0
+Alert: this.icons is undefined undefined
+Alert: this.info is object [object Object]
+Alert: this.keywords is string
+Alert: this.layout is undefined undefined
+Alert: this.media is undefined undefined
+Alert: this.modDate is string
+Alert: this.mouseX is undefined undefined
+Alert: this.mouseY is undefined undefined
+Alert: this.numFields is number 0
+Alert: this.numPages is number 4
+Alert: this.pageNum is undefined undefined
+Alert: this.pageWindowRect is undefined undefined
+Alert: this.path is string /
+Alert: this.producer is string
+Alert: this.subject is string
+Alert: this.title is string
+Alert: this.zoom is undefined undefined
+Alert: this.zoomType is undefined undefined
+Alert: *** Setting properties ***
+Alert: this.ADBE = 3; yields 3
+Alert: this.author = 3; yields 3
+Alert: this.baseURL = 3; yields 3
+Alert: this.bookmarkRoot = 3; yields 3
+Alert: this.calculate = 3; yields 3
+Alert: this.Collab = 3; yields 3
+Alert: this.creationDate = 3; yields 3
+Alert: this.creator = 3; yields 3
+Alert: this.delay = 3; yields 3
+Alert: this.dirty = 3; yields 3
+Alert: this.documentFileName = 3; yields 3
+Alert: this.external = 3; yields 3
+Alert: this.filesize = 3; yields 3
+Alert: this.icons = 3; yields 3
+Alert: this.info = 3; yields 3
+Alert: this.keywords = 3; yields 3
+Alert: this.layout = 3; yields 3
+Alert: this.media = 3; yields 3
+Alert: this.modDate = 3; yields 3
+Alert: this.mouseX = 3; yields 3
+Alert: this.mouseY = 3; yields 3
+Alert: this.numFields = 3; yields 3
+Alert: this.numPages = 3; yields 3
+Goto Page: 3
+Alert: this.pageNum = 3; yields 3
+Alert: this.pageWindowRect = 3; yields 3
+Alert: this.path = 3; yields 3
+Alert: this.producer = 3; yields 3
+Alert: this.subject = 3; yields 3
+Alert: this.title = 3; yields 3
+Alert: this.zoom = 3; yields 3
+Alert: this.zoomType = 3; yields 3
+Alert: *** Getting properties ***
+Alert: this.ADBE is undefined undefined
+Alert: this.author is string 3
+Alert: this.baseURL is string 3
+Alert: this.bookmarkRoot is undefined undefined
+Alert: this.calculate is boolean true
+Alert: this.Collab is undefined undefined
+Alert: this.creationDate is string 3
+Alert: this.creator is string 3
+Alert: this.delay is number 1
+Alert: this.dirty is boolean true
+Alert: this.documentFileName is string
+Alert: this.external is number 1
+Alert: this.filesize is number 0
+Alert: this.icons is undefined undefined
+Alert: this.info is object [object Object]
+Alert: this.keywords is string 3
+Alert: this.layout is undefined undefined
+Alert: this.media is undefined undefined
+Alert: this.modDate is string 3
+Alert: this.mouseX is undefined undefined
+Alert: this.mouseY is undefined undefined
+Alert: this.numFields is number 0
+Alert: this.numPages is number 4
+Alert: this.pageNum is undefined undefined
+Alert: this.pageWindowRect is undefined undefined
+Alert: this.path is string /
+Alert: this.producer is string 3
+Alert: this.subject is string 3
+Alert: this.title is string 3
+Alert: this.zoom is undefined undefined
+Alert: this.zoomType is undefined undefined