diff options
-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); |