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/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class PDFDocTest : public testing::Test { | 50 class PDFDocTest : public testing::Test { |
51 public: | 51 public: |
52 struct DictObjInfo { | 52 struct DictObjInfo { |
53 uint32_t num; | 53 uint32_t num; |
54 CPDF_Dictionary* obj; | 54 CPDF_Dictionary* obj; |
55 }; | 55 }; |
56 | 56 |
57 void SetUp() override { | 57 void SetUp() override { |
58 // We don't need page module or render module, but | 58 // We don't need page module or render module, but |
59 // initialize them to keep the code sane. | 59 // initialize them to keep the code sane. |
60 CPDF_ModuleMgr::Create(); | |
61 CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get(); | 60 CPDF_ModuleMgr* module_mgr = CPDF_ModuleMgr::Get(); |
62 module_mgr->InitPageModule(); | 61 module_mgr->InitPageModule(); |
63 | 62 |
64 m_pDoc.reset(new CPDF_TestPdfDocument()); | 63 m_pDoc.reset(new CPDF_TestPdfDocument()); |
65 m_pIndirectObjs = m_pDoc->GetHolder(); | 64 m_pIndirectObjs = m_pDoc->GetHolder(); |
66 // Setup the root directory. | 65 // Setup the root directory. |
67 m_pRootObj.reset(new CPDF_Dictionary()); | 66 m_pRootObj.reset(new CPDF_Dictionary()); |
68 m_pDoc->SetRoot(m_pRootObj.get()); | 67 m_pDoc->SetRoot(m_pRootObj.get()); |
69 } | 68 } |
70 | 69 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Title with no match. | 224 // Title with no match. |
226 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = | 225 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = |
227 GetFPDFWideString(L"Chapter 8"); | 226 GetFPDFWideString(L"Chapter 8"); |
228 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); | 227 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); |
229 | 228 |
230 // Title with a match. | 229 // Title with a match. |
231 title = GetFPDFWideString(L"Chapter 3"); | 230 title = GetFPDFWideString(L"Chapter 3"); |
232 EXPECT_EQ(bookmarks[3].obj, FPDFBookmark_Find(m_pDoc.get(), title.get())); | 231 EXPECT_EQ(bookmarks[3].obj, FPDFBookmark_Find(m_pDoc.get(), title.get())); |
233 } | 232 } |
234 } | 233 } |
OLD | NEW |