sw/qa/extras/globalfilter/globalfilter.cxx    |   12 ++--
 sw/qa/extras/mailmerge/mailmerge.cxx          |    4 +
 sw/qa/extras/odfimport/odfimport.cxx          |    1 
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx    |    5 -
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx    |    6 --
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx    |    3 -
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    1 
 sw/qa/extras/uiwriter/uiwriter4.cxx           |   75 +++++++++++---------------
 sw/qa/extras/uiwriter/uiwriter6.cxx           |   44 ++++++---------
 sw/qa/extras/uiwriter/uiwriter7.cxx           |   27 ++-------
 sw/qa/filter/ww8/ww8.cxx                      |    2 
 sw/qa/inc/swmodeltestbase.hxx                 |    2 
 sw/qa/uibase/uiview/uiview.cxx                |    7 --
 sw/qa/unit/swmodeltestbase.cxx                |   17 +----
 14 files changed, 73 insertions(+), 133 deletions(-)

New commits:
commit cf1cd2659f08f7c16a6f32142d424b8df9fab393
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Nov 7 17:57:05 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Nov 8 07:34:25 2022 +0100

    swmodeltestbase: remove duplicated method
    
    save needs to set mbExported to true, otherwise
    parseExport returns nullptr
    Change-Id: I1ba779e0ac0f20663fb722df16210ca144717479
    
    Change-Id: I330abdc72226d5ac7b4d6747bdcc48cedfc9e90f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142400
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index ef58560b49f3..c50e31f499b2 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -978,7 +978,7 @@ void Test::testODF13()
         reload("writer8", nullptr);
 
         // check XML
-        xmlDocUniquePtr pContentXml = parseExportInternal(maTempFile.GetURL(), 
"content.xml");
+        xmlDocUniquePtr pContentXml = parseExport("content.xml");
         assertXPath(pContentXml, 
"/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@style:contextual-spacing='true']");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials",
 0);
@@ -986,7 +986,7 @@ void Test::testODF13()
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start",
 0);
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end",
 0);
-        xmlDocUniquePtr pStylesXml = parseExportInternal(maTempFile.GetURL(), 
"styles.xml");
+        xmlDocUniquePtr pStylesXml = parseExport("styles.xml");
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/style:header-first");
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/loext:header-first",
 0);
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/style:footer-first");
@@ -1011,7 +1011,7 @@ void Test::testODF13()
         xStorable->storeToURL(maTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
 
         // check XML
-        xmlDocUniquePtr pContentXml = parseExportInternal(maTempFile.GetURL(), 
"content.xml");
+        xmlDocUniquePtr pContentXml = parseExport("content.xml");
         assertXPath(pContentXml, 
"/office:document-content/office:automatic-styles/style:style/style:paragraph-properties[@loext:contextual-spacing='true']");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials",
 0);
@@ -1019,7 +1019,7 @@ void Test::testODF13()
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-start",
 0);
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end",
 0);
-        xmlDocUniquePtr pStylesXml = parseExportInternal(maTempFile.GetURL(), 
"styles.xml");
+        xmlDocUniquePtr pStylesXml = parseExport("styles.xml");
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/loext:header-first");
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/style:header-first",
 0);
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/loext:footer-first");
@@ -1043,7 +1043,7 @@ void Test::testODF13()
         save("writer8");
 
         // check XML
-        xmlDocUniquePtr pContentXml = parseExportInternal(maTempFile.GetURL(), 
"content.xml");
+        xmlDocUniquePtr pContentXml = parseExport("content.xml");
         assertXPathNoAttribute(pContentXml, 
"/office:document-content/office:automatic-styles/style:style/style:paragraph-properties",
 "contextual-spacing");
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/meta:creator-initials",
 0);
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:p/office:annotation/loext:sender-initials",
 0);
@@ -1051,7 +1051,7 @@ void Test::testODF13()
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-start",
 0);
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/text:index-entry-link-end",
 0);
         assertXPath(pContentXml, 
"/office:document-content/office:body/office:text/text:illustration-index/text:illustration-index-source/text:illustration-index-entry-template/loext:index-entry-link-end",
 0);
