summaryrefslogtreecommitdiff
path: root/svgio/qa
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-03-28 19:24:29 +0200
committerXisco Faulí <anistenis@gmail.com>2016-03-29 08:00:47 +0000
commit3041df16f8315859ddf22075eac8f9ad4fa37b8e (patch)
treef221fa0aea0f3abcf9e67b0b4e7e7fe0158321de /svgio/qa
parentd5e4fe23b2af09a2989a0b1c37b13bb4b2ea8787 (diff)
SVGIO: Don't inherit style attributes from parent if the...
... shapes define their own attributes. Partially revert commit c2d130425cc876cceb96cc7e47636426a9e48fa8 Change-Id: Iee98003f4ff63575a28818b091ab77431337192f Reviewed-on: https://gerrit.libreoffice.org/23571 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Xisco Faulí <anistenis@gmail.com>
Diffstat (limited to 'svgio/qa')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx21
-rw-r--r--svgio/qa/cppunit/data/ClipPathAndStyle.svg13
2 files changed, 34 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index c4b681bd242d..046d905e5036 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -54,6 +54,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testRGBAColor();
void testTdf97936();
void testClipPathAndParentStyle();
+ void testClipPathAndStyle();
Primitive2DSequence parseSvg(const char* aSource);
@@ -78,6 +79,7 @@ public:
CPPUNIT_TEST(testRGBAColor);
CPPUNIT_TEST(testTdf97936);
CPPUNIT_TEST(testClipPathAndParentStyle);
+ CPPUNIT_TEST(testClipPathAndStyle);
CPPUNIT_TEST_SUITE_END();
};
@@ -423,6 +425,25 @@ void Test::testClipPathAndParentStyle()
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5");
}
+
+void Test::testClipPathAndStyle()
+{
+ //Check that fill color, stroke color and stroke-width are inherited from use element
+ //when the element is within a clipPath element
+ Primitive2DSequence aSequenceClipPathAndStyle = parseSvg("/svgio/qa/cppunit/data/ClipPathAndStyle.svg");
+ CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceClipPathAndStyle.getLength());
+
+ Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndStyle));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#ccccff");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#0000cc");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "2");
+
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/svgio/qa/cppunit/data/ClipPathAndStyle.svg b/svgio/qa/cppunit/data/ClipPathAndStyle.svg
new file mode 100644
index 000000000000..29814fadbb86
--- /dev/null
+++ b/svgio/qa/cppunit/data/ClipPathAndStyle.svg
@@ -0,0 +1,13 @@
+<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">
+ <clipPath>
+ <circle id="c1" cx="100" cy="100" r="50"
+ style="stroke: #0000cc;
+ stroke-width: 2px;
+ fill : #ccccff;"/>
+ </clipPath>
+
+ <use xlink:href="#c1" style="fill:red" stroke-width="5px" stroke="black"/>
+
+</svg> \ No newline at end of file