summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-09-15 14:45:29 -0700
committerLei Zhang <thestig@chromium.org>2015-09-15 14:45:29 -0700
commit0b3c8f742613da294f812e2f6e908f4026499f96 (patch)
tree9943c7faca7a30ce935eb2203e53dceb948f09e5 /fpdfsdk/src/fpdfdoc_embeddertest.cpp
parentb17d62601b21dfce85718e08cfd0ffce3a45d74e (diff)
downloadpdfium-0b3c8f742613da294f812e2f6e908f4026499f96.tar.xz
Implement FPDFAction_GetFilePath().
The API is the same as the Foxit version, except the encoding is specified as UTF-8 instead of local encoding. Also remove CPDF_LWinParam since it's unused. BUG=chromium:517713 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1335373002 .
Diffstat (limited to 'fpdfsdk/src/fpdfdoc_embeddertest.cpp')
-rw-r--r--fpdfsdk/src/fpdfdoc_embeddertest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index b263fafe16..f3663baf10 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -35,3 +35,28 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
EXPECT_NE(nullptr, dest);
EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), dest));
}
+
+TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
+ EXPECT_TRUE(OpenDocument("testing/resources/launch_action.pdf"));
+
+ FPDF_PAGE page = FPDF_LoadPage(document(), 0);
+ ASSERT_TRUE(page);
+
+ // The target action is nearly the size of the whole page.
+ FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
+ ASSERT_TRUE(link);
+
+ FPDF_ACTION action = FPDFLink_GetAction(link);
+ ASSERT_TRUE(action);
+
+ const char kExpectedResult[] = "test.pdf";
+ const unsigned long kExpectedLength = strlen(kExpectedResult) + 1;
+ unsigned long bufsize = FPDFAction_GetFilePath(action, nullptr, 0);
+ ASSERT_EQ(kExpectedLength, bufsize);
+
+ char buf[kExpectedLength];
+ EXPECT_EQ(bufsize, FPDFAction_GetFilePath(action, buf, bufsize));
+ EXPECT_EQ(std::string(kExpectedResult), std::string(buf));
+
+ FPDF_ClosePage(page);
+}