Chromium Code Reviews| Index: core/fpdfapi/parser/cpdf_document_unittest.cpp |
| diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp |
| index 7b5ab43b5c339ef1a60b788982472a759bd2ffea..a94aba663c3266165b2926b37847d6fd167953c2 100644 |
| --- a/core/fpdfapi/parser/cpdf_document_unittest.cpp |
| +++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp |
| @@ -43,7 +43,8 @@ class CPDF_TestDocumentForPages : public CPDF_Document { |
| CPDF_Array* zeroToTwo = new CPDF_Array(); |
| zeroToTwo->AddReference(this, AddIndirectObject(CreateNumberedPage(0))); |
| zeroToTwo->AddReference(this, AddIndirectObject(CreateNumberedPage(1))); |
| - zeroToTwo->AddReference(this, AddIndirectObject(CreateNumberedPage(2))); |
| + // Page without pageNum. |
| + zeroToTwo->Add(CreateNumberedPage(2)); |
| CPDF_Dictionary* branch1 = CreatePageTreeNode(zeroToTwo, this, 3); |
| CPDF_Array* zeroToThree = new CPDF_Array(); |
| @@ -105,6 +106,18 @@ TEST_F(cpdf_document_test, GetPages) { |
| EXPECT_FALSE(page); |
| } |
| +TEST_F(cpdf_document_test, GetPageWithoutObjNumTwice) { |
| + std::unique_ptr<CPDF_TestDocumentForPages> document = |
| + pdfium::MakeUnique<CPDF_TestDocumentForPages>(); |
| + const auto page = document->GetPage(2); |
|
Lei Zhang
2016/11/09 20:19:41
There's room on this line, so let's write const CP
snake
2016/11/09 20:30:41
Done.
|
| + ASSERT_TRUE(page); |
| + // This is page without obj num. |
| + ASSERT_EQ(0ul, page->GetObjNum()); |
| + const auto second_call_page = document->GetPage(2); |
| + EXPECT_TRUE(second_call_page); |
| + EXPECT_EQ(page, second_call_page); |
| +} |
| + |
| TEST_F(cpdf_document_test, GetPagesReverseOrder) { |
| std::unique_ptr<CPDF_TestDocumentForPages> document = |
| pdfium::MakeUnique<CPDF_TestDocumentForPages>(); |