sw/qa/core/header_footer/HeaderFooterTest.cxx |   21 +++-----
 sw/qa/extras/htmlexport/htmlexport.cxx        |   62 ++++++++++++--------------
 sw/qa/inc/swmodeltestbase.hxx                 |    5 --
 sw/qa/unit/swmodeltestbase.cxx                |    8 ---
 4 files changed, 39 insertions(+), 57 deletions(-)

New commits:
commit 3889920c386ff208e9aed5c1a62355a730a6a22d
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Oct 16 14:41:31 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Oct 16 17:45:08 2024 +0200

    SwModelTestBase: drop isExported
    
    Change-Id: I4eb169909abff3eba935e4ad5ff7875b1b122953
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175019
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index 040343005e6e..af4e388dff2f 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -461,24 +461,21 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testContSectBreakHeaderFooter)
         // - Expected: Header, section 2
         // - Actual  : First page header, section 2
         // i.e. both the header and the footer on page 3 was wrong.
-
-        // Additional problem: top margin on page 3 was wrong.
-        if (isExported())
-        {
-            xmlDocUniquePtr pXml = parseExport(u"word/document.xml"_ustr);
-            // Without the accompanying fix in place, this test would have 
failed with:
-            // - Expected: 2200
-            // - Actual  : 2574
-            // i.e. the top margin on page 3 was too large and now matches the 
value from the input
-            // document.
-            assertXPath(pXml, "/w:document/w:body/w:sectPr/w:pgMar", "top", 
u"2200");
-        }
     };
 
     createSwDoc("cont-sect-break-header-footer.docx");
     verify();
     saveAndReload(u"Office Open XML Text"_ustr);
     verify();
+
+    // Additional problem: top margin on page 3 was wrong.
+    xmlDocUniquePtr pXml = parseExport(u"word/document.xml"_ustr);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 2200
+    // - Actual  : 2574
+    // i.e. the top margin on page 3 was too large and now matches the value 
from the input
+    // document.
+    assertXPath(pXml, "/w:document/w:body/w:sectPr/w:pgMar", "top", u"2200");
 }
 
 CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf145998_firstHeader)
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index c801903c8769..132c6e7fcbbf 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -749,17 +749,8 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOleImg)
         // Check alternate text (it was empty, for export the 'alt' attribute 
was used).
         CPPUNIT_ASSERT_EQUAL(u"OLE Object"_ustr,
                              getProperty<OUString>(xObject, 
u"Title"_ustr).trim());
-
-        if (!isExported())
-            return;
-
-        // "type" attribute was missing for the inner <object> element.
-        SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
-        CPPUNIT_ASSERT(pStream);
-        sal_uInt64 nLength = pStream->TellEnd();
-        OString aStream(read_uInt8s_ToOString(*pStream, nLength));
-        CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1);
     };
+
     setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr);
     setImportFilterName(u"HTML (StarWriter)"_ustr);
     createSwDoc("reqif-ole-img.xhtml");
@@ -767,6 +758,13 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOleImg)
     setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr);
     saveAndReload(mpFilter);
     verify();
+
+    // "type" attribute was missing for the inner <object> element.
+    SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+    CPPUNIT_ASSERT(pStream);
+    sal_uInt64 nLength = pStream->TellEnd();
+    OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+    CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1);
 }
 
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfPngImg)
@@ -953,30 +951,8 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOle2)
         // Finally the export also failed as it tried to open the stream from 
the
         // document storage, but the embedded object already opened it, so an
         // exception of type com.sun.star.io.IOException was thrown.
-
-        if (isExported())
-        {
-            // Check that the replacement graphic is exported at RTF level.
-            xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
-            // Get the path of the RTF data.
-            OUString aOlePath = getXPath(
-                pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
-            OUString aOleSuffix(u".ole"_ustr);
-            CPPUNIT_ASSERT(aOlePath.endsWith(aOleSuffix));
-            INetURLObject aUrl(maTempFile.GetURL());
-            aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - 
aOleSuffix.getLength()));
-            aUrl.setExtension(u"ole");
-            OUString aOleUrl = 
aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
-
-            // Search for  esult in the RTF data.
-            SvFileStream aOleStream(aOleUrl, StreamMode::READ);
-            CPPUNIT_ASSERT(aOleStream.IsOpen());
-            OString aOleString(read_uInt8s_ToOString(aOleStream, 
aOleStream.TellEnd()));
-            // Without the accompanying fix in place, this test would have 
failed,
-            // replacement graphic was missing at RTF level.
-            CPPUNIT_ASSERT(aOleString.indexOf(OOO_STRING_SVTOOLS_RTF_RESULT) 
!= -1);
-        }
     };
+
     setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr);
     setImportFilterName(u"HTML (StarWriter)"_ustr);
     createSwDoc("reqif-ole2.xhtml");
@@ -984,6 +960,26 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOle2)
     setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr);
     saveAndReload(mpFilter);
     verify();
+
+    // Check that the replacement graphic is exported at RTF level.
+    xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
+    // Get the path of the RTF data.
+    OUString aOlePath = getXPath(
+        pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
+    OUString aOleSuffix(u".ole"_ustr);
+    CPPUNIT_ASSERT(aOlePath.endsWith(aOleSuffix));
+    INetURLObject aUrl(maTempFile.GetURL());
+    aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - 
aOleSuffix.getLength()));
+    aUrl.setExtension(u"ole");
+    OUString aOleUrl = aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+
+    // Search for  esult in the RTF data.
+    SvFileStream aOleStream(aOleUrl, StreamMode::READ);
+    CPPUNIT_ASSERT(aOleStream.IsOpen());
+    OString aOleString(read_uInt8s_ToOString(aOleStream, 
aOleStream.TellEnd()));
+    // Without the accompanying fix in place, this test would have failed,
+    // replacement graphic was missing at RTF level.
+    CPPUNIT_ASSERT(aOleString.indexOf(OOO_STRING_SVTOOLS_RTF_RESULT) != -1);
 }
 
 CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfOle2Odg)
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 765e72002001..71f9ebf0438c 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -85,9 +85,6 @@ public:
 /// Base class for filter tests loading or roundtripping a document, then 
asserting the document model.
 class SWQAHELPER_DLLPUBLIC SwModelTestBase : public UnoApiXmlTest
 {
-private:
-    bool mbExported; ///< Does maTempFile already contain something useful?
-
 protected:
     xmlBufferPtr mpXmlBuffer;
     OUString mpFilter;
@@ -269,8 +266,6 @@ protected:
      */
     xmlDocUniquePtr WrapReqifFromTempFile();
 
-    bool isExported(){ return mbExported; }
-
     void emulateTyping(SwXTextDocument& rTextDoc, const std::u16string_view& 
rStr);
 
 private:
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index babaf0a3cdf3..791d0ad781e7 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -57,7 +57,6 @@ void SwModelTestBase::paste(std::u16string_view aFilename, 
OUString aInstance,
 
 SwModelTestBase::SwModelTestBase(const OUString& pTestDocumentPath, const 
OUString& pFilter)
     : UnoApiXmlTest(pTestDocumentPath)
-    , mbExported(false)
     , mpXmlBuffer(nullptr)
     , mpFilter(pFilter)
 {
@@ -391,10 +390,7 @@ void SwModelTestBase::header() {}
 void SwModelTestBase::loadURL(OUString const& rURL, const char* pPassword)
 {
     // Output name at load time, so in the case of a hang, the name of the 
hanging input file is visible.
-    if (!isExported())
-    {
-        std::cout << rURL << ":
";
-    }
+    std::cout << rURL << ":
";
 
     UnoApiXmlTest::load(rURL, pPassword);
 
@@ -406,7 +402,6 @@ void SwModelTestBase::loadURL(OUString const& rURL, const 
char* pPassword)
 void SwModelTestBase::saveAndReload(const OUString& pFilter, const char* 
pPassword)
 {
     save(pFilter, pPassword);
-    mbExported = true;
 
     loadURL(maTempFile.GetURL(), pPassword);
 }
@@ -415,7 +410,6 @@ void SwModelTestBase::loadAndSave(const char* pName, const 
char* pPassword)
 {
     loadURL(createFileURL(OUString::createFromAscii(pName)), pPassword);
     save(mpFilter);
-    mbExported = true;
 }
 
 void SwModelTestBase::loadAndReload(const char* pName)

Reply via email to