diff options
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 24 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf97710.svg | 8 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 3 |
3 files changed, 33 insertions, 2 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index b337418dbdec..fcd76f12bd1f 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1450,6 +1450,30 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101237) assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf97710) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97710.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/mask/polypolygoncolor[1]", "color", "#000000"); + + // Without the fix in place, this test would have failed with + // - Expected: 100 + // - Actual : 0 + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "width", "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "height", "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]", "color", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "width", "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "height", "100"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "color", "#000000"); + assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "width", "1"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf94765) { Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf94765.svg"); diff --git a/svgio/qa/cppunit/data/tdf97710.svg b/svgio/qa/cppunit/data/tdf97710.svg new file mode 100644 index 000000000000..bbd9a91a9b8e --- /dev/null +++ b/svgio/qa/cppunit/data/tdf97710.svg @@ -0,0 +1,8 @@ +<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> + <!-- Example of a polyline with the default fill --> + <polyline points="0,100 50,25 50,75 100,0" /> + + <!-- Example of the same polyline shape with stroke and no fill --> + <polyline points="100,100 150,25 150,75 200,0" fill="green" stroke="black" /> +</svg> + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 4ed60d297e4f..869b071dade7 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1127,8 +1127,7 @@ namespace svgio::svgreader // create fill basegfx::B2DPolyPolygon aPath(rPath); - if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType() - || SVGToken::Polyline == mrOwner.getType()) + if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType()) { if(FillRule::evenodd != getClipRule() && FillRule::evenodd != getFillRule()) { |