Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: testing/resources/javascript/document_props.in

Issue 928573002: Test top-level Document JS properties. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add missing expected result file. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | testing/resources/javascript/document_props_expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/resources/javascript/document_props.in
diff --git a/testing/resources/javascript/document_props.in b/testing/resources/javascript/document_props.in
new file mode 100644
index 0000000000000000000000000000000000000000..8ab7e3d56668700a2f7933f7f960040fed6101d5
--- /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
« no previous file with comments | « samples/pdfium_test.cc ('k') | testing/resources/javascript/document_props_expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698