sw/qa/extras/README                           |    4 -
 sw/qa/extras/odfexport/odfexport.cxx          |   17 ++++--
 sw/qa/extras/odfexport/odfexport2.cxx         |    6 +-
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx      |    5 +
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx    |   12 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx    |   12 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx    |   26 +++++----
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx    |   16 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx     |    7 +-
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx     |   12 +---
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx     |   10 ++-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx     |   70 +++++++++++---------------
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx     |    4 -
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx     |   15 +++--
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   21 ++++---
 sw/qa/unit/swmodeltestbase.cxx                |    3 -
 16 files changed, 124 insertions(+), 116 deletions(-)

New commits:
commit 8953fe0aaebcc5e6aea8eafcf7612f49b4479911
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Nov 8 13:08:05 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Nov 8 14:58:42 2022 +0100

    SwModelTestBase: make clear parseExport only works when exporting
    
    Change-Id: I04d8b170b68479fb5c48e1cdd078baffaee604ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142432
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/README b/sw/qa/extras/README
index efa6071d5b5c..284979d8a90d 100644
--- a/sw/qa/extras/README
+++ b/sw/qa/extras/README
@@ -52,8 +52,8 @@ Another alternative is to assert the resulted export document 
directly.
 Currently this is only implemented for DOCX, which is a zipped XML, so it's
 possible to evaluate XPath checks. A check looks like this:
 
-if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
-    assertXPath(pXmlDoc, <xpath selecting the node>, <attribute>, <value>);
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+assertXPath(pXmlDoc, <xpath selecting the node>, <attribute>, <value>);
 
 It's important to check for the NULL pointer here, it's expected that it'll be
 NULL when the test runs first (after the first import), as there is nothing
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index b1df8b80f0e5..43188e5718f9 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -467,8 +467,9 @@ DECLARE_ODFEXPORT_TEST(testFramebackgrounds, 
"framebackgrounds.odt")
     aGradientxTextFrame = getProperty<awt::Gradient>(xTextFrame, 
"FillTransparenceGradient");
     CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR, 
aGradientxTextFrame.Style);
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
         // check that there are 3 background-image elements
         assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' 
and 
@style:family='graphic']/style:graphic-properties[@draw:fill='bitmap']/style:background-image[@style:repeat='stretch']",
 3);
         // tdf#90640: check that one of them is 55% opaque
@@ -665,8 +666,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf92379)
 //    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), 
getProperty<sal_Int32>(xFrameStyle2, "FillColor"));
 //    CPPUNIT_ASSERT_EQUAL(sal_Int16(100), 
getProperty<sal_Int16>(xFrameStyle2, "FillTransparence"));
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
         // check that fo:background-color attribute is exported properly
         assertXPath(pXmlDoc, "//style:style[@style:family='graphic' and 
@style:name='encarts']/style:graphic-properties[@fo:background-color='#ffcc99']",
 1);
         assertXPath(pXmlDoc, "//style:style[@style:family='graphic' and 
@style:name='Untitled1']/style:graphic-properties[@fo:background-color='transparent']",
 1);
@@ -713,8 +715,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf92379)
 //    CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, 
"FillTransparence"));
     CPPUNIT_ASSERT_EQUAL(Color(0x461900), getProperty<Color>(xStyle32, 
"CharColor"));
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
         // check that fo:background-color attribute is exported properly
         assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and 
@style:display-name='Titre Avis 
expert']/style:paragraph-properties[@fo:background-color='#661900']", 1);
         assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and 
@style:display-name='Avis expert 
questions']/style:paragraph-properties[@fo:background-color='transparent']", 1);
@@ -1190,8 +1193,9 @@ CPPUNIT_TEST_FIXTURE(Test, testProtectionKey)
 
     // we can't assume that the user entered the password; check that we
     // round-trip the password as-is
