[Libreoffice-commits] core.git: svgio/qa
Xisco Fauli
anistenis at gmail.com
Fri Apr 15 08:05:34 UTC 2016
svgio/qa/cppunit/SvgImportTest.cxx | 17 +++++++++++++++++
svgio/qa/cppunit/data/maskText.svg | 26 ++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
New commits:
commit 3daee9953da215fb7c0740259dcb37713dd17cd1
Author: Xisco Fauli <anistenis at gmail.com>
Date: Thu Apr 14 23:44:38 2016 +0200
SVG: Add unittest for ecc7f698b5f080530f006218fa3dd82da43d9abb
Change-Id: Icbfd60bd15196649011919e8dea064276e1964b0
Reviewed-on: https://gerrit.libreoffice.org/24097
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Xisco FaulĂ <anistenis at gmail.com>
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 6ae57af..e43c1b16 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -59,6 +59,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testMaskingPath07b();
void test47446();
void test47446b();
+ void testMaskText();
Primitive2DSequence parseSvg(const char* aSource);
@@ -88,6 +89,7 @@ public:
CPPUNIT_TEST(testMaskingPath07b);
CPPUNIT_TEST(test47446);
CPPUNIT_TEST(test47446b);
+ CPPUNIT_TEST(testMaskText);
CPPUNIT_TEST_SUITE_END();
};
@@ -518,6 +520,21 @@ void Test::test47446b()
}
+void Test::testMaskText()
+{
+ //Check that mask is applied on text
+ Primitive2DSequence aSequenceMaskText = parseSvg("/svgio/qa/cppunit/data/maskText.svg");
+ CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceMaskText.getLength());
+
+ Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskText));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#000000");
+ assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion", "text", "Black White");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/svgio/qa/cppunit/data/maskText.svg b/svgio/qa/cppunit/data/maskText.svg
new file mode 100644
index 0000000..7405f6a
--- /dev/null
+++ b/svgio/qa/cppunit/data/maskText.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<svg width="200" height="80"
+ viewBox="0 0 200 80" version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <defs>
+ <mask id="myMask"
+ x="0" y="0" width="200" height="80">
+ <rect x="0" y="0" width="100" height="80" fill="white"/>
+ </mask>
+
+ <text id="Text" x="100" y="48"
+ font-size="26" font-weight="bold" text-anchor="middle">
+ Black White
+ </text>
+ </defs>
+
+ <!-- Draw black rectangle in the background -->
+ <rect x="100" y="10" width="95" height="60" />
+
+ <!-- Draw the text string twice. First, the white text without mask.
+ Second, the black text with the mask applied-->
+ <use xlink:href="#Text" fill="white"/>
+ <use xlink:href="#Text" fill="black" mask="url(#myMask)"/>
+</svg>
More information about the Libreoffice-commits
mailing list