From c2d130425cc876cceb96cc7e47636426a9e48fa8 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Sat, 26 Mar 2016 16:23:23 +0100 Subject: SVGIO: Shapes within a clippath element might inherit... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... fill, stroke, stroke-width and others attributes from parent element, like use element Change-Id: I911bc50409428e81135b81e6dfc82acd1c21d113 Reviewed-on: https://gerrit.libreoffice.org/23527 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ --- svgio/qa/cppunit/SvgImportTest.cxx | 20 ++++++++++++++++++++ svgio/qa/cppunit/data/ClipPathAndParentStyle.svg | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 svgio/qa/cppunit/data/ClipPathAndParentStyle.svg (limited to 'svgio/qa/cppunit') diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index feea8179f4d9..c4b681bd242d 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -53,6 +53,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testRGBColor(); void testRGBAColor(); void testTdf97936(); + void testClipPathAndParentStyle(); Primitive2DSequence parseSvg(const char* aSource); @@ -76,6 +77,7 @@ public: CPPUNIT_TEST(testRGBColor); CPPUNIT_TEST(testRGBAColor); CPPUNIT_TEST(testTdf97936); + CPPUNIT_TEST(testClipPathAndParentStyle); CPPUNIT_TEST_SUITE_END(); }; @@ -403,6 +405,24 @@ void Test::testTdf97936() assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxx", "60"); assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxy", "100"); } + +void Test::testClipPathAndParentStyle() +{ + //Check that fill color, stroke color and stroke-width are inherited from use element + //when the element is within a clipPath element + Primitive2DSequence aSequenceClipPathAndParentStyle = parseSvg("/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceClipPathAndParentStyle.getLength()); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceClipPathAndParentStyle)); + + 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/ClipPathAndParentStyle.svg b/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg new file mode 100644 index 000000000000..d85a95995c0a --- /dev/null +++ b/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg @@ -0,0 +1,10 @@ + + + + + + + + -- cgit