diff options
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 20 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf101237.svg | 11 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 24 |
3 files changed, 49 insertions, 6 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 218f9e8d9ef1..8bded0f5b695 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -61,6 +61,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void test47446b(); void testMaskText(); void testTdf99994(); + void testTdf101237(); Primitive2DSequence parseSvg(const char* aSource); @@ -91,6 +92,7 @@ public: CPPUNIT_TEST(test47446b); CPPUNIT_TEST(testMaskText); CPPUNIT_TEST(testTdf99994); + CPPUNIT_TEST(testTdf101237); CPPUNIT_TEST_SUITE_END(); }; @@ -620,6 +622,24 @@ void Test::testTdf99994() assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans"); } +void Test::testTdf101237() +{ + //Check that fill color, stroke color and stroke-width are inherited from use element + //when the element is within a clipPath element + Primitive2DSequence aSequenceTdf101237 = parseSvg("/svgio/qa/cppunit/data/tdf101237.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf101237.getLength()); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#000000"); + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5"); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/svgio/qa/cppunit/data/tdf101237.svg b/svgio/qa/cppunit/data/tdf101237.svg new file mode 100644 index 000000000000..e5afa3738442 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf101237.svg @@ -0,0 +1,11 @@ +<svg version="1.1" baseProfile="basic" id="svg-root" + width="100%" height="100%" viewBox="0 0 480 360" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none"> + + <clipPath id="p.0"> + <path + d="m0 0l437.0 0l0 487.0l-437.0 0l0 -487.0z" + clip-rule="nonzero"/> + </clipPath> + <circle clip-path="url(#p.0)" id="c1" cx="100" cy="100" r="50" style="fill:red" stroke-width="5px" stroke="black"/> +</svg> diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 9fc8b236652f..cc66af5a5dec 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2007,14 +2007,26 @@ namespace svgio if(pSvgStyleAttributes) { - return pSvgStyleAttributes->getFill(); + const basegfx::BColor* pFill = pSvgStyleAttributes->getFill(); + + if(mbIsClipPathContent) + { + if (pFill) + { + return pFill; + } + else + { + static basegfx::BColor aBlack(0.0, 0.0, 0.0); + return &aBlack; + } + } + else + { + return pFill; + } } } - else if(mbIsClipPathContent) - { - static basegfx::BColor aBlack(0.0, 0.0, 0.0); - return &aBlack; - } return nullptr; } |