diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-02 11:49:56 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-02 20:07:14 +0200 |
commit | 79646e204f5d558f5519186cb62ef1c9254f857f (patch) | |
tree | be4570a3167211ee8550119abdde0083e08873d9 /svgio/qa/cppunit | |
parent | aaba06d2fca3264cd73093ffc048af27992bd0fb (diff) |
tdf#156577: do no use parent position if x array is empty
Change-Id: Id29e5a440dbc3719c53bcc9226336a3c99d469e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155216
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 31 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf156577.svg | 8 |
2 files changed, 39 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 9bc0dfc24e19..4309add11fbb 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1431,6 +1431,37 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269) assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#000000"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156577) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156577.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/textsimpleportion[1]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "20"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC"); + assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "16"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC"); + + // Without the fix in place, this test would have failed with + // - Expected: 22 + // - Actual : 52 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", "22"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", "53"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", "94"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf156283) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156283.svg"); diff --git a/svgio/qa/cppunit/data/tdf156577.svg b/svgio/qa/cppunit/data/tdf156577.svg new file mode 100644 index 000000000000..de12f36667f8 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156577.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <text x="30" y="20"> + <tspan x="30" y="20">ABC</tspan> + </text> + <text x="30" y="30"> + <tspan x="30" y="30" dx="0 10 20 30 40">ABC</tspan> + </text> +</svg> |