diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-05-08 13:40:20 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-08 13:40:20 +0000 |
commit | 967aa0793c0b0cf2722ec8720e9d797266a9fde7 (patch) | |
tree | 46c32ab1adcadd770261093d6bb57e2e1886bf32 /core/fpdfapi/parser/cpdf_document_unittest.cpp | |
parent | e5c0fa97c2da104426dbc1cecfc0ed488a22efe5 (diff) | |
download | pdfium-967aa0793c0b0cf2722ec8720e9d797266a9fde7.tar.xz |
Rename CPDF_Document::GetPage() to GetPageDictionary().
Avoids a conflict should we wish to have the document actually
track pages, with a GetPage() that returns CPDF_Page.
Do the same thing to CPDF_DataAvail along the way.
Add some missing consts as well.
Change-Id: I2cb2213cc4c0649662fceab80407ee4a3f4cf30e
Reviewed-on: https://pdfium-review.googlesource.com/32158
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document_unittest.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_document_unittest.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp index d1b8dce74a..f06a7f42d3 100644 --- a/core/fpdfapi/parser/cpdf_document_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp @@ -164,22 +164,22 @@ TEST_F(cpdf_document_test, GetPages) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); for (int i = 0; i < kNumTestPages; i++) { - CPDF_Dictionary* page = document->GetPage(i); + CPDF_Dictionary* page = document->GetPageDictionary(i); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(i, page->GetIntegerFor("PageNumbering")); } - CPDF_Dictionary* page = document->GetPage(kNumTestPages); + CPDF_Dictionary* page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); } TEST_F(cpdf_document_test, GetPageWithoutObjNumTwice) { auto document = pdfium::MakeUnique<CPDF_TestDocumentWithPageWithoutPageNum>(); - const CPDF_Dictionary* page = document->GetPage(2); + CPDF_Dictionary* page = document->GetPageDictionary(2); ASSERT_TRUE(page); ASSERT_EQ(document->inlined_page(), page); - const CPDF_Dictionary* second_call_page = document->GetPage(2); + CPDF_Dictionary* second_call_page = document->GetPageDictionary(2); EXPECT_TRUE(second_call_page); EXPECT_EQ(page, second_call_page); } @@ -188,12 +188,12 @@ TEST_F(cpdf_document_test, GetPagesReverseOrder) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); for (int i = 6; i >= 0; i--) { - CPDF_Dictionary* page = document->GetPage(i); + CPDF_Dictionary* page = document->GetPageDictionary(i); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(i, page->GetIntegerFor("PageNumbering")); } - CPDF_Dictionary* page = document->GetPage(kNumTestPages); + CPDF_Dictionary* page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); } @@ -201,20 +201,20 @@ TEST_F(cpdf_document_test, GetPagesInDisorder) { std::unique_ptr<CPDF_TestDocumentForPages> document = pdfium::MakeUnique<CPDF_TestDocumentForPages>(); - CPDF_Dictionary* page = document->GetPage(1); + CPDF_Dictionary* page = document->GetPageDictionary(1); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(1, page->GetIntegerFor("PageNumbering")); - page = document->GetPage(3); + page = document->GetPageDictionary(3); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(3, page->GetIntegerFor("PageNumbering")); - page = document->GetPage(kNumTestPages); + page = document->GetPageDictionary(kNumTestPages); EXPECT_FALSE(page); - page = document->GetPage(6); + page = document->GetPageDictionary(6); ASSERT_TRUE(page); ASSERT_TRUE(page->KeyExist("PageNumbering")); EXPECT_EQ(6, page->GetIntegerFor("PageNumbering")); @@ -237,11 +237,11 @@ TEST_F(cpdf_document_test, UseCachedPageObjNumIfHaveNotPagesDict) { const int test_page_num = 33; EXPECT_FALSE(document.IsPageLoaded(test_page_num)); - EXPECT_EQ(nullptr, document.GetPage(test_page_num)); + EXPECT_EQ(nullptr, document.GetPageDictionary(test_page_num)); document.SetPageObjNum(test_page_num, obj_num); EXPECT_TRUE(document.IsPageLoaded(test_page_num)); - EXPECT_EQ(page_stub, document.GetPage(test_page_num)); + EXPECT_EQ(page_stub, document.GetPageDictionary(test_page_num)); } TEST_F(cpdf_document_test, CountGreaterThanPageTree) { @@ -249,19 +249,19 @@ TEST_F(cpdf_document_test, CountGreaterThanPageTree) { pdfium::MakeUnique<CPDF_TestDocumentForPages>(); document->SetTreeSize(kNumTestPages + 3); for (int i = 0; i < kNumTestPages; i++) - EXPECT_TRUE(document->GetPage(i)); + EXPECT_TRUE(document->GetPageDictionary(i)); for (int i = kNumTestPages; i < kNumTestPages + 4; i++) - EXPECT_FALSE(document->GetPage(i)); - EXPECT_TRUE(document->GetPage(kNumTestPages - 1)); + EXPECT_FALSE(document->GetPageDictionary(i)); + EXPECT_TRUE(document->GetPageDictionary(kNumTestPages - 1)); } TEST_F(cpdf_document_test, PagesWithoutKids) { // Set up a document with Pages dict without kids, and Count = 3 auto pDoc = pdfium::MakeUnique<CPDF_TestDocPagesWithoutKids>(); - EXPECT_TRUE(pDoc->GetPage(0)); + EXPECT_TRUE(pDoc->GetPageDictionary(0)); // Test GetPage does not fetch pages out of range for (int i = 1; i < 5; i++) - EXPECT_FALSE(pDoc->GetPage(i)); + EXPECT_FALSE(pDoc->GetPageDictionary(i)); - EXPECT_TRUE(pDoc->GetPage(0)); + EXPECT_TRUE(pDoc->GetPageDictionary(0)); } |