diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-08-10 14:58:28 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-08-11 13:03:06 +0200 |
commit | cad5220c707ab7483e9146182e3353146ae24d41 (patch) | |
tree | 96453f19ca43532af43598fc490a3e59a7eb7e57 /svgio | |
parent | 600780e9904958bf91585d5e232e0cfa0c95827a (diff) |
tdf#150323: also add markers if there is a css style parent
Change-Id: Ia900726ee31b7b19e98122d40b33581c9a60dcc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138090
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 24 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/markerInCssStyle.svg | 14 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 3 |
3 files changed, 40 insertions, 1 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 8037f850768a..7db9c8335b1f 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -47,6 +47,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testFontsizeRelative(); void testMarkerOrient(); void testMarkerInPresentation(); + void testMarkerInCssStyle(); void testTdf45771(); void testTdf97941(); void testTdf104339(); @@ -94,6 +95,7 @@ public: CPPUNIT_TEST(testFontsizeRelative); CPPUNIT_TEST(testMarkerOrient); CPPUNIT_TEST(testMarkerInPresentation); + CPPUNIT_TEST(testMarkerInCssStyle); CPPUNIT_TEST(testTdf45771); CPPUNIT_TEST(testTdf97941); CPPUNIT_TEST(testTdf104339); @@ -394,6 +396,28 @@ void Test::testMarkerInPresentation() assertXPath(pDocument, "/primitive2D/transform/transform/transform", 0); } +void Test::testMarkerInCssStyle() +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/markerInCssStyle.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: 20 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", 20); + + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "width", "1"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linejoin", "Miter"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", "28"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", "BUTT"); +} + void Test::testTdf45771() { //Check text fontsize when using relative units diff --git a/svgio/qa/cppunit/data/markerInCssStyle.svg b/svgio/qa/cppunit/data/markerInCssStyle.svg new file mode 100644 index 000000000000..a7a8374f6ee3 --- /dev/null +++ b/svgio/qa/cppunit/data/markerInCssStyle.svg @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<defs> +<marker style="overflow:visible;" id="bip" refX="0" refY="0" orient="auto"> + <path style="stroke: green" d="M 0,-3 v 6" /> +</marker> +</defs> + +<style> +path.boundary {stroke: red; fill: #ccc; stroke-width: 3; marker-mid: url(#bip); marker-end: url(#bip)} +</style> + +<path class="boundary" d="m 20,20 v 90 90 90 90 90 h 90 90 90 90 90 v -90 -90 -90 -90 -90 h -90 -90 -90 -90 z" /> +</svg> diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index c787c4dffa92..32fed8b8daff 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1149,7 +1149,8 @@ namespace svgio::svgreader // Svg supports markers for path, polygon, polyline and line if(SVGToken::Path == mrOwner.getType() || // path SVGToken::Polygon == mrOwner.getType() || // polygon, polyline - SVGToken::Line == mrOwner.getType()) // line + SVGToken::Line == mrOwner.getType() || // line + getCssStyleParent()) { // try to add markers add_markers(rPath, rTarget, pHelpPointIndices); |