diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-08-15 15:55:44 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-08-15 16:24:15 +0200 |
commit | 2ca75d4133e2388b67d09a9d88969cd20dc68f26 (patch) | |
tree | 72cd3631c9aa7cfb90df40e60cb9022f05174174 /xmlsecurity/qa/unit | |
parent | 1faf46589626f7e21db4b421a9b5e804fb520630 (diff) |
Fix the test failing when invalid certificate is in cert store
testPDFAddVisibleSignature was failing for me locally because of
an expired certificate present in my store.
Change-Id: I03243f6707b1b5ca94ea87e9f8c809dd47b6a93a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171901
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmlsecurity/qa/unit')
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 25da7b3eb334..038bf78ce193 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -747,23 +747,23 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) uno::Reference<view::XSelectionSupplier> xSelectionSupplier(pBaseModel->getCurrentController(), uno::UNO_QUERY); xSelectionSupplier->select(uno::Any(xShape)); - uno::Sequence<uno::Reference<security::XCertificate>> aCertificates - = mxSecurityContext->getSecurityEnvironment()->getPersonalCertificates(); - if (!aCertificates.hasElements()) + auto xEnv = mxSecurityContext->getSecurityEnvironment(); + auto xCert = GetValidCertificate(xEnv->getPersonalCertificates(), xEnv); + if (!xCert) { return; } SfxViewShell* pCurrent = SfxViewShell::Current(); CPPUNIT_ASSERT(pCurrent); SdrView* pView = pCurrent->GetDrawView(); - svx::SignatureLineHelper::setShapeCertificate(pView, aCertificates[0]); + svx::SignatureLineHelper::setShapeCertificate(pView, xCert); // the document is modified now, but Sign function can't show SaveAs dialog // in unit test, so just clear the modified pObjectShell->SetModified(false); // When: do the actual signing. - pObjectShell->SignDocumentContentUsingCertificate(aCertificates[0]); + pObjectShell->SignDocumentContentUsingCertificate(xCert); // Then: count the # of shapes on the signature widget/annotation. std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(); |