[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - xmlsecurity/qa

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 4 14:58:06 UTC 2020


 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit f3babc0adedc4ed304f047ab5dcbfb34a9a3505c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 4 12:58:20 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 4 15:57:03 2020 +0100

    disable tests that don't work without pdfium
    
    we're probably past the end of the road on --disable-pdfium
    
    Change-Id: Id91ea6c77bbdb3ecf609a7ffd16a278eb3b17e91
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107207
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 283223b9c409..f6bdfce9c050 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -8,6 +8,7 @@
  */
 
 #include <sal/config.h>
+#include <config_features.h>
 
 #include <string_view>
 
@@ -85,7 +86,12 @@ std::vector<SignatureInformation> PDFSigningTest::verify(const OUString& rURL, s
     SvFileStream aStream(rURL, StreamMode::READ);
     PDFSignatureHelper aHelper;
     CPPUNIT_ASSERT(aHelper.ReadAndVerifySignatureSvStream(aStream));
+
+#if HAVE_FEATURE_PDFIUM
     CPPUNIT_ASSERT_EQUAL(nCount, aHelper.GetSignatureInformations().size());
+#else
+    (void)nCount;
+#endif
     for (size_t i = 0; i < aHelper.GetSignatureInformations().size(); ++i)
     {
         const SignatureInformation& rInfo = aHelper.GetSignatureInformations()[i];
@@ -161,6 +167,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL,
     return bSignSuccessful;
 }
 
+#if HAVE_FEATURE_PDFIUM
 /// Test adding a new signature to a previously unsigned file.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd)
 {
@@ -184,6 +191,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd)
         CPPUNIT_ASSERT_EQUAL(xml::crypto::DigestID::SHA256, aInfos[0].nDigestID);
     }
 }
+#endif
 
 /// Test signing a previously unsigned file twice.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd2)
@@ -205,6 +213,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd2)
         sign(aInURL, aOutURL, 1);
 }
 
+#if HAVE_FEATURE_PDFIUM
 /// Test removing a signature from a previously signed file.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemove)
 {
@@ -283,6 +292,8 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll)
     CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), rInformations.size());
 }
 
+#endif
+
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTdf107782)
 {
     uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
@@ -305,6 +316,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTdf107782)
         aManager.getSecurityEnvironment());
 }
 
+#if HAVE_FEATURE_PDFIUM
 /// Test a PDF 1.4 document, signed by Adobe.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDF14Adobe)
 {
@@ -316,6 +328,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDF14Adobe)
     // This was 0, out-of-PKCS#7 signature date wasn't read.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2016), aInfos[1].stDateTime.Year);
 }
+#endif
 
 /// Test a PDF 1.6 document, signed by Adobe.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDF16Adobe)
@@ -359,6 +372,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDF14LOWin)
     verify(m_directories.getURLFromSrc(DATA_DIRECTORY) + "pdf14lowin.pdf", 1);
 }
 
+#if HAVE_FEATURE_PDFIUM
 /// Test a PAdES document, signed by LO on Linux.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFPAdESGood)
 {
@@ -458,6 +472,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testGood)
                              static_cast<int>(rInformation.nStatus));
     }
 }
+#endif
 
 /// Test that we don't crash / loop while tokenizing these files.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTokenize)
@@ -490,6 +505,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTokenize)
             CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aDocument.GetPages().size());
     }
 }
+#if HAVE_FEATURE_PDFIUM
 
 /// Test handling of unknown SubFilter values.
 CPPUNIT_TEST_FIXTURE(PDFSigningTest, testUnknownSubFilter)
@@ -533,6 +549,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testGoodCustomMagic)
     std::vector<SignatureInformation>& rInformations = aManager.getCurrentSignatureInformations();
     CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), rInformations.size());
 }
+#endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list