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

Unified Diff: fpdfsdk/src/fpdfdoc_embeddertest.cpp

Issue 1335373002: Implement FPDFAction_GetFilePath(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address some comments Created 5 years, 3 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 | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfview_c_api_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index b263fafe16905a3c448e0b9e9b0f4861a2d67059..f3663baf10e965c2e4bd836687a8cd9ba76725d2 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);
+}
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfview_c_api_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698