diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-02 17:39:25 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-02 22:28:27 +0200 |
commit | 7aae2fbef91d00afaded26215f48fcdb2070b6ef (patch) | |
tree | 2d1ad11a2d3c5cbeb87701620f47b0a52caaf1c9 /svgio | |
parent | bb51f5096fd37925c2124161ef8637645320d7de (diff) |
tdf#95400: svgio: Add unittest
Change-Id: I88d56bafce22231ca05864ee9dbeb8c31b4dcb50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155265
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 27 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf95400.svg | 8 |
2 files changed, 35 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 4309add11fbb..24a05ea27075 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1431,6 +1431,33 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269) assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", "#000000"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf95400) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf95400.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"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0", "36"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", "69"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", "102"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", "48"); + 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"); + assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf156577) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156577.svg"); diff --git a/svgio/qa/cppunit/data/tdf95400.svg b/svgio/qa/cppunit/data/tdf95400.svg new file mode 100644 index 000000000000..378100a2129c --- /dev/null +++ b/svgio/qa/cppunit/data/tdf95400.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 150 100" xmlns="http://www.w3.org/2000/svg"> + <text x="30" y="20" textLength="102" lengthAdjust="spacing"> + ABC + </text> + <text x="30" y="30" textLength="102" lengthAdjust="spacingAndGlyphs"> + ABC + </text> +</svg> |