[Libreoffice-commits] core.git: vcl/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 1 07:09:51 UTC 2020


 vcl/qa/cppunit/filter/ipdf/ipdf.cxx |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 4722a7b376946a0540f7dd95cdbacf8a0507860d
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Sep 30 21:02:44 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Oct 1 09:09:11 2020 +0200

    CppunitTest_vcl_filter_ipdf: use vcl::pdf::PDFiumDocument
    
    Instead of the upstream scopers, to standardize on a single set of
    pdfium wrappers.
    
    Change-Id: I50c0301629f8b09286d43063ad11b4d70a50c4c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103732
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
index 5d44cf9bbef2..96fd331ceb76 100644
--- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
+++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
@@ -10,10 +10,6 @@
 #include <test/bootstrapfixture.hxx>
 #include <unotest/macros_test.hxx>
 
-#include <prewin.h>
-#include <cpp/fpdf_scopers.h>
-#include <postwin.h>
-
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/drawing/XDrawView.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
@@ -132,16 +128,16 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testPDFAddVisibleSignatureLastPage)
     SvMemoryStream aMemory;
     aMemory.WriteStream(aFile);
     // Last page.
-    ScopedFPDFDocument pPdfDocument(
-        FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
-    ScopedFPDFPage pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1));
+    std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+        = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize());
+    std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/1);
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected: 1
     // - Actual  : 0
     // i.e. the signature was there, but it was on the first page.
-    CPPUNIT_ASSERT_EQUAL(1, FPDFPage_GetAnnotCount(pPdfPage.get()));
-    ScopedFPDFAnnotation pAnnot(FPDFPage_GetAnnot(pPdfPage.get(), 0));
-    CPPUNIT_ASSERT_EQUAL(4, FPDFAnnot_GetObjectCount(pAnnot.get()));
+    CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount());
+    std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0);
+    CPPUNIT_ASSERT_EQUAL(4, pAnnot->getObjectCount());
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list