svgio/qa/cppunit/SvgImportTest.cxx | 21 +++++++++++++++++++++ svgio/qa/cppunit/data/tdf156777.svg | 14 ++++++++++++++ svgio/source/svgreader/svgtextpathnode.cxx | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-)
New commits: commit 72b99211cfb3755546b5bfeb13f7693dc95b79c1 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Aug 15 19:43:42 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Aug 17 11:14:41 2023 +0200 tdf#156777: check for css style in textpath Change-Id: I63a274dd9fba37852412a194a490cb2b7634f1cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155726 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 20f57e14362674d321ef184e1987f41a6418adc2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155702 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 4032c934658e..bbaf2ec5d96d 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -706,6 +706,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97941) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf156777) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156777.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", 23); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "Quick brown fox jumps over the lazy dog."); + + // Without the fix in place, this test would have failed with + // - Expected: #008000 + // - Actual : #000000 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "84"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "23"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf104339) { Primitive2DSequence aSequenceTdf104339 = parseSvg(u"/svgio/qa/cppunit/data/tdf104339.svg"); diff --git a/svgio/qa/cppunit/data/tdf156777.svg b/svgio/qa/cppunit/data/tdf156777.svg new file mode 100644 index 000000000000..9ce1dd8cd37c --- /dev/null +++ b/svgio/qa/cppunit/data/tdf156777.svg @@ -0,0 +1,14 @@ +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <path + id="path1" + fill="none" + stroke="red" + d="M10,90 Q90,90 90,45 Q90,10 50,10 Q10,10 10,40 Q10,70 45,70 Q70,70 75,50" /> + + <text> + <textPath href="#path1" startOffset="40%" style="fill:green"> + Quick brown fox jumps over the lazy dog. + </textPath> + </text> +</svg> + diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index 2c5a823566ed..4dad47f62bb6 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -252,7 +252,7 @@ namespace svgio::svgreader const SvgStyleAttributes* SvgTextPathNode::getSvgStyleAttributes() const { - return &maSvgStyleAttributes; + return checkForCssStyle(maSvgStyleAttributes); } void SvgTextPathNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)