OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/fpdfapi/parser/cpdf_document.h" | 5 #include "core/fpdfapi/parser/cpdf_document.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "core/fpdfapi/cpdf_modulemgr.h" | 10 #include "core/fpdfapi/cpdf_modulemgr.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Set up test | 101 // Set up test |
102 auto allPages = pdfium::MakeUnique<CPDF_Array>(); | 102 auto allPages = pdfium::MakeUnique<CPDF_Array>(); |
103 allPages->AddNew<CPDF_Reference>( | 103 allPages->AddNew<CPDF_Reference>( |
104 this, AddIndirectObject(CreateNumberedPage(0))->GetObjNum()); | 104 this, AddIndirectObject(CreateNumberedPage(0))->GetObjNum()); |
105 allPages->AddNew<CPDF_Reference>( | 105 allPages->AddNew<CPDF_Reference>( |
106 this, AddIndirectObject(CreateNumberedPage(1))->GetObjNum()); | 106 this, AddIndirectObject(CreateNumberedPage(1))->GetObjNum()); |
107 // Page without pageNum. | 107 // Page without pageNum. |
108 allPages->Add(CreateNumberedPage(2)); | 108 allPages->Add(CreateNumberedPage(2)); |
109 CPDF_Dictionary* pagesDict = | 109 CPDF_Dictionary* pagesDict = |
110 CreatePageTreeNode(std::move(allPages), this, 3); | 110 CreatePageTreeNode(std::move(allPages), this, 3); |
111 m_pOwnedRootDict.reset(new CPDF_Dictionary()); | 111 m_pOwnedRootDict = pdfium::MakeUnique<CPDF_Dictionary>(); |
112 m_pOwnedRootDict->SetNewFor<CPDF_Reference>("Pages", this, | 112 m_pOwnedRootDict->SetNewFor<CPDF_Reference>("Pages", this, |
113 pagesDict->GetObjNum()); | 113 pagesDict->GetObjNum()); |
114 m_pRootDict = m_pOwnedRootDict.get(); | 114 m_pRootDict = m_pOwnedRootDict.get(); |
115 m_PageList.SetSize(3); | 115 m_PageList.SetSize(3); |
116 } | 116 } |
117 | 117 |
118 private: | 118 private: |
119 std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict; | 119 std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict; |
120 }; | 120 }; |
121 | 121 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const uint32_t obj_num = page_stub->GetObjNum(); | 212 const uint32_t obj_num = page_stub->GetObjNum(); |
213 const int test_page_num = 33; | 213 const int test_page_num = 33; |
214 | 214 |
215 EXPECT_FALSE(document.IsPageLoaded(test_page_num)); | 215 EXPECT_FALSE(document.IsPageLoaded(test_page_num)); |
216 EXPECT_EQ(nullptr, document.GetPage(test_page_num)); | 216 EXPECT_EQ(nullptr, document.GetPage(test_page_num)); |
217 | 217 |
218 document.SetPageObjNum(test_page_num, obj_num); | 218 document.SetPageObjNum(test_page_num, obj_num); |
219 EXPECT_TRUE(document.IsPageLoaded(test_page_num)); | 219 EXPECT_TRUE(document.IsPageLoaded(test_page_num)); |
220 EXPECT_EQ(page_stub, document.GetPage(test_page_num)); | 220 EXPECT_EQ(page_stub, document.GetPage(test_page_num)); |
221 } | 221 } |
OLD | NEW |