summaryrefslogtreecommitdiff
path: root/testing/resources
diff options
context:
space:
mode:
authortonikitoo <tonikitoo@igalia.com>2016-08-08 16:14:05 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-08 16:14:05 -0700
commit1c836753bb86b3eb0e130f1d92868a273bb26ab8 (patch)
tree35a4cc074fc56bd53112492b48dece10e1519470 /testing/resources
parent727da4f329956406b936ba9c0bc49ab2d32db67e (diff)
downloadpdfium-1c836753bb86b3eb0e130f1d92868a273bb26ab8.tar.xz
Add support to Document::gotoNamedDest method.
Patch implements the Document's API gotoNamedDest, which is part of the PDF specification [1], page 129, with the following (short) description: "Use this method to go to a named destination within the PDF document". [1] http://partners.adobe.com/public/developer/en/acrobat/sdk/5186AcroJS.pdf "Named destination" is a common concept in the PDF world. It can be used together with PDF's Links, Annotations, Bookmarks and OpenActions, as well as an action per se, in case "this.gotoNamedDest" is called directly. Note that the implementation makes use of the existing hook CPDFDoc_Environment::FFI_DoGoToAction, which ends up calling out the embedder to actually handle it. In case of Chromium, for instance, it calls PDFiumEngine::Form_DoGoToAction which only handles for now the "page" property of the "destination". Other properties, including zoom level, and scroll position are ignored for the moment. BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2221823003
Diffstat (limited to 'testing/resources')
-rw-r--r--testing/resources/javascript/document_methods.in12
-rw-r--r--testing/resources/javascript/document_methods_expected.txt3
2 files changed, 15 insertions, 0 deletions
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in
index 3cd3330b87..1c53dc24b5 100644
--- a/testing/resources/javascript/document_methods.in
+++ b/testing/resources/javascript/document_methods.in
@@ -214,6 +214,17 @@ function testGetPrintParams() {
// TODO(tsepez): test success cases.
}
+function testGotoNamedDest() {
+ // Method is present.
+ expect('typeof this.gotoNamedDest', 'function');
+
+ // Method needs exactly one argument.
+ expectError('this.gotoNamedDest()');
+ expectError('this.gotoNamedDest(1, 2)');
+
+ // TODO(tonikitoo): test success cases.
+}
+
function testMailDoc() {
// Method is present.
expect('typeof this.mailDoc', 'function');
@@ -303,6 +314,7 @@ try {
testGetPageNthWordQuads();
testGetPageNumWords();
testGetPrintParams();
+ testGotoNamedDest();
testMailDoc();
testMailForm();
testPrint();
diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt
index 26f7b542dd..d66de8b119 100644
--- a/testing/resources/javascript/document_methods_expected.txt
+++ b/testing/resources/javascript/document_methods_expected.txt
@@ -97,6 +97,9 @@ Alert: PASS: this.getPageNumWords(0, "clams", [1, 2]) = 2
Alert: PASS: this.getPageNumWords(-1) threw error Document.getPageNumWords: Incorrect parameter value.
Alert: PASS: this.getPageNumWords(6) threw error Document.getPageNumWords: Incorrect parameter value.
Alert: PASS: typeof this.getPrintParams = function
+Alert: PASS: typeof this.gotoNamedDest = function
+Alert: PASS: this.gotoNamedDest() threw error Document.gotoNamedDest: Incorrect number of parameters passed to function.
+Alert: PASS: this.gotoNamedDest(1, 2) threw error Document.gotoNamedDest: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.mailDoc = function
Alert: PASS: typeof this.mailForm = function
Alert: PASS: typeof this.print = function