svgio/qa/cppunit/SvgImportTest.cxx | 18 ++++++++++++++++++ svgio/qa/cppunit/data/tdf155733.svg | 20 ++++++++++++++++++++ svgio/source/svgreader/svgstyleattributes.cxx | 12 ++++++------ 3 files changed, 44 insertions(+), 6 deletions(-)
New commits: commit 195364a57a5e3090648cb327607bc52da2be583c Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jun 8 13:49:11 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 8 16:33:55 2023 +0200 tdf#155733: no need to store these values Change-Id: I1c22f8f344731eb5fbc5f77fc80267ebcdc81ed6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152740 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 967bcc0275cf..ce4db97e0954 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -989,6 +989,24 @@ CPPUNIT_TEST_FIXTURE(Test, testBehaviourWhenWidthAndHeightIsOrIsNotSet) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf155733) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155733.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/transform[1]/softedge", "radius", "5"); + + // Without the fix in place, the softedge would have been applied to the second element + // - Expected: 1 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/transform[2]/unifiedtransparence", "transparence", "50"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf97663) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/em_units.svg"); diff --git a/svgio/qa/cppunit/data/tdf155733.svg b/svgio/qa/cppunit/data/tdf155733.svg new file mode 100644 index 000000000000..db04ba9afd21 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155733.svg @@ -0,0 +1,20 @@ +<svg + width="100%" + height="100%" + viewBox="0 0 150 500" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs> + <g id="circles"> + <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" /> + </g> + </defs> + + <filter id="myFilter"> + <feGaussianBlur in="SourceGraphic" stdDeviation="5"/> + </filter> + + <use href="#circles" transform="translate(0 50)" filter="url(#myFilter)" /> + <use href="#circles" transform="translate(0 100)"/> +</svg> + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index eda757af80d3..600f1690cb80 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2879,7 +2879,7 @@ namespace svgio::svgreader if(!aClipPath.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpClipPathXLink = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(aClipPath)); + return dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(aClipPath)); } } @@ -2914,7 +2914,7 @@ namespace svgio::svgreader if(!aFilter.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpFilterXLink = dynamic_cast< const SvgFilterNode* >(mrOwner.getDocument().findSvgNodeById(aFilter)); + return dynamic_cast< const SvgFilterNode* >(mrOwner.getDocument().findSvgNodeById(aFilter)); } } @@ -2949,7 +2949,7 @@ namespace svgio::svgreader if(!aMask.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpMaskXLink = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(aMask)); + return dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(aMask)); } } @@ -2984,7 +2984,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpMarkerStartXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink())); + return dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerStartXLink())); } } @@ -3019,7 +3019,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpMarkerMidXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink())); + return dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerMidXLink())); } } @@ -3054,7 +3054,7 @@ namespace svgio::svgreader if(!aMarker.isEmpty()) { - const_cast< SvgStyleAttributes* >(this)->mpMarkerEndXLink = dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerEndXLink())); + return dynamic_cast< const SvgMarkerNode* >(mrOwner.getDocument().findSvgNodeById(getMarkerEndXLink())); } }