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 "public/fpdf_doc.h" | 5 #include "public/fpdf_doc.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "core/fpdfapi/cpdf_modulemgr.h" | 10 #include "core/fpdfapi/cpdf_modulemgr.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 m_pRootObj.reset(); | 74 m_pRootObj.reset(); |
75 m_pIndirectObjs = nullptr; | 75 m_pIndirectObjs = nullptr; |
76 m_pDoc.reset(); | 76 m_pDoc.reset(); |
77 CPDF_ModuleMgr::Destroy(); | 77 CPDF_ModuleMgr::Destroy(); |
78 } | 78 } |
79 | 79 |
80 std::vector<DictObjInfo> CreateDictObjs(int num) { | 80 std::vector<DictObjInfo> CreateDictObjs(int num) { |
81 std::vector<DictObjInfo> info; | 81 std::vector<DictObjInfo> info; |
82 for (int i = 0; i < num; ++i) { | 82 for (int i = 0; i < num; ++i) { |
83 // Objects created will be released by the document. | 83 // Objects created will be released by the document. |
84 CPDF_Dictionary* obj = new CPDF_Dictionary(); | 84 CPDF_Dictionary* obj = m_pIndirectObjs->NewIndirect<CPDF_Dictionary>(); |
85 info.push_back({m_pIndirectObjs->AddIndirectObject(obj), obj}); | 85 info.push_back({obj->GetObjNum(), obj}); |
86 } | 86 } |
87 return info; | 87 return info; |
88 } | 88 } |
89 | 89 |
90 protected: | 90 protected: |
91 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc; | 91 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc; |
92 CPDF_IndirectObjectHolder* m_pIndirectObjs; | 92 CPDF_IndirectObjectHolder* m_pIndirectObjs; |
93 std::unique_ptr<CPDF_Dictionary> m_pRootObj; | 93 std::unique_ptr<CPDF_Dictionary> m_pRootObj; |
94 }; | 94 }; |
95 | 95 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 EXPECT_TRUE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, | 264 EXPECT_TRUE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, |
265 &x, &y, &zoom)); | 265 &x, &y, &zoom)); |
266 EXPECT_FALSE(hasX); | 266 EXPECT_FALSE(hasX); |
267 EXPECT_FALSE(hasY); | 267 EXPECT_FALSE(hasY); |
268 EXPECT_FALSE(hasZoom); | 268 EXPECT_FALSE(hasZoom); |
269 | 269 |
270 array = pdfium::MakeUnique<CPDF_Array>(); | 270 array = pdfium::MakeUnique<CPDF_Array>(); |
271 EXPECT_FALSE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, | 271 EXPECT_FALSE(FPDFDest_GetLocationInPage(array.get(), &hasX, &hasY, &hasZoom, |
272 &x, &y, &zoom)); | 272 &x, &y, &zoom)); |
273 } | 273 } |
OLD | NEW |