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 | 8 |
9 #include "core/fpdfapi/cpdf_modulemgr.h" | 9 #include "core/fpdfapi/cpdf_modulemgr.h" |
10 #include "core/fpdfapi/parser/cpdf_array.h" | 10 #include "core/fpdfapi/parser/cpdf_array.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 justSix->AddReference(this, AddIndirectObject(CreateNumberedPage(6))); | 62 justSix->AddReference(this, AddIndirectObject(CreateNumberedPage(6))); |
63 CPDF_Dictionary* branch4 = CreatePageTreeNode(justSix, this, 1); | 63 CPDF_Dictionary* branch4 = CreatePageTreeNode(justSix, this, 1); |
64 | 64 |
65 CPDF_Array* allPages = new CPDF_Array(); | 65 CPDF_Array* allPages = new CPDF_Array(); |
66 allPages->AddReference(this, branch2->GetObjNum()); | 66 allPages->AddReference(this, branch2->GetObjNum()); |
67 allPages->AddReference(this, branch3->GetObjNum()); | 67 allPages->AddReference(this, branch3->GetObjNum()); |
68 allPages->AddReference(this, branch4->GetObjNum()); | 68 allPages->AddReference(this, branch4->GetObjNum()); |
69 CPDF_Dictionary* pagesDict = CreatePageTreeNode(allPages, this, 7); | 69 CPDF_Dictionary* pagesDict = CreatePageTreeNode(allPages, this, 7); |
70 | 70 |
71 m_pOwnedRootDict.reset(new CPDF_Dictionary()); | 71 m_pOwnedRootDict.reset(new CPDF_Dictionary()); |
72 m_pOwnedRootDict->SetReferenceFor("Pages", this, | 72 m_pOwnedRootDict->SetReferenceFor("Pages", this, pagesDict->GetObjNum()); |
73 AddIndirectObject(pagesDict)); | |
74 m_pRootDict = m_pOwnedRootDict.get(); | 73 m_pRootDict = m_pOwnedRootDict.get(); |
75 m_PageList.SetSize(7); | 74 m_PageList.SetSize(7); |
76 } | 75 } |
77 | 76 |
78 private: | 77 private: |
79 std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict; | 78 std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict; |
80 }; | 79 }; |
81 } // namespace | 80 } // namespace |
82 | 81 |
83 class cpdf_document_test : public testing::Test { | 82 class cpdf_document_test : public testing::Test { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const int test_page_num = 33; | 129 const int test_page_num = 33; |
131 | 130 |
132 EXPECT_FALSE(document.IsPageLoaded(test_page_num)); | 131 EXPECT_FALSE(document.IsPageLoaded(test_page_num)); |
133 EXPECT_EQ(nullptr, document.GetPage(test_page_num)); | 132 EXPECT_EQ(nullptr, document.GetPage(test_page_num)); |
134 | 133 |
135 document.SetPageObjNum(test_page_num, obj_num); | 134 document.SetPageObjNum(test_page_num, obj_num); |
136 | 135 |
137 EXPECT_TRUE(document.IsPageLoaded(test_page_num)); | 136 EXPECT_TRUE(document.IsPageLoaded(test_page_num)); |
138 EXPECT_EQ(page_stub, document.GetPage(test_page_num)); | 137 EXPECT_EQ(page_stub, document.GetPage(test_page_num)); |
139 } | 138 } |
OLD | NEW |