-        xmlDocUniquePtr pStylesXml = parseExportInternal(maTempFile.GetURL(), 
"styles.xml");
+        xmlDocUniquePtr pStylesXml = parseExport("styles.xml");
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/style:header-first",
 0);
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/loext:header-first",
 0);
         assertXPath(pStylesXml, 
"/office:document-styles/office:master-styles/style:master-page/style:footer-first",
 0);
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index b9c8142090d3..9e457b4323a0 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -240,7 +240,9 @@ public:
             return nullptr;
 
         OUString name = msMailMergeOutputPrefix + OUString::number( 0 ) + 
".odt";
-        return parseExportInternal( msMailMergeOutputURL + "/" + name, 
rStreamName );
+        std::unique_ptr<SvStream> 
pStream(parseExportStream(msMailMergeOutputURL + "/" + name, rStreamName));
+
+        return parseXmlStream(pStream.get());
     }
 
     void loadMailMergeDocument( const OUString &filename )
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index a186b2b7b216..8a6a4892f079 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1275,7 +1275,6 @@ CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder)
 
     // Given this document model, when exporting to ODT:
     save("writer8");
-    mbExported = true;
 
     // Then make sure the covered cell has a style.
     xmlDocUniquePtr pXmlSettings = parseExport("content.xml");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index cad9de74fa73..41b580a5f978 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -803,7 +803,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133771)
     // "An uncaught exception of type com.sun.star.io.IOException"
     // exporting to docx
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
     assertXPathContent(pXmlDoc, "//w:body/w:p/w:r/w:t", "Password Protected");
@@ -821,7 +820,6 @@ CPPUNIT_TEST_FIXTURE(Test, testZeroLineSpacing)
 
     // Export to docx.
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
@@ -849,7 +847,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText)
 
     // Export to docx.
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
     double fValue = getXPath(
@@ -894,7 +891,6 @@ CPPUNIT_TEST_FIXTURE(Test, testUserField)
 
     // Export to docx.
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
@@ -947,7 +943,6 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering)
 
     // Export to docx.
     save("Office Open XML Text");
-    mbExported = true;
 
     // Paragraph 2 should have only one w:highlight written per w:rPr. Without 
the fix, there were two.
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 93bd2183404d..3ab402f7ba74 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -265,7 +265,6 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -300,7 +299,6 @@ CPPUNIT_TEST_FIXTURE(Test, testCheckboxContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -349,7 +347,6 @@ CPPUNIT_TEST_FIXTURE(Test, testDropdownContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -390,7 +387,6 @@ CPPUNIT_TEST_FIXTURE(Test, testPictureContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -430,7 +426,6 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -471,7 +466,6 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure that the page edge -> border space is correct:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 805caa65b08e..4197ba133b4f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -97,7 +97,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551_mongolianVert)
     // Such shape must have vert="mongolianVert" again after saving.
     // Without fix the orientation was vert="vert".
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     assertXPath(pXmlDoc, "//wps:bodyPr", "vert", "mongolianVert");
 }
@@ -123,7 +122,6 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberPortionFormatFromODT)
 
     // When saving to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure that the paragraph marker's char format has that custom 
font size:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -148,7 +146,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset)
     // Without fix the insets were tIns="359280" and bIns="539640". The text 
area had 1080Emu height
     // and Word displays no text at all.
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     assertXPathAttrs(pXmlDoc, "//wps:bodyPr", { { "tIns", "179640" }, { 
"bIns", "360000" } });
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index cb191eed4015..59de586a9b1e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -916,7 +916,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104823)
 
     // Save and check saved data
     save("Office Open XML Text");
-    mbExported = true;
     xmlDocUniquePtr pXmlCustomPropsDoc = parseExport("customXml/item1.xml");
     CPPUNIT_ASSERT(pXmlCustomPropsDoc);
     // FIXME: strange it won't run simple /employees/employee/name xpath 
query. Does not like namespaces?
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 5c20cf6c9d9b..8d6dde77420c 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -651,18 +651,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testBookmarkCollapsed)
     save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
-    {
-        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+    xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
 
-        const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
-        CPPUNIT_ASSERT_EQUAL(0, pos1); // found, and it is first
+    const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
-        CPPUNIT_ASSERT_ASSERTION_FAIL(
-            getXPathPosition(pXmlDoc, aPath, "bookmark-start")); // not found
-        CPPUNIT_ASSERT_ASSERTION_FAIL(
-            getXPathPosition(pXmlDoc, aPath, "bookmark-end")); // not found
-    }
+    const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
+    CPPUNIT_ASSERT_EQUAL(0, pos1); // found, and it is first
+
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark-start")); // not found
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark-end")); // not found
 }
 
 // 1. Open a new writer document