-    if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
         assertXPath(pXmlDoc, "//text:section[@text:name='Section0' and 
@text:protected='true' and 
@text:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=']");
         assertXPath(pXmlDoc, "//text:section[@text:name='Section1' and 
@text:protected='true' and 
@text:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=']");
         assertXPath(pXmlDoc, "//text:section[@text:name='Section2' and 
@text:protected='true' and 
@text:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256'
 and @text:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=']");
@@ -1404,9 +1408,12 @@ DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, 
"textbox-rounded-corners.odt")
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString());
 
     // Table inside a textbox should be in the extension namespace.
-    if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
+    if (isExported())
+    {
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
         // This failed, as draw:custom-shape had a table:table child.
         assertXPath(pXmlDoc, "//draw:custom-shape/loext:table", "name", 
"Table1");
+    }
 }
 
 // test that import whitespace collapsing is compatible with old docs
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index da301082ed9a..5985463c07cf 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -699,8 +699,9 @@ DECLARE_ODFEXPORT_TEST(testShapeWithHyperlink, 
"shape-with-hyperlink.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
         // Check how conversion from prefix/suffix to list format did work
         assertXPath(pXmlDoc, 
"/office:document-content/office:body/office:text/text:p/draw:a",
                     "href", "http://shape.com/";);
@@ -736,8 +737,9 @@ DECLARE_ODFEXPORT_TEST(testListFormatOdt, "listformat.odt")
     CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.1<<"), 
getProperty<OUString>(getParagraph(3), "ListLabelString"));
     CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.2<<"), 
getProperty<OUString>(getParagraph(4), "ListLabelString"));
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
         // Check how conversion from prefix/suffix to list format did work
         assertXPath(pXmlDoc, 
"/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/"
             "text:list-level-style-number[@text:level='1']", 
"num-list-format", ">%1%<");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index bf3bf059e8fc..2c3debcee302 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -365,11 +365,12 @@ DECLARE_OOXMLEXPORT_TEST(testChartDupe, "chart-dupe.docx")
     // This was 2, on second import we got a duplicated chart copy.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xEmbeddedObjects->getCount());
 
-    xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
 
-    if (!pXmlDocCT)
+    if (!isExported())
        return; // initial import
 
+    xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
+
     assertXPath(pXmlDocCT,
         
"/ContentType:Types/ContentType:Override[@PartName='/word/charts/chart1.xml']",
         "ContentType",
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 67ebd4f569d7..d2cb7cefee14 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1209,9 +1209,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104797, "tdf104797.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf145720, "tdf104797.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End (to keep tracked 
text moving)
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // These were 0 (missing move*FromRange* elements)
         assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", 1);
         assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeEnd", 
1);
@@ -1241,9 +1241,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf145720, "tdf104797.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf150166, "tdf150166.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End (to keep tracked 
text moving)
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         assertXPath(pXmlDoc, "//w:moveFromRangeStart", 0);
         // This was 2 (missing RangeStart elements, but bad unpaired RangeEnds)
         assertXPath(pXmlDoc, "//w:moveFromRangeEnd", 0);
@@ -1262,9 +1262,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150166, "tdf150166.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf143510, "TC-table-DnD-move.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End for tracked table 
move by drag & drop
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // This was 0 (missing tracked table row deletion/insertion)
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 
2);
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:ins", 
2);
@@ -1274,9 +1274,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf143510, 
"TC-table-DnD-move.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf143510_table_from_row, 
"TC-table-Separate-Move.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End for tracked table 
move by drag & drop
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // This was 0 (missing tracked table row deletion/insertion)
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 
1);
         assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl[1]/w:tr[3]/w:trPr/w:del", 1);
@@ -1288,9 +1288,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf143510_table_from_row, 
"TC-table-Separate-Move.d
 DECLARE_OOXMLEXPORT_TEST(testTdf143510_within_table, "TC-table-rowDND.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End for tracked table 
row move by DnD
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // This was 0 (missing tracked table row deletion/insertion)
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:del", 
1);
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:ins", 
1);
@@ -1300,9 +1300,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf143510_within_table, 
"TC-table-rowDND.docx")
 DECLARE_OOXMLEXPORT_TEST(testTdf143510_within_table2, 
"TC-table-rowDND-front.docx")
 {
     // check moveFromRangeStart/End and moveToRangeStart/End for tracked table 
row move by DnD
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // This was 0 (missing tracked table row deletion/insertion)
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:ins", 
1);
         assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:del", 
1);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index b53a2f891892..388b7a6e5b11 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -516,9 +516,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf130610)
 
     // check inline text properties
     {
-        xmlDocUniquePtr pXmlDoc =parseExport("word/document.xml");
-        if (pXmlDoc)
+        if (isExported())
         {
+            xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
             assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:rPr/w:b");
         }
     }
@@ -1469,9 +1469,9 @@ DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap, 
"tdf97618_testVmlShapeTextWor
 DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, 
"tdf97517_testVmlLineShapeMirroredX.docx")
 {
     // tdf#97517 The "flip:x" was not handled for VML line shapes.
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     OUString sStyle = getXPath(pXmlDoc,
         
"/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
         "style");
@@ -1481,9 +1481,9 @@ DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, 
"tdf97517_testVmlLineShapeMi
 DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredY, 
"tdf137678_testVmlLineShapeMirroredY.docx")
 {
     // tdf#137678 The "flip:y" was not handled for VML line shapes.
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     OUString sStyle = getXPath(pXmlDoc,
         
"/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
         "style");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index ef493826439c..19eed0d2efe3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -78,9 +78,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf131801, "tdf131801.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("8."), getXPath(pDump, 
"//page[1]/body/txt[8]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", 
"expand"));
     CPPUNIT_ASSERT_EQUAL(OUString("ffffffff"), getXPath(pDump, 
"//page[1]/body/txt[8]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", 
"font-color"));
 
-    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
-    if (!pXmlDocument)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
 
     assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:rStyle",
         "val", "Emphasis");
@@ -207,9 +207,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116394, "tdf116394.docx")
     // - Actual  : abcd..
     CPPUNIT_ASSERT_EQUAL(OUString("ab=cd.."), 
xEnumerationAccess->getPresentation(true).trim());
 
-    xmlDocUniquePtr pXmlDoc = parseExport();
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport();
     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " 
MERGEFIELD ab=cd ");
 }
 
@@ -359,9 +359,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123355, "tdf123355.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("AVERAGE(<A2:A2>)"), 
xEnumerationAccess5->getPresentation(true).trim());
     CPPUNIT_ASSERT_EQUAL(OUString("4"), 
xEnumerationAccess5->getPresentation(false).trim());
 
-    xmlDocUniquePtr pXmlDoc = parseExport();
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport();
 
     // keep original formula IDs
     assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p/w:r[2]/w:instrText", " =average( 
below )");
@@ -410,9 +410,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123382, "tdf123382.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("MAX(<B2:B4>)"), 
xEnumerationAccess7->getPresentation(true).trim());
     CPPUNIT_ASSERT_EQUAL(OUString("10"), 
xEnumerationAccess7->getPresentation(false).trim());
 
-    xmlDocUniquePtr pXmlDoc = parseExport();
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport();
 
     // keep original formula IDs
     assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:r[2]/w:instrText", " 
=MAX(RIGHT)");
@@ -448,9 +448,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122648, "tdf122648.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("SUM(<A1:B1>)"), 
xEnumerationAccess4->getPresentation(true).trim());
     CPPUNIT_ASSERT_EQUAL(OUString("2"), 
xEnumerationAccess4->getPresentation(false).trim());
 
-    xmlDocUniquePtr pXmlDoc = parseExport();
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport();
 
     assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[2]/w:p/w:r[2]/w:instrText", " =A1");
     assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:tbl[1]/w:tr[2]/w:tc[2]/w:p/w:r[2]/w:instrText", " 
=SUM(A1:B1)");
@@ -849,9 +849,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf136441_commentInFootnote)
 DECLARE_OOXMLEXPORT_TEST(testTdf137683_charHighlightTests, 
"tdf137683_charHighlightTests.docx")
 {
     // Don't export unnecessary w:highlight="none" (Unnecessary one 
intentionally hand-added to original .docx)
-    xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
-    if (pXmlStyles)
+    if (isExported())
+    {
+        xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
         assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Normal']/w:rPr/w:highlight", 0);
+    }
 
     uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(10), 2, "no 
highlight"), uno::UNO_QUERY_THROW);
     // This test was failing with a cyan charHighlight of 65535 (0x00FFFF), 
instead of COL_TRANSPARENT (0xFFFFFFFF)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 63f845908310..9e4506cf6461 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -492,9 +492,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148494)
 
 DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx")
 {
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
        return; // initial import, no further checks
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
     // Ensure that we have <w:placeholder><w:docPart 
v:val="xxxx"/></w:placeholder>
     OUString sDocPart = getXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt/w:sdtPr/w:placeholder/w:docPart", "val");
@@ -665,9 +665,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, 
"tdf123642.docx")
     CPPUNIT_ASSERT(xBookmarksByName->hasByName("Bookmark1"));
 
     // and it is really in exported DOCX (let's ensure)
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
        return; // initial import, no further checks
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
     CPPUNIT_ASSERT_EQUAL(OUString("Bookmark1"), getXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:bookmarkStart[1]", "name"));
 }
@@ -861,9 +861,9 @@ DECLARE_OOXMLEXPORT_TEST(TestTdf73499, "tdf73499.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx")
 {
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
        return; // initial import, no further checks
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
     // Ensure that we have <w:text w:multiLine="1"/>
     CPPUNIT_ASSERT_EQUAL(OUString("1"), getXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:sdt/w:sdtPr/w:text", "multiLine"));
@@ -963,9 +963,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148455_1, 
"tdf148455_1.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf148455_2, "tdf148455_2.docx")
 {
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
        return; // initial import, no further checks
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
     // Find list id for restarted list
     sal_Int32 nListId = getXPath(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:pPr/w:numPr/w:numId", "val").toInt32();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index bd1c93cafedd..f4278a90448f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -173,9 +173,9 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
 
     // Validation test: order of elements were wrong.
-    xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
-    if (!pXmlDoc)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
     // Order was: rsid, next.
     int nNext = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "next");
     int nRsid = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "rsid");
@@ -679,8 +679,9 @@ DECLARE_OOXMLEXPORT_TEST(testFdo64826, "fdo64826.docx")
     // 'Track-Changes' (Track Revisions) wasn't exported.
     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(mxComponent, 
"RecordChanges"));
     // 'Show-Changes' should not be exported - default is true.
-    if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
         assertXPath(pXmlSettings, "/w:settings/w:revisionView", 0);
     }
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index f15b2c1f3ca9..9ae2eb7db31f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -135,11 +135,9 @@ CPPUNIT_TEST_FIXTURE(Test, testCharacterBorder)
         CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
     }
 
-    if (xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"))
-    {
-        // Make sure we write qFormat for custom style names.
-        assertXPath(pXmlStyles, "//w:style[@w:styleId='Heading']/w:qFormat", 
1);
-    }
+    xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
+    // Make sure we write qFormat for custom style names.
+    assertXPath(pXmlStyles, "//w:style[@w:styleId='Heading']/w:qFormat", 1);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testStyleInheritance)
@@ -289,9 +287,9 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
     CPPUNIT_ASSERT_EQUAL(14.f, getProperty<float>(getRun(getParagraphOfText(1, 
xCell->getText()), 1), "CharHeight"));
 
     // This paragraph property was missing in table style.
-    xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
-    if (!pXmlStyles)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
     assertXPath(pXmlStyles, 
"/w:styles/w:style[@w:styleId='Calendar2']/w:pPr/w:jc", "val", "center");
 
     // These run properties were missing
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 01d3992285ee..e4e90ba86655 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -363,9 +363,11 @@ 
DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
     /* fdo73545: Column Break with Column_count = 0 was not getting preserved.
      * The <w:br w:type="column" /> was missing after roundtrip
      */
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (pXmlDoc)
+    if (isExported())
+    {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
+    }
 
     //tdf76349 match Word's behavior of treating breaks in single columns as 
page breaks.
     CPPUNIT_ASSERT_EQUAL(2, getPages());
@@ -489,9 +491,9 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, 
"embedded-xlsx.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(2)->getShapeType());
 
     // check the objects are present in the exported document.xml
-    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
-    if (!pXmlDocument)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
     assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:object", 2);
 
     // finally check the embedded files are present in the zipped document
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index b84571c8e9c5..301a814a04ef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -128,8 +128,9 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79008)
 
 DECLARE_OOXMLEXPORT_TEST(testTdf120852_readOnlyProtection, 
"tdf120852_readOnlyProtection.docx")
 {
-    if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement", "1");
         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", 
"readOnly");
     }
@@ -1152,17 +1153,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf89774)
 CPPUNIT_TEST_FIXTURE(Test, testSectionProtection)
 {
     loadAndReload("sectionprot.odt");
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-    {
-        assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:pPr/w:sectPr/w:formProt", "val", "true");
-        assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:formProt", "val", 
"false");
-    }
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr/w:formProt", 
"val", "true");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:formProt", "val", 
"false");
 
-    if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"))
-    {
-        assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement", "true");
-        assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", 
"forms");
-    }
+    xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
+    assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement", "true");
+    assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", 
"forms");
 
     uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> 
xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
@@ -1176,11 +1173,9 @@ CPPUNIT_TEST_FIXTURE(Test, testSectionProtection2)
 {
     loadAndSave("sectionprot2.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"))
-    {
-        assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement", "true");
-        assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", 
"forms");
-    }
+    xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
+    assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement", "true");
+    assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", 
"forms");
 
     uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> 
xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
@@ -1191,8 +1186,9 @@ CPPUNIT_TEST_FIXTURE(Test, testSectionProtection2)
 DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx")
 {
     // check document permission settings for the whole document
-    if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml");
         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit",  
             "readOnly");
         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"enforcement",        "1");
         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", 
"cryptProviderType",  "rsaAES");
@@ -1273,21 +1269,17 @@ CPPUNIT_TEST_FIXTURE(Test, testSectionHeader)
 {
     loadAndReload("sectionprot.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-    {
-        // this test must not be zero
-        assertXPath(pXmlDoc, "//w:headerReference", 1);
-    }
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    // this test must not be zero
+    assertXPath(pXmlDoc, "//w:headerReference", 1);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf146491)
 {
     loadAndReload("tdf146491.odt");
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-    {
-        // This was 12 - a page style was unnecessarily created for every 
section.
-        assertXPath(pXmlDoc, "//w:footerReference", 1);
-    }
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    // This was 12 - a page style was unnecessarily created for every section.
+    assertXPath(pXmlDoc, "//w:footerReference", 1);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testOO47778_1)
@@ -1295,8 +1287,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO47778_1)
     loadAndReload("ooo47778-3.odt");
     CPPUNIT_ASSERT_EQUAL(5, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPathContent(pXmlDoc, "(//w:t)[3]", "c");
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPathContent(pXmlDoc, "(//w:t)[3]", "c");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testOO47778_2)
@@ -1304,8 +1296,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO47778_2)
     loadAndReload("ooo47778-4.odt");
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPathContent(pXmlDoc, "(//w:t)[4]", "c");
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPathContent(pXmlDoc, "(//w:t)[4]", "c");
 
     // tdf116436: The problem was that the table background was undefined, not 
white.
     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
@@ -1319,8 +1311,8 @@ CPPUNIT_TEST_FIXTURE(Test, testOO67471)
 {
     loadAndReload("ooo67471-2.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPathContent(pXmlDoc, "(//w:t)[2]", "B");
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPathContent(pXmlDoc, "(//w:t)[2]", "B");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testKDE302504)
@@ -1328,8 +1320,8 @@ CPPUNIT_TEST_FIXTURE(Test, testKDE302504)
     loadAndReload("kde302504-1.odt");
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPath(pXmlDoc, "//v:shape", "ID", "KoPathShape");
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPath(pXmlDoc, "//v:shape", "ID", "KoPathShape");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testKDE216114)
@@ -1337,16 +1329,16 @@ CPPUNIT_TEST_FIXTURE(Test, testKDE216114)
     loadAndReload("kde216114-1.odt");
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPath(pXmlDoc, "//w:pict", 1);
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPath(pXmlDoc, "//w:pict", 1);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testOO72950)
 {
     loadAndReload("ooo72950-1.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
-        assertXPath(pXmlDoc, "//w:tbl", 1);
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    assertXPath(pXmlDoc, "//w:tbl", 1);
 }
 
 //There are two tables to export in this doc the second of which is inside a
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index d57f65fa8dec..8483ca27ae91 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -93,9 +93,9 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, 
"dml-textshape.docx")
     // This was drawing::LineStyle_NONE.
     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, 
getProperty<drawing::LineStyle>(xShape, "LineStyle"));
 
-    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
-    if (!pXmlDocument)
+    if (!isExported())
         return;
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
     // This was wrap="none".
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:bodyPr",
 "wrap", "square");
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 66d6e97ce74f..8515be9d50c4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -105,11 +105,14 @@ DECLARE_SW_ROUNDTRIP_TEST(testDocmSave, "hello.docm", 
nullptr, DocmTest)
     // This was
     // 
application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml,
     // we used the wrong content type for .docm files.
-    if (xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"))
+    if (isExported())
+    {
+        xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml");
         assertXPath(pXmlDoc,
                     
"/ContentType:Types/ContentType:Override[@PartName='/word/document.xml']",
                     "ContentType",
                     "application/vnd.ms-word.document.macroEnabled.main+xml");
+    }
 }
 
 DECLARE_SW_ROUNDTRIP_TEST(testBadDocm, "bad.docm", nullptr, DocmTest)
@@ -423,9 +426,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79272_strictDxa, 
"tdf79272_strictDxa.docx")
     uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(4318), 
getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
 
-    xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
-    if (!pXmlDoc)
+    if (!isExported())
          return;
+    xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
     // Validation test: order of elements was wrong. Order was: insideH, end, 
insideV.
     int nEnd = getXPathPosition(pXmlDoc, 
"/w:styles/w:style[@w:styleId='TableGrid']/w:tblPr/w:tblBorders", "end");
     int nInsideH = getXPathPosition(pXmlDoc, 
"/w:styles/w:style[@w:styleId='TableGrid']/w:tblPr/w:tblBorders", "insideH");
@@ -1166,9 +1169,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107684)
 {
     loadAndReload("tdf107684.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"))
-        // This was 1, <w:outlineLvl> was duplicated for Heading1.
-        assertXPath(pXmlDoc, 
"//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1);
+    xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
+    // This was 1, <w:outlineLvl> was duplicated for Heading1.
+    assertXPath(pXmlDoc, 
"//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf107618)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 3e17f449c4fd..fec46ba0bfaa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -483,8 +483,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStart2Sdt)
 
 DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx")
 {
-    if (xmlDocUniquePtr pXmlDoc = parseExport())
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport();
         // Single <w:sdt> was exported as 2 <w:sdt> elements.
         assertXPath(pXmlDoc, "//w:sdt", 1);
         uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
@@ -641,8 +642,9 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, 
"fixed-date-field.docx")
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(7), date.Month);
     CPPUNIT_ASSERT_EQUAL(sal_Int16(2014), date.Year);
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // Previously, fixed fields were exported as static text ("Date 
(fixed)")
         // Check they are now exported correctly as fldChar with fldLock 
attribute
         assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:fldChar", 
"fldLock", "true");
@@ -659,16 +661,16 @@ CPPUNIT_TEST_FIXTURE(Test, testOO34469)
 {
     loadAndReload("ooo34469-1.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport())
-        assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", 
"anchor", "2.9.2.Creating_New_files|outline");
+    xmlDocUniquePtr pXmlDoc = parseExport();
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", 
"2.9.2.Creating_New_files|outline");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testOO39845)
 {
     loadAndReload("ooo39845-7.odt");
     CPPUNIT_ASSERT_EQUAL(1, getPages());
-    if (xmlDocUniquePtr pXmlDoc = parseExport())
-        assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", 
"anchor", "Figure4|graphic");
+    xmlDocUniquePtr pXmlDoc = parseExport();
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", 
"Figure4|graphic");
 }
 
 DECLARE_OOXMLEXPORT_TEST( testTdf85161, "tdf85161.docx" )
@@ -830,8 +832,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142464_ampm, 
"tdf142464_ampm.docx")
     //   - Actual  : 12:32 a12/p12
     CPPUNIT_ASSERT_EQUAL(OUString("12:32 PM"), xField->getPresentation(false));
 
-    if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
+    if (isExported())
     {
+        xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
         // Without the fix in place, this would have failed with:
         //   - Expected:  DATE \@"H:mm\ AM/PM"
         //   - Actual  :  DATE \@"H:mm' a'M'/p'M"
@@ -844,9 +847,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142464_ampm, 
"tdf142464_ampm.docx")
 DECLARE_OOXMLEXPORT_TEST( testSdtDatePicker, "test_sdt_datepicker.docx" )
 {
     // Check that roundtrip for date picker field does not lose essential data
-    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    if (!pXmlDoc)
+    if (!isExported())
        return; // initial import, no further checks
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
     // Placeholder is here
     OUString sDocPart = getXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:sdt/w:sdtPr/w:placeholder/w:docPart", "val");
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 8e422bd3aef0..da7c61274f1c 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -681,9 +681,6 @@ int SwModelTestBase::getShapes() const
 
 xmlDocUniquePtr SwModelTestBase::parseExport(const OUString& rStreamName)
 {
-    if (!mbExported)
-        return nullptr;
-
     std::unique_ptr<SvStream> pStream(parseExportStream(maTempFile.GetURL(), 
rStreamName));
 
     return parseXmlStream(pStream.get());

Reply via email to