[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 23 16:51:31 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf133771.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+)

New commits:
commit 91d7c32812a5350633d2acb5e4c524bf5edc5f60
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Oct 21 17:29:01 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Oct 23 18:50:56 2020 +0200

    tdf#133771: sw_ooxmlexport14: Add unittest
    
    Change-Id: Ie2b6ad6dd0b537d59ccd5edb5d699a2b3bbd82ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104636
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit f308520f1e3624c88e2a0e99be2eb26e2f2d0fc4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104681

diff --git a/sw/qa/extras/ooxmlexport/data/tdf133771.odt b/sw/qa/extras/ooxmlexport/data/tdf133771.odt
new file mode 100644
index 000000000000..fd54160af9d1
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133771.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 11499ec87c72..e3f8e6cafc57 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -670,6 +670,28 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testTableStyleConfNested)
     assertXPath(pXmlDoc, "//w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders/w:top", "val", "nil");
 }
 
+CPPUNIT_TEST_FIXTURE(SwModelTestBase, testTdf133771)
+{
+    // Create the doc model.
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf133771.odt";
+    loadURL(aURL, nullptr, /*pPassword*/ "test");
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Password Protected"), getParagraph(1)->getString());
+
+    // Without the fix in place, this test would have failed with
+    // "An uncaught exception of type com.sun.star.io.IOException"
+    // exporting to docx
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    utl::MediaDescriptor aMediaDescriptor;
+    aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text");
+    xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+    validate(maTempFile.GetFileName(), test::OOXML);
+    mbExported = true;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPathContent(pXmlDoc, "//w:body/w:p/w:r/w:t", "Password Protected");
+}
+
 CPPUNIT_TEST_FIXTURE(SwModelTestBase, testZeroLineSpacing)
 {
     // Create the doc model.


More information about the Libreoffice-commits mailing list