summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_catalog_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_catalog_unittest.cpp')
-rw-r--r--fpdfsdk/fpdf_catalog_unittest.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/fpdfsdk/fpdf_catalog_unittest.cpp b/fpdfsdk/fpdf_catalog_unittest.cpp
index 648cb24e7a..54eb4f77a0 100644
--- a/fpdfsdk/fpdf_catalog_unittest.cpp
+++ b/fpdfsdk/fpdf_catalog_unittest.cpp
@@ -12,6 +12,7 @@
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
+#include "public/cpp/fpdf_scopers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
@@ -29,31 +30,12 @@ class CPDF_TestDocument : public CPDF_Document {
}
};
-#ifdef PDF_ENABLE_XFA
-class CPDF_TestXFAContext : public CPDFXFA_Context {
- public:
- CPDF_TestXFAContext()
- : CPDFXFA_Context(pdfium::MakeUnique<CPDF_TestDocument>()) {}
-
- void SetRoot(CPDF_Dictionary* root) {
- static_cast<CPDF_TestDocument*>(GetPDFDoc())->SetRoot(root);
- }
-
- CPDF_IndirectObjectHolder* GetHolder() { return GetPDFDoc(); }
-};
-using CPDF_TestPdfDocument = CPDF_TestXFAContext;
-#else // PDF_ENABLE_XFA
-using CPDF_TestPdfDocument = CPDF_TestDocument;
-#endif // PDF_ENABLE_XFA
-
class PDFCatalogTest : public testing::Test {
public:
void SetUp() override {
CPDF_ModuleMgr::Get()->Init();
-
- m_pDoc = pdfium::MakeUnique<CPDF_TestPdfDocument>();
-
- // Setup the root directory.
+ auto pTestDoc = pdfium::MakeUnique<CPDF_TestDocument>();
+ m_pDoc.reset(FPDFDocumentFromCPDFDocument(pTestDoc.release()));
m_pRootObj = pdfium::MakeUnique<CPDF_Dictionary>();
}
@@ -63,7 +45,7 @@ class PDFCatalogTest : public testing::Test {
}
protected:
- std::unique_ptr<CPDF_TestPdfDocument> m_pDoc;
+ ScopedFPDFDocument m_pDoc;
std::unique_ptr<CPDF_Dictionary> m_pRootObj;
};
@@ -71,12 +53,15 @@ TEST_F(PDFCatalogTest, IsTagged) {
// Null doc
EXPECT_FALSE(FPDFCatalog_IsTagged(nullptr));
+ CPDF_TestDocument* pTestDoc = static_cast<CPDF_TestDocument*>(
+ CPDFDocumentFromFPDFDocument(m_pDoc.get()));
+
// No root
- m_pDoc->SetRoot(nullptr);
+ pTestDoc->SetRoot(nullptr);
EXPECT_FALSE(FPDFCatalog_IsTagged(m_pDoc.get()));
// Empty root
- m_pDoc->SetRoot(m_pRootObj.get());
+ pTestDoc->SetRoot(m_pRootObj.get());
EXPECT_FALSE(FPDFCatalog_IsTagged(m_pDoc.get()));
// Root with other key