summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-11-03 11:42:17 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-11-03 16:21:57 +0100
commit2dd592f0836184e3f275e8ff3248639f08a3f647 (patch)
tree21e8e2f3a98b7d82a19f45f8d4e28eb37a992634 /xmloff
parent1de8308d40fad8e9281d2b491f8c5c919fda82f4 (diff)
UnoApiXmlTest: add new wrapper for XmlTestTools tests
Change-Id: I767f464ec666330a2e8e832b6d6f5736a6bef54d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142228 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/qa/unit/draw.cxx25
-rw-r--r--xmloff/qa/unit/style.cxx25
-rw-r--r--xmloff/qa/unit/text.cxx43
3 files changed, 33 insertions, 60 deletions
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index d5c5ab0bdced..93b230db8d72 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/unoapi_test.hxx>
-#include <test/xmltesttools.hxx>
+#include <test/unoapixml_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -38,7 +37,7 @@
using namespace ::com::sun::star;
/// Covers xmloff/source/draw/ fixes.
-class XmloffDrawTest : public UnoApiTest, public XmlTestTools
+class XmloffDrawTest : public UnoApiXmlTest
{
public:
XmloffDrawTest();
@@ -47,7 +46,7 @@ public:
};
XmloffDrawTest::XmloffDrawTest()
- : UnoApiTest("/xmloff/qa/unit/data/")
+ : UnoApiXmlTest("/xmloff/qa/unit/data/")
{
}
@@ -125,8 +124,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport)
utl::TempFileNamed aTempFile = save("impress8");
// Check if the 12 colors are written in the XML:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "styles.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 12
// - Actual : 0
@@ -164,8 +162,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot)
// Execute ODP export:
utl::TempFileNamed aTempFile = save("impress8");
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Check that the preview was exported:
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
@@ -207,8 +204,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme)
utl::TempFileNamed aTempFile = save("impress8");
// Make sure the export result has the theme reference:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//style:style[@style:name='T1']/style:text-properties' no attribute 'theme-color' exist
// i.e. only the direct color was written, but not the theme reference.
@@ -318,8 +314,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended)
utl::TempFileNamed aTempFile = save("writer8");
// assert XML.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true");
assertXPath(pXmlDoc,
"//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']");
@@ -342,8 +337,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict)
utl::TempFileNamed aTempFile = save("writer8");
// assert XML.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-metal", "true");
assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]", 0);
@@ -381,8 +375,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended)
utl::TempFileNamed aTempFile = save("writer8");
// assert XML.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']");
assertXPath(pXmlDoc,
"//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']");
diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx
index aeaf9f20866f..f5b42fac1fb0 100644
--- a/xmloff/qa/unit/style.cxx
+++ b/xmloff/qa/unit/style.cxx
@@ -11,8 +11,7 @@
#include <string_view>
-#include <test/unoapi_test.hxx>
-#include <test/xmltesttools.hxx>
+#include <test/unoapixml_test.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -32,7 +31,7 @@
using namespace ::com::sun::star;
/// Covers xmloff/source/style/ fixes.
-class XmloffStyleTest : public UnoApiTest, public XmlTestTools
+class XmloffStyleTest : public UnoApiXmlTest
{
public:
XmloffStyleTest();
@@ -40,7 +39,7 @@ public:
};
XmloffStyleTest::XmloffStyleTest()
- : UnoApiTest("/xmloff/qa/unit/data/")
+ : UnoApiXmlTest("/xmloff/qa/unit/data/")
{
}
@@ -191,8 +190,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR)
utl::TempFileNamed aTempFile = save("writer8");
// With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "styles.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
assertXPath(pXmlDoc,
"/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/"
"style:graphic-properties[@loext:writing-mode]");
@@ -213,8 +211,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR)
// Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build.
// A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "styles.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "styles.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-styles/office:styles/"
"style:style[@style:name='FrameBTLR']/style:graphic-properties",
@@ -247,8 +244,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin)
// With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be
// written.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/"
@@ -271,8 +267,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin)
// Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in
// productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-content/office:automatic-styles/"
"style:style[@style:name='gr1']/style:graphic-properties",
@@ -305,8 +300,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin)
// With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be
// written.
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(
pXmlDoc,
"/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/"
@@ -329,8 +323,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin)
// Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in
// productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey().
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPathNoAttribute(pXmlDoc,
"/office:document-content/office:automatic-styles/"
"style:style[@style:name='gr1']/style:graphic-properties",
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index bb86c8df35d4..7a78848c4b7a 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/unoapi_test.hxx>
-#include <test/xmltesttools.hxx>
+#include <test/unoapixml_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValues.hpp>
@@ -29,7 +28,7 @@
using namespace ::com::sun::star;
/// Covers xmloff/source/text/ fixes.
-class XmloffStyleTest : public UnoApiTest, public XmlTestTools
+class XmloffStyleTest : public UnoApiXmlTest
{
public:
XmloffStyleTest();
@@ -37,7 +36,7 @@ public:
};
XmloffStyleTest::XmloffStyleTest()
- : UnoApiTest("/xmloff/qa/unit/data/")
+ : UnoApiXmlTest("/xmloff/qa/unit/data/")
{
}
@@ -216,8 +215,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId)
xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
// Then make sure that unreferenced xml:id="..." attributes are not written:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//text:list' unexpected 'id' attribute
// i.e. xml:id="..." was written unconditionally, even when no other list needed it.
@@ -244,8 +242,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//text:line-break' number of nodes is incorrect
// i.e. the clearing break was lost on export.
@@ -318,8 +315,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth)
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 3.1492in (8cm)
// - Actual : 0.0161in (0.04 cm)
@@ -356,8 +352,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight)
xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
// Then make sure that we still export a non-zero size:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 0.7874in
// - Actual : 0in
@@ -386,8 +381,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - XPath '//loext:content-control' number of nodes is incorrect
// i.e. the content control was lost on export.
@@ -449,8 +443,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
assertXPath(pXmlDoc, "//loext:content-control", "checkbox", "true");
assertXPath(pXmlDoc, "//loext:content-control", "checked", "true");
assertXPath(pXmlDoc, "//loext:content-control", "checked-state", u"☒");
@@ -536,8 +529,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this failed with:
// - Expected: 1
// - Actual : 0
@@ -621,8 +613,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'picture' exist
assertXPath(pXmlDoc, "//loext:content-control", "picture", "true");
@@ -680,10 +671,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'date' exist
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
assertXPath(pXmlDoc, "//loext:content-control", "date", "true");
assertXPath(pXmlDoc, "//loext:content-control", "date-format", "YYYY-MM-DD");
assertXPath(pXmlDoc, "//loext:content-control", "date-rfc-language-tag", "en-US");
@@ -747,8 +737,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'plain-text' exist
// i.e. the plain text content control was turned into a rich text one on export.
@@ -803,8 +792,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - XPath '//loext:content-control' no attribute 'combobox' exist
// i.e. the combo box content control was turned into a drop-down one on export.
@@ -833,8 +821,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAliasContentControlExport)
utl::TempFileNamed aTempFile = save("writer8");
// Then make sure the expected markup is used:
- std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile.GetURL(), "content.xml");
- xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+ xmlDocUniquePtr pXmlDoc = parseExport(aTempFile.GetURL(), "content.xml");
// Without the accompanying fix in place, this test would have failed with:
// - Expression: prop
// - XPath '//loext:content-control' no attribute 'alias' exist