@@ -726,17 +723,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkText)
     save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
-    {
-        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+    xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
 
-        CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark")); // not found
-        const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
-        const int pos3 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
+    const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
-        CPPUNIT_ASSERT_EQUAL(0, pos2); // found, and it is first
-        CPPUNIT_ASSERT_EQUAL(1, pos3); // found, and it is second
-    }
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark")); // not found
+    const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
+    const int pos3 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
+
+    CPPUNIT_ASSERT_EQUAL(0, pos2); // found, and it is first
+    CPPUNIT_ASSERT_EQUAL(1, pos3); // found, and it is second
 }
 
 // 1. Open a new writer document
@@ -828,19 +824,18 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkTextAndAddNew)
     save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
-    {
-        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+    xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
 
-        CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark")); // not found
-        const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
-        const int pos3 = getXPathPosition(pXmlDoc, aPath, "text");
-        const int pos4 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
+    const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
-        CPPUNIT_ASSERT_EQUAL(0, pos2);
-        CPPUNIT_ASSERT_EQUAL(1, pos3);
-        CPPUNIT_ASSERT_EQUAL(2, pos4);
-    }
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark")); // not found
+    const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
+    const int pos3 = getXPathPosition(pXmlDoc, aPath, "text");
+    const int pos4 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
+
+    CPPUNIT_ASSERT_EQUAL(0, pos2);
+    CPPUNIT_ASSERT_EQUAL(1, pos3);
+    CPPUNIT_ASSERT_EQUAL(2, pos4);
 }
 
 // 1. Load document:
@@ -893,21 +888,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testRemoveBookmarkTextAndAddNewAfterReload
     save("writer8");
 
     // load only content.xml from the resaved document
-    if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
-    {
-        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+    xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+    const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
-        const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
-        const int pos2 = getXPathPosition(pXmlDoc, aPath, "text");
+    const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
+    const int pos2 = getXPathPosition(pXmlDoc, aPath, "text");
 
-        CPPUNIT_ASSERT_EQUAL(0, pos1);
-        CPPUNIT_ASSERT_EQUAL(1, pos2);
+    CPPUNIT_ASSERT_EQUAL(0, pos1);
+    CPPUNIT_ASSERT_EQUAL(1, pos2);
 
-        CPPUNIT_ASSERT_ASSERTION_FAIL(
-            getXPathPosition(pXmlDoc, aPath, "bookmark-start")); // not found
-        CPPUNIT_ASSERT_ASSERTION_FAIL(
-            getXPathPosition(pXmlDoc, aPath, "bookmark-end")); // not found
-    }
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark-start")); // not found
+    CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, 
"bookmark-end")); // not found
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96961)
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index c49b5b921749..62dee754002b 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1080,9 +1080,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
     OString 
aSettingsBaseXpath("/office:document-settings/office:settings/config:config-item-set");
 
     xmlDocUniquePtr pXmlDoc;
-    uno::Sequence<beans::PropertyValue> aDescriptor;
-    utl::TempFileNamed aTempFile;
-    aTempFile.EnableKillingFile();
 
     // Get document settings
     uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY_THROW);
@@ -1100,18 +1097,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
     // CASE 1 - no font embedding enabled
 
     // Save the document
