From 5079e7937ef471a44dcf119dc6ae0a334d9c6adc Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 12 Jul 2023 17:46:01 +0200 Subject: tdf#156251: Add gap between text elements when needed Partially revert a42f5faac7c6d4590e632cf40e3ba9eb618e6f56 "tdf#103888: Do not add a gap at the end of each text portion" and adapt code to keep tdf#103888 fixed Change-Id: I4b3f1ff7d87b1945233d9b05824d58af1e001d65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154364 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- svgio/qa/cppunit/SvgImportTest.cxx | 23 ++++++++++++++++++++++- svgio/qa/cppunit/data/tdf156251.svg | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 svgio/qa/cppunit/data/tdf156251.svg (limited to 'svgio/qa/cppunit') diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 9f0b8ff7b9d7..b3d20603cfa7 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -737,7 +737,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "11"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#000000"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "Start"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "Start "); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "11"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#000000"); @@ -1150,6 +1150,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103888) assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[3]", "text", "hebung"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156251) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156251.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: 'You are ' + // - Actual : 'You are' + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "You are "); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "not "); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", "a banana!"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", "You are "); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", "not "); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", "a banana!"); +} + CPPUNIT_TEST_FIXTURE(Test, testMaskText) { //Check that mask is applied on text diff --git a/svgio/qa/cppunit/data/tdf156251.svg b/svgio/qa/cppunit/data/tdf156251.svg new file mode 100644 index 000000000000..201a0aa69e99 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156251.svg @@ -0,0 +1,17 @@ + + + + + You are + not + a banana! + + + You are not a banana! + + + -- cgit