summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-25 20:54:21 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-26 12:22:02 +0100
commite04e32b6c66e59f7cf57ed38ac3a730f68eed4b7 (patch)
tree5bf53159a685f3332868d03cc8461ed700cd0355 /xmlsecurity
parentf25d5cd3d814d59aabab889b0fd6526cee3e57be (diff)
pdfium: don't build PDFiumLibrary when PDFium is disabled
Rather provide a stub implementation of PDFiumLibrary::get(), so other code can call it unconditionally. This is meant to allow removing the 10 stub functions in VectorGraphicSearch later. Also fix up CppunitTest_xmlsecurity_signing to pass in the disable-pdfium case by avoiding the known-problematic checks. Change-Id: I748fcc5c623c5ce937bd2980bfdfaadbdf6cedf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111564 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index 3a784dd9e0fd..a76b14252a21 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -304,6 +304,12 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF)
// Read back the signature and make sure that it's valid.
aManager.read(/*bUseTempStream=*/false);
std::vector<SignatureInformation>& rInformations = aManager.getCurrentSignatureInformations();
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ {
+ return;
+ }
+
CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), rInformations.size());
// This was SecurityOperationStatus_UNKNOWN, signing with an ECDSA key was
// broken.
@@ -550,6 +556,12 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFGood)
CPPUNIT_ASSERT(pObjectShell);
// We expect NOTVALIDATED in case the root CA is not imported on the system, and OK otherwise, so accept both.
SignatureState nActual = pObjectShell->GetDocumentSignatureState();
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ {
+ return;
+ }
+
CPPUNIT_ASSERT_MESSAGE(
(OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
(nActual == SignatureState::NOTVALIDATED || nActual == SignatureState::OK));
@@ -563,6 +575,12 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFBad)
CPPUNIT_ASSERT(pBaseModel);
SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell();
CPPUNIT_ASSERT(pObjectShell);
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ {
+ return;
+ }
+
CPPUNIT_ASSERT_EQUAL(static_cast<int>(SignatureState::BROKEN),
static_cast<int>(pObjectShell->GetDocumentSignatureState()));
}
@@ -575,6 +593,12 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFHideAndReplace)
CPPUNIT_ASSERT(pBaseModel);
SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell();
CPPUNIT_ASSERT(pObjectShell);
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ {
+ return;
+ }
+
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 2 (BROKEN)
// - Actual : 6 (NOTVALIDATED_PARTIAL_OK)