diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-13 11:14:25 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-13 23:09:53 +0200 |
commit | 1df7a1ac274db509f1a135b84a01ea51c4d0c1f9 (patch) | |
tree | 99bb8326500ebea6f22787646aa9dfa3d2982b09 /svgio/qa | |
parent | 99f5bf03caa2538ca79b04e7fd017cebfb4c7a95 (diff) |
tdf#156269: dx and dy do not depend on x and y
Change-Id: I99be5aa45b333ec3825373c3a10be0e24d23cb29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154380
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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> + |