| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Objects created will be released by the document. | 80 // Objects created will be released by the document. |
| 81 CPDF_Dictionary* obj = new CPDF_Dictionary(); | 81 CPDF_Dictionary* obj = new CPDF_Dictionary(); |
| 82 info.push_back({m_pIndirectObjs->AddIndirectObject(obj), obj}); | 82 info.push_back({m_pIndirectObjs->AddIndirectObject(obj), obj}); |
| 83 } | 83 } |
| 84 return info; | 84 return info; |
| 85 } | 85 } |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc; | 88 std::unique_ptr<CPDF_TestPdfDocument> m_pDoc; |
| 89 CPDF_IndirectObjectHolder* m_pIndirectObjs; | 89 CPDF_IndirectObjectHolder* m_pIndirectObjs; |
| 90 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pRootObj; | 90 std::unique_ptr<CPDF_Dictionary> m_pRootObj; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 TEST_F(PDFDocTest, FindBookmark) { | 93 TEST_F(PDFDocTest, FindBookmark) { |
| 94 { | 94 { |
| 95 // No bookmark information. | 95 // No bookmark information. |
| 96 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = | 96 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = |
| 97 GetFPDFWideString(L""); | 97 GetFPDFWideString(L""); |
| 98 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); | 98 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); |
| 99 | 99 |
| 100 title = GetFPDFWideString(L"Preface"); | 100 title = GetFPDFWideString(L"Preface"); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Title with no match. | 223 // Title with no match. |
| 224 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = | 224 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = |
| 225 GetFPDFWideString(L"Chapter 8"); | 225 GetFPDFWideString(L"Chapter 8"); |
| 226 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); | 226 EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); |
| 227 | 227 |
| 228 // Title with a match. | 228 // Title with a match. |
| 229 title = GetFPDFWideString(L"Chapter 3"); | 229 title = GetFPDFWideString(L"Chapter 3"); |
| 230 EXPECT_EQ(bookmarks[3].obj, FPDFBookmark_Find(m_pDoc.get(), title.get())); | 230 EXPECT_EQ(bookmarks[3].obj, FPDFBookmark_Find(m_pDoc.get(), title.get())); |
| 231 } | 231 } |
| 232 } | 232 } |
| OLD | NEW |