diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-13 23:06:02 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-14 12:46:41 +0200 |
commit | a3d8f4079dc31a0496f86dc2f80eee9ad60415f5 (patch) | |
tree | 99bbc607c3d080e308d5f4f80e75c7bc195dd35a /svgio/qa | |
parent | d86a6d2b47c6a22d185dc631388ca3f2c0386a35 (diff) |
tdf#156271: add dx shift on top of x position
Change-Id: I61263a7fec2ec8236221a10f8cb730899c878f5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154403
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 46 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf156271.svg | 6 |
2 files changed, 52 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 7263439e86c1..0a976eb276e0 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1431,6 +1431,52 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269) assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#000000"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156271) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156271.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "x", "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "y", "10"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "text", "AB"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "dx0", "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "dx1", "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "x", "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "y", "20"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "text", "AB"); + + // Without the fix in place, this test would have failed with + // - Expected: -30 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "dx0", "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "dx1", "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "x", "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "y", "30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "text", "AB"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "dx0", "-30"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "dx1", "-19"); + + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "x", "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "y", "40"); + assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "text", "AB"); + assertXPathNoAttribute(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "dx0"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149880) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); diff --git a/svgio/qa/cppunit/data/tdf156271.svg b/svgio/qa/cppunit/data/tdf156271.svg new file mode 100644 index 000000000000..ff0267f35c82 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156271.svg @@ -0,0 +1,6 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="40 10" y="10">AB</text> + <text x="10 10" dx="30" y="20">AB</text> + <text x="0 0" dx="40 10" y="30">AB</text> + <text x="10" dx="30 0" y="40">AB</text> +</svg> |