summaryrefslogtreecommitdiffstats
path: root/svgio/qa/cppunit/SvgImportTest.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 326e8f38ff..6969dc406a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -38,6 +38,7 @@ protected:
void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
Primitive2DSequence parseSvg(std::u16string_view aSource);
+ xmlDocUniquePtr dumpAndParseSvg(std::u16string_view aSource);
};
Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
@@ -59,6 +60,17 @@ Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
return xSvgParser->getDecomposition(aInputStream, aPath);
}
+xmlDocUniquePtr Test::dumpAndParseSvg(std::u16string_view aSource)
+{
+ Primitive2DSequence aSequence = parseSvg(aSource);
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+ return pDocument;
+}
+
void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
{
drawinglayer::Primitive2dXmlDump dumper;
@@ -385,6 +397,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative)
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "DejaVu Serif");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf160386)
+{
+ xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160386.svg");
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 1
+ // - Actual : 11
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 1);
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, "text"_ostr, "Hello!");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg");
@@ -441,6 +464,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156168)
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr, "color"_ostr, "#00ff00");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf160373)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf160373.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ // Without the fix in place, nothing would be displayed
+ assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#0000ff");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf129356)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf129356.svg");