Chromium Code Reviews| 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); |
|
jun_fang
2015/09/14 14:18:58
EXPECT_NE(nullptr, page);
Lei Zhang
2015/09/15 08:24:50
I want this test to be straight forward and only c
jun_fang
2015/09/15 08:35:03
The returned value, page, is handle not boolean va
Lei Zhang
2015/09/15 08:50:57
So handles are really pointers, and the range of v
|
| + |
| + // The target action is nearly the size of the whole page. |
| + FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100); |
| + ASSERT_TRUE(link); |
|
jun_fang
2015/09/14 14:18:58
EXPECT_NE(nullptr, link);
|
| + |
| + FPDF_ACTION action = FPDFLink_GetAction(link); |
| + ASSERT_TRUE(action); |
|
jun_fang
2015/09/14 14:18:58
EXPECT_NE(nullptr, 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); |
| +} |