diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-09-29 21:02:39 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-09-30 08:25:22 +0200 |
commit | 9a2357c0e2bb1d99a1816437d3862b7bd8c85898 (patch) | |
tree | 2aa3f80243e34e62a98d22e7d6f8a0c929aa28c1 /xmlsecurity | |
parent | 0311006ec9cdf76f6863c203658cebf88e135a6c (diff) |
vcl: add PDFiumAnnotation::getObjectCount()
And use it in xmlsecurity, instead of the upstream scopers, to
standardize on a single set of pdfium wrappers.
Change-Id: Iec4baf34a607b23f1b9de8c4b969801c5973c1ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103636
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 6f9d05b4651a..513ebcce6009 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -57,7 +57,6 @@ #if HAVE_FEATURE_PDFIUM #include <fpdf_annot.h> #include <fpdfview.h> -#include <cpp/fpdf_scopers.h> #endif using namespace com::sun::star; @@ -647,16 +646,16 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ); SvMemoryStream aMemory; aMemory.WriteStream(aFile); - ScopedFPDFDocument pPdfDocument( - FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - ScopedFPDFPage pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT_EQUAL(1, FPDFPage_GetAnnotCount(pPdfPage.get())); - ScopedFPDFAnnotation pAnnot(FPDFPage_GetAnnot(pPdfPage.get(), 0)); + std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument + = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize()); + std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); + CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount()); + std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(/*nIndex=*/0); // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 // - Actual : 0 // i.e. the signature was there, but it was empty / not visible. - CPPUNIT_ASSERT_EQUAL(4, FPDFAnnot_GetObjectCount(pAnnot.get())); + CPPUNIT_ASSERT_EQUAL(4, pAnnot->getObjectCount()); } #endif |