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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 5 07:56:25 UTC 2021


 xmlsecurity/qa/unit/signing/signing.cxx |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit a04dde6b9c6d625ac80acbad1e599dbd8edf3579
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Mar 4 20:45:24 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Mar 5 08:55:49 2021 +0100

    CppunitTest_xmlsecurity_signing: run all tests in the disable-pdfium case
    
    Return early in case pdfium is not available, to avoid the ifdef forest.
    
    Change-Id: Ifdf71eb01437e4257679c9be7a25de9a3133a660
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111978
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index cfe9c749cff0..5908f9059ffc 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -54,11 +54,6 @@
 #include <comphelper/propertyvalue.hxx>
 #include <vcl/filter/PDFiumLibrary.hxx>
 
-#if HAVE_FEATURE_PDFIUM
-#include <fpdf_annot.h>
-#include <fpdfview.h>
-#endif
-
 using namespace com::sun::star;
 
 namespace
@@ -619,9 +614,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFNo)
                          static_cast<int>(pObjectShell->GetDocumentSignatureState()));
 }
 
-#if HAVE_FEATURE_PDFIUM
 CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature)
 {
+    std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+    if (!pPDFium)
+    {
+        return;
+    }
+
     // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
     // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
     if (!IsDefaultDPI())
@@ -670,7 +670,6 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature)
     pObjectShell->SignDocumentContentUsingCertificate(aCertificates[0]);
 
     // Then: count the # of shapes on the signature widget/annotation.
-    std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
     SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ);
     SvMemoryStream aMemory;
     aMemory.WriteStream(aFile);
@@ -685,7 +684,6 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature)
     // i.e. the signature was there, but it was empty / not visible.
     CPPUNIT_ASSERT_EQUAL(4, pAnnot->getObjectCount());
 }
-#endif
 
 #endif
 


More information about the Libreoffice-commits mailing list