summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-02-13 14:35:33 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-02-13 16:10:03 +0100
commitac2949ddaf78a95ab53d5d5f862b791d2c2d4312 (patch)
tree9d8e8cde1a9c175c63499b602c84886fa1b72499 /sw
parent5b3c89570eb2d5a5f5069d30f1d9fee352db974e (diff)
UnoApiXmlTest: factor out common code
Change-Id: I5c7f76b61a0dab8b4ebd1ac4680a7c25f982680c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163307 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/fodfexport/fodfexport.cxx36
-rw-r--r--sw/qa/inc/swmodeltestbase.hxx7
-rw-r--r--sw/qa/unit/swmodeltestbase.cxx6
3 files changed, 20 insertions, 29 deletions
diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx
index 4d4ff5f0b047..eefb35c6395e 100644
--- a/sw/qa/extras/fodfexport/fodfexport.cxx
+++ b/sw/qa/extras/fodfexport/fodfexport.cxx
@@ -22,34 +22,38 @@ public:
}
};
-DECLARE_FODFEXPORT_TEST(testTdf113696, "tdf113696.odt")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113696)
{
+ loadFromFile(u"tdf113696.odt");
+
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ save("OpenDocument Text Flat XML");
// Test that an image which is written in svm format (image/x-vclgraphic)
// is accompanied by a png fallback graphic.
- if (xmlDocUniquePtr pXmlDoc = parseExportedFile())
- {
- assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
- "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr);
- assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
- "draw:image[@draw:mime-type='image/png']"_ostr);
- }
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
+ "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr);
+ assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
+ "draw:image[@draw:mime-type='image/png']"_ostr);
}
-DECLARE_FODFEXPORT_TEST(testTdf113696WriterImage, "tdf113696-writerimage.odt")
+CPPUNIT_TEST_FIXTURE(Test, testTdf113696WriterImage)
{
+ loadFromFile(u"tdf113696-writerimage.odt");
+
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ save("OpenDocument Text Flat XML");
// Same as testTdf113696, but with a writer image instead of a draw image
// (they use different code paths).
- if (xmlDocUniquePtr pXmlDoc = parseExportedFile())
- {
- assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
- "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr);
- assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
- "draw:image[@draw:mime-type='image/png']"_ostr);
- }
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
+ "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr);
+ assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/"
+ "draw:image[@draw:mime-type='image/png']"_ostr);
}
DECLARE_FODFEXPORT_TEST(testSvgImageRoundtrip, "SvgImageTest.fodt")
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index bd87666a19eb..3a715c8434a7 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -258,13 +258,6 @@ protected:
int getShapes() const;
/**
- * Returns an xml stream of an exported file.
- * To be used when the exporter doesn't create zip archives, but single files
- * (like Flat ODF Export)
- */
- xmlDocUniquePtr parseExportedFile();
-
- /**
* Creates a new document to be used with the internal sw/ API.
*
* Examples:
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index f84b3ef15b05..de3c815a7157 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -493,12 +493,6 @@ int SwModelTestBase::getShapes() const
return xDraws->getCount();
}
-xmlDocUniquePtr SwModelTestBase::parseExportedFile()
-{
- auto stream(SvFileStream(maTempFile.GetURL(), StreamMode::READ | StreamMode::TEMPORARY));
- return parseXmlStream(&stream);
-}
-
void SwModelTestBase::createSwDoc(const char* pName, const char* pPassword)
{
if (!pName)