summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx18
-rw-r--r--svgio/qa/cppunit/data/tdf155819.svg15
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx5
3 files changed, 36 insertions, 2 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index ad5852127551..559af49af695 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -135,6 +135,24 @@ CPPUNIT_TEST_FIXTURE(Test, testSymbol)
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00d000");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf155819)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 1);
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon", 1);
+ // Without the fix in place, this test would have failed with
+ // - Expected: 4
+ // - Actual : 0
+ assertXPath(pDocument, "/primitive2D/transform/transform", 4);
+}
+
CPPUNIT_TEST_FIXTURE(Test, testFilterLuminanceToAlpha)
{
Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg");
diff --git a/svgio/qa/cppunit/data/tdf155819.svg b/svgio/qa/cppunit/data/tdf155819.svg
new file mode 100644
index 000000000000..30c2da4d1a5a
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf155819.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
+ <style>
+ path {
+ fill: none;
+ stroke-width: 4px;
+ marker: url(#diamond);
+ }
+ </style>
+ <path d="M 10,50 v -20 h 40 v -20" stroke="red"/>
+ <marker id="diamond" markerWidth="12" markerHeight="12" refX="6" refY="6" markerUnits="userSpaceOnUse">
+ <circle cx="6" cy="6" r="3"
+ fill="white" stroke="context-stroke" stroke-width="2"/>
+ </marker>
+</svg>
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 99267c762dc5..5f3a3f4aea8a 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1151,7 +1151,7 @@ namespace svgio::svgreader
if(SVGToken::Path == mrOwner.getType() || // path
SVGToken::Polygon == mrOwner.getType() || // polygon, polyline
SVGToken::Line == mrOwner.getType() || // line
- getCssStyleParent())
+ SVGToken::Style == mrOwner.getType()) // tdf#150323
{
// try to add markers
add_markers(rPath, rTarget, pHelpPointIndices);
@@ -1894,7 +1894,8 @@ namespace svgio::svgreader
}
case SVGToken::Marker:
{
- if(getCssStyleParent())
+ // tdf#155819: Using the marker property from a style sheet is equivalent to using all three (start, mid, end).
+ if(mrOwner.getType() == SVGToken::Style)
{
readLocalUrl(aContent, maMarkerEndXLink);
maMarkerStartXLink = maMarkerMidXLink = maMarkerEndXLink;