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..8f3421c8b317c04086f33105f9b7504de259a44c 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)); |
npm
2016/11/09 20:32:56
Maybe add an example instead of changing this one?
snake
2016/11/09 20:46:47
I think it should be at this place. Because, the t
npm
2016/11/09 21:55:03
The reason it would fail GetPagesReverseOrder is t
snake
2016/11/09 22:39:47
Done.
|
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 CPDF_Dictionary* page = document->GetPage(2); |
+ ASSERT_TRUE(page); |
+ // This is page without obj num. |
+ ASSERT_EQ(0ul, page->GetObjNum()); |
+ const CPDF_Dictionary* 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>(); |