diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-02-12 01:36:58 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-02-13 13:38:39 +0000 |
commit | 3c8b880c5edc1dcbf0f481c558c6093513df6b45 (patch) | |
tree | bcdbe6cbcb48cc5ede632109e6db30428938fd21 /svgio/qa | |
parent | 52942f142ec40f762c1de0751d802fd42eaabed3 (diff) |
SVGIO: tdf#97659: Add support for RGBA
Change-Id: Icbf3796cdc95f91d298a5ca52d44931b3985eac6
Reviewed-on: https://gerrit.libreoffice.org/22303
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 32 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/RGBAColor.svg | 4 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/RGBColor.svg | 4 |
3 files changed, 40 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 182c4fe1f8af..20305988c3ab 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -48,6 +48,8 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testTdf97542_1(); void testTdf97542_2(); void testTdf97543(); + void testRGBColor(); + void testRGBAColor(); Primitive2DSequence parseSvg(const char* aSource); @@ -66,6 +68,8 @@ public: CPPUNIT_TEST(testTdf97542_1); CPPUNIT_TEST(testTdf97542_2); CPPUNIT_TEST(testTdf97543); + CPPUNIT_TEST(testRGBColor); + CPPUNIT_TEST(testRGBAColor); CPPUNIT_TEST_SUITE_END(); }; @@ -232,6 +236,7 @@ void Test::testTdf85770() void Test::testTdf79163() { + //Check Opacity Primitive2DSequence aSequenceTdf79163 = parseSvg("/svgio/qa/cppunit/data/tdf79163.svg"); CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf79163.getLength()); @@ -284,6 +289,33 @@ void Test::testTdf97543() assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); } + +void Test::testRGBColor() +{ + Primitive2DSequence aSequenceRGBColor = parseSvg("/svgio/qa/cppunit/data/RGBColor.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceRGBColor.getLength()); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBColor)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#646464"); +} + +void Test::testRGBAColor() +{ + Primitive2DSequence aSequenceRGBAColor = parseSvg("/svgio/qa/cppunit/data/RGBAColor.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceRGBAColor.getLength()); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", "transparence", "0"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/svgio/qa/cppunit/data/RGBAColor.svg b/svgio/qa/cppunit/data/RGBAColor.svg new file mode 100644 index 000000000000..ddd7a3cc0342 --- /dev/null +++ b/svgio/qa/cppunit/data/RGBAColor.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect x="10" y="10" width="100" height="100" rx="10" ry="10" fill="rgba(20,10,100,0.5)" visibility="inherit" />
+</svg>
diff --git a/svgio/qa/cppunit/data/RGBColor.svg b/svgio/qa/cppunit/data/RGBColor.svg new file mode 100644 index 000000000000..ad60d5b55a62 --- /dev/null +++ b/svgio/qa/cppunit/data/RGBColor.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <rect x="10" y="10" width="100" height="100" rx="10" ry="10" fill="rgb(100,100,100)" visibility="inherit" />
+</svg>
|