filter/qa/unit/data/tdf168054.odg |binary filter/qa/unit/svg.cxx | 85 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+)
New commits: commit 46d70b02786fb4fae3e3c6ea69a2d4d985c52b7c Author: Xisco Fauli <[email protected]> AuthorDate: Wed Jan 28 17:35:04 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Jan 28 23:00:23 2026 +0100 tdf#168054: filter_svg: Add tests Change-Id: Ie32e143762436d43247563f6ca01a1c4ecc7f431 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198325 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/filter/qa/unit/data/tdf168054.odg b/filter/qa/unit/data/tdf168054.odg new file mode 100644 index 000000000000..6d4fd57af1c7 Binary files /dev/null and b/filter/qa/unit/data/tdf168054.odg differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 6bcbbb17df02..2654cb6509a7 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -397,6 +397,91 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTdf166789) CPPUNIT_ASSERT_DOUBLES_EQUAL(7000, length.toInt32(), 70); // allow 1% for rounding errors } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTdf168054_export_two_pages_to_svg_using_convert_to) +{ + loadFromFile(u"tdf168054.odg"); + + // Emulate --convert-to svg:"draw_svg_Export" + saveWithParams({ + comphelper::makePropertyValue(u"FilterName"_ustr, u"draw_svg_Export"_ustr), + comphelper::makePropertyValue(u"ConversionRequestOrigin"_ustr, u"CommandLine"_ustr), + }); + + xmlDocUniquePtr pXmlDoc = parseExportedFile(); + CPPUNIT_ASSERT(pXmlDoc); + + // Both shapes are exported into one page + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "fill", u"rgb(255,0,0)"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "stroke", u"rgb(255,64,0)"); + + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "fill", u"rgb(0,0,0)"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[2]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "stroke", u"rgb(0,0,0)"); +} + +CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTdf168054_export_two_pages_to_svg) +{ + loadFromFile(u"tdf168054.odg"); + + save(TestFilter::SVG_DRAW); + + xmlDocUniquePtr pXmlDoc = parseExportedFile(); + CPPUNIT_ASSERT(pXmlDoc); + + // Only first page is exported + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:rect", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "fill", u"rgb(255,0,0)"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[1]", + "stroke", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "fill", u"none"); + assertXPath(pXmlDoc, + "//svg:g[@class='SlideGroup']/svg:g[1]/svg:g/svg:g/svg:g/svg:g/svg:g/svg:path[2]", + "stroke", u"rgb(255,64,0)"); + + assertXPath(pXmlDoc, "//svg:g[@class='SlideGroup']/svg:g[2]", 0); +} + CPPUNIT_TEST_FIXTURE(SvgFilterTest, testDashedLine) { // A dashed line