-    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
-    CPPUNIT_ASSERT(aTempFile.IsValid());
+    save("writer8");
+    CPPUNIT_ASSERT(maTempFile.IsValid());
 
     // Check setting - No font embedding should be enabled
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "settings.xml");
+    pXmlDoc = parseExport("settings.xml");
     CPPUNIT_ASSERT(pXmlDoc);
     assertXPathContent(
         pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", "false");
 
     // Check content - No font-face-src nodes should be present
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml");
+    pXmlDoc = parseExport("content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face", 6);
@@ -1148,11 +1144,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
     xProps->setPropertyValue("EmbedOnlyUsedFonts", uno::Any(false));
 
     // Save the document again
-    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
-    CPPUNIT_ASSERT(aTempFile.IsValid());
+    save("writer8");
+    CPPUNIT_ASSERT(maTempFile.IsValid());
 
     // Check setting - font embedding should be enabled + embed only used 
fonts and scripts
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "settings.xml");
+    pXmlDoc = parseExport("settings.xml");
     CPPUNIT_ASSERT(pXmlDoc);
     assertXPathContent(
         pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", "true");
@@ -1171,7 +1167,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
 
     // Check content - font-face-src should be present only for "Liberation 
Sans" fonts
 
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml");
+    pXmlDoc = parseExport("content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face", 6);
@@ -1211,11 +1207,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
     xProps->setPropertyValue("EmbedComplexScriptFonts", uno::Any(true));
 
     // Save the document again
-    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
-    CPPUNIT_ASSERT(aTempFile.IsValid());
+    save("writer8");
+    CPPUNIT_ASSERT(maTempFile.IsValid());
 
     // Check setting - font embedding should be enabled + embed only used 
fonts and scripts
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "settings.xml");
+    pXmlDoc = parseExport("settings.xml");
     CPPUNIT_ASSERT(pXmlDoc);
     assertXPathContent(
         pXmlDoc, aSettingsBaseXpath + 
"/config:config-item[@config:name='EmbedFonts']", "true");
@@ -1234,7 +1230,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding)
 
     // Check content - font-face-src should be present only for "Liberation 
Sans" fonts
 
-    pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml");
+    pXmlDoc = parseExport("content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
     assertXPath(pXmlDoc, aContentBaseXpath + "/style:font-face", 6);
@@ -1307,17 +1303,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testInconsistentBookmark)
         save("writer8");
 
         // load only content.xml
-        if (xmlDocUniquePtr pXmlDoc = parseExportInternal(maTempFile.GetURL(), 
"content.xml"))
-        {
-            const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
 
-            const int pos1 = getXPathPosition(pXmlDoc, aPath, 
"bookmark-start");
-            const int pos2 = getXPathPosition(pXmlDoc, aPath, "control");
-            const int pos3 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
+        const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
+        const int pos2 = getXPathPosition(pXmlDoc, aPath, "control");
+        const int pos3 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
 
-            CPPUNIT_ASSERT_GREATER(pos1, pos2);
-            CPPUNIT_ASSERT_GREATER(pos2, pos3);
-        }
+        CPPUNIT_ASSERT_GREATER(pos1, pos2);
+        CPPUNIT_ASSERT_GREATER(pos2, pos3);
     }
 }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index b146176a1dd8..3592d99ea230 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -115,17 +115,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testExportToPicture)
     uno::Sequence<beans::PropertyValue> 
aDescriptor(comphelper::InitPropertySequence(
         { { "FilterName", uno::Any(OUString("writer_png_Export")) },
           { "FilterData", uno::Any(aFilterData) } }));
-    utl::TempFileNamed aTempFile;
     uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
-    bool extchk = aTempFile.IsValid();
+    xStorable->storeToURL(maTempFile.GetURL(), aDescriptor);
+    bool extchk = maTempFile.IsValid();
     CPPUNIT_ASSERT_EQUAL(true, extchk);
-    osl::File tmpFile(aTempFile.GetURL());
+    osl::File tmpFile(maTempFile.GetURL());
     tmpFile.open(sal_uInt32(osl_File_OpenFlag_Read));
     sal_uInt64 val;
     CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, tmpFile.getSize(val));
     CPPUNIT_ASSERT(val > 100);
-    aTempFile.EnableKillingFile();
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77340)
@@ -1293,13 +1291,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf74230)
 {
     createSwDoc();
     //exporting the empty document to ODT via TempFile
-    uno::Sequence<beans::PropertyValue> aDescriptor;
-    utl::TempFileNamed aTempFile;
-    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-    xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
-    CPPUNIT_ASSERT(aTempFile.IsValid());
+    save("writer8");
+    CPPUNIT_ASSERT(maTempFile.IsValid());
     //loading an XML DOM of the "styles.xml" of the TempFile
-    xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), 
"styles.xml");
+    xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
     //pXmlDoc should not be null
     CPPUNIT_ASSERT(pXmlDoc);
     //asserting XPath in loaded XML DOM
@@ -1307,8 +1302,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf74230)
                          
"style:graphic-properties[@svg:stroke-color='#3465a4']");
     assertXPath(pXmlDoc, 
"//office:styles/style:default-style[@style:family='graphic']/"
                          
"style:graphic-properties[@draw:fill-color='#729fcf']");
-    //deleting the TempFile
-    aTempFile.EnableKillingFile();
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf80663)
@@ -2766,18 +2759,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149184)
     pWrtShell->ChangeHeaderOrFooter(u"", false, false, false);
 
     // export to simplefooter.doc
-    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-    uno::Sequence<beans::PropertyValue> aStoreProps = 
comphelper::InitPropertySequence({
-        { "FilterName", uno::Any(OUString("MS Word 97")) },
-    });
-    utl::TempFileNamed aTempFile;
-    aTempFile.EnableKillingFile();
 
     // Without the fix in place, the test fails with:
     // [CUT] sw_uiwriter7
     // Segmentation fault (core dumped)
     // [_RUN_____] testTdf149184::TestBody
-    xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+    save("MS Word 97");
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149089)
diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 1279478a69f4..1057939d993d 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -77,7 +77,6 @@ CPPUNIT_TEST_FIXTURE(Test, testPlainTextContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
@@ -99,7 +98,6 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDocxComboBoxContentControlExport)
 
     // When exporting to DOCX:
     save("Office Open XML Text");
-    mbExported = true;
 
     // Then make sure the expected markup is used:
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 028d64ec62d8..3991cb56f511 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -374,8 +374,6 @@ protected:
      */
     xmlDocUniquePtr parseExportedFile();
 
-    xmlDocUniquePtr parseExportInternal(const OUString& url, const OUString& 
rStreamName);
-
     /**
      * Helper method to return nodes represented by rXPath.
      */
diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx
index 35d4d60d7974..4dfae7772b26 100644
--- a/sw/qa/uibase/uiview/uiview.cxx
+++ b/sw/qa/uibase/uiview/uiview.cxx
@@ -138,12 +138,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testKeepRatio)
     CPPUNIT_ASSERT(pViewOption->IsKeepRatio());
 
     // Then export as well:
-    uno::Reference<frame::XStorable2> xStorable(mxComponent, uno::UNO_QUERY);
-    uno::Sequence<beans::PropertyValue> aStoreArgs = {
-        comphelper::makePropertyValue("FilterName", OUString("writer8")),
-    };
-    xStorable->storeToURL(maTempFile.GetURL(), aStoreArgs);
-    mbExported = true;
+    save("writer8");
     xmlDocUniquePtr pXmlDoc = parseExport("settings.xml");
     assertXPathContent(pXmlDoc, 
"//config:config-item[@config:name='KeepRatio']", "true");
 }
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index b1ece8ac05fc..14376aa6af25 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -639,13 +639,13 @@ void SwModelTestBase::save(const OUString& aFilterName)
     {
         validate(maTempFile.GetFileName(), test::ODF);
     }
+    mbExported = true;
 }
 
 void SwModelTestBase::loadAndSave(const char* pName)
 {
     load(pName);
     save(OUString::createFromAscii(mpFilter));
-    mbExported = true;
 }
 
 void SwModelTestBase::loadAndReload(const char* pName)
@@ -684,7 +684,9 @@ xmlDocUniquePtr SwModelTestBase::parseExport(const 
OUString& rStreamName)
     if (!mbExported)
         return nullptr;
 
-    return parseExportInternal(maTempFile.GetURL(), rStreamName);
+    std::unique_ptr<SvStream> pStream(parseExportStream(maTempFile.GetURL(), 
rStreamName));
+
+    return parseXmlStream(pStream.get());
 }
 
 xmlDocUniquePtr SwModelTestBase::parseExportedFile()
@@ -693,17 +695,6 @@ xmlDocUniquePtr SwModelTestBase::parseExportedFile()
     return parseXmlStream(&stream);
 }
 
-xmlDocUniquePtr SwModelTestBase::parseExportInternal(const OUString& url,
-                                                     const OUString& 
rStreamName)
-{
-    std::unique_ptr<SvStream> pStream(parseExportStream(url, rStreamName));
-
-    xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
-    pXmlDoc->name = reinterpret_cast<char*>(xmlStrdup(
-        reinterpret_cast<xmlChar const*>(OUStringToOString(url, 
RTL_TEXTENCODING_UTF8).getStr())));
-    return pXmlDoc;
-}
-
 void SwModelTestBase::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
 {
     // docx

Reply via email to