diff options
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 27 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf156269.svg | 8 |
2 files changed, 35 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index b3d20603cfa7..7263439e86c1 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1404,6 +1404,33 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97663) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "236"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156269) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156269.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "//textsimpleportion[@text='one']", "width", "16"); + assertXPath(pDocument, "//textsimpleportion[@text='one']", "height", "16"); + assertXPath(pDocument, "//textsimpleportion[@text='one']", "x", "10"); + assertXPath(pDocument, "//textsimpleportion[@text='one']", "y", "50"); + assertXPath(pDocument, "//textsimpleportion[@text='one']", "fontcolor", "#808080"); + + assertXPath(pDocument, "//textsimpleportion[@text='two']", "width", "16"); + assertXPath(pDocument, "//textsimpleportion[@text='two']", "height", "16"); + + // Without the fix in place, this test would have failed with + // - Expected: 60 + // - Actual : 10 + assertXPath(pDocument, "//textsimpleportion[@text='two']", "x", "60"); + assertXPath(pDocument, "//textsimpleportion[@text='two']", "y", "100"); + assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#000000"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149880) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); diff --git a/svgio/qa/cppunit/data/tdf156269.svg b/svgio/qa/cppunit/data/tdf156269.svg new file mode 100644 index 000000000000..e840b351d17d --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156269.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <!-- Some reference text --> + <text x="10%" y="50%" fill="grey">one</text> + + <!-- The same text with a shift --> + <text dx="50%" dy="50%" x="10%" y="50%">two</text> +</svg> + |