xmlsecurity/qa/unit/signing/signing.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit f0fe182b75260966a4da5a2e354779c1276d1697
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Wed Jan 15 18:33:50 2025 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Jan 15 18:41:43 2025 +0100

    Fixup "add unit test with docx that can only be opened with repair"
    
    Change-Id: I9443fec3bcf34c9b9502137f83f2b1515ed7b90a

diff --git a/xmlsecurity/qa/unit/signing/signing.cxx 
b/xmlsecurity/qa/unit/signing/signing.cxx
index 770c5450631f..701f74f1c368 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -123,6 +123,7 @@ public:
     void testXAdES();
     /// Works with an existing good XAdES signature.
     void testXAdESGood();
+    void testInvalidZIP();
 
     CPPUNIT_TEST_SUITE(SigningTest);
     CPPUNIT_TEST(testDescription);
@@ -154,6 +155,7 @@ public:
     CPPUNIT_TEST(testXAdESNotype);
     CPPUNIT_TEST(testXAdES);
     CPPUNIT_TEST(testXAdESGood);
+    CPPUNIT_TEST(testInvalidZIP);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -910,7 +912,7 @@ void SigningTest::testXAdESGood()
          || nActual == SignatureState::OK));
 }
 
-CPPUNIT_TEST_FIXTURE(SigningTest, testInvalidZIP)
+void SigningTest::testInvalidZIP()
 {
 // set RepairPackage via interaction handler, same as soffice does
 // - if it's passed to load the behavior is different, oddly enough.
commit a46743b8e6fb22e560a576d29fa1fb36f06bbe49
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Mar 28 16:57:02 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Jan 15 18:41:43 2025 +0100

    Copy test doc to temp location before opening read/write
    
    ...otherwise fails if SRCDIR is a read-only tree
    
    Change-Id: I0b81be5ba055dac133e5ee638f21c3c5f4d5736b
    Reviewed-on: https://gerrit.libreoffice.org/52015
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/xmlsecurity/qa/unit/signing/signing.cxx 
b/xmlsecurity/qa/unit/signing/signing.cxx
index 9716d67b58ea..770c5450631f 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -353,7 +353,12 @@ void SigningTest::testOOXMLRemove()
     // Load the test document as a storage and read its signatures: purpose1 
and purpose2.
     DocumentSignatureManager aManager(mxComponentContext, 
DocumentSignatureMode::Content);
     CPPUNIT_ASSERT(aManager.init());
-    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "multi.docx";
+    utl::TempFile aTempFile;
+    aTempFile.EnableKillingFile();
+    OUString aURL = aTempFile.GetURL();
+    CPPUNIT_ASSERT_EQUAL(
+        osl::File::RC::E_None,
+        osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"multi.docx", aURL));
     uno::Reference <embed::XStorage> xStorage = 
comphelper::OStorageHelper::GetStorageOfFormatFromURL(ZIP_STORAGE_FORMAT_STRING,
 aURL, embed::ElementModes::READWRITE);
     CPPUNIT_ASSERT(xStorage.is());
     aManager.mxStore = xStorage;

Reply via email to