summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-10-16 14:41:31 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-10-16 17:45:08 +0200
commit3889920c386ff208e9aed5c1a62355a730a6a22d (patch)
tree3645777f4b36a90a23b83eb0965096c35fc83a5a /sw
parentbb6db3aa4c86b92e8321d6734bcb34ba28dfeb27 (diff)
SwModelTestBase: drop isExported
Change-Id: I4eb169909abff3eba935e4ad5ff7875b1b122953 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175019 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/header_footer/HeaderFooterTest.cxx21
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx62
-rw-r--r--sw/qa/inc/swmodeltestbase.hxx5
-rw-r--r--sw/qa/unit/swmodeltestbase.cxx8
4 files changed, 39 insertions, 57 deletions
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 \result 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 \result 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 << ":\n";
- }
+ std::cout << rURL << ":\n";
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)