diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-02-01 17:07:13 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-01 17:07:13 +0000 |
commit | 71a7d377ff36a0be1af1848d5cac0ccb83ae725d (patch) | |
tree | c7f26301bbfcd45126900f7bbc0dc88f5e8a8946 /fpdfsdk/fpdfdoc_embeddertest.cpp | |
parent | 1fc533150a27257de4830559a14499f2e903dce9 (diff) | |
download | pdfium-71a7d377ff36a0be1af1848d5cac0ccb83ae725d.tar.xz |
Deprecate FPDFDest_GetPageIndex and create a fixed version.
FPDFDest_GetDestPageIndex() has a well defined return value for
errors (-1). Keeping FPDFDest_GetPageIndex() to avoid changing
behavior of the old API for whoever relies on it.
Bug: pdfium:938
Change-Id: Iad528923cb156e957a419540c262a65f45cb777d
Reviewed-on: https://pdfium-review.googlesource.com/24811
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfdoc_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdfdoc_embeddertest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp index d346330486..abe3d8c646 100644 --- a/fpdfsdk/fpdfdoc_embeddertest.cpp +++ b/fpdfsdk/fpdfdoc_embeddertest.cpp @@ -20,26 +20,31 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) { // NULL FPDF_DEST case. EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), nullptr)); + EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), nullptr)); // Page number directly in item from Dests NameTree. FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First"); EXPECT_TRUE(dest); EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest)); + EXPECT_EQ(1, FPDFDest_GetDestPageIndex(document(), dest)); // Page number via object reference in item from Dests NameTree. dest = FPDF_GetNamedDestByName(document(), "Next"); EXPECT_TRUE(dest); EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest)); + EXPECT_EQ(1, FPDFDest_GetDestPageIndex(document(), dest)); // Page number directly in item from Dests dictionary. dest = FPDF_GetNamedDestByName(document(), "FirstAlternate"); EXPECT_TRUE(dest); EXPECT_EQ(11U, FPDFDest_GetPageIndex(document(), dest)); + EXPECT_EQ(11, FPDFDest_GetDestPageIndex(document(), dest)); // Invalid object reference in item from Dests NameTree. dest = FPDF_GetNamedDestByName(document(), "LastAlternate"); EXPECT_TRUE(dest); EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), dest)); + EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), dest)); } TEST_F(FPDFDocEmbeddertest, DestGetView) { @@ -106,6 +111,7 @@ TEST_F(FPDFDocEmbeddertest, DestGetLocationInPage) { // NULL FPDF_DEST case. EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), nullptr)); + EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), nullptr)); FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First"); EXPECT_TRUE(dest); @@ -134,6 +140,7 @@ TEST_F(FPDFDocEmbeddertest, BUG_680376) { EXPECT_TRUE(dest); EXPECT_EQ(static_cast<unsigned long>(-1), FPDFDest_GetPageIndex(document(), dest)); + EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), dest)); } TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) { |