summaryrefslogtreecommitdiff
path: root/svgio/qa/cppunit
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-07-15 01:46:44 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-07-15 02:30:18 +0200
commit8580cbdc19224bc2a467535cc527cd28b0f30879 (patch)
treef2f653e4bd562f674f3fb94a231aceecfeff9885 /svgio/qa/cppunit
parent11937a68aecb8db9aebb1c929d940c5b85a0ecec (diff)
svgio: qa: Add test for shape with ref to clipPath
Change-Id: Ifefb27db8415eb55b22f1537e1790fcd9feb3ee4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137092 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx17
-rw-r--r--svgio/qa/cppunit/data/ShapeWithClipPath.svg13
2 files changed, 30 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 3165d596e333..13f135460017 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 testTdf149893();
void testClipPathAndParentStyle();
void testClipPathAndStyle();
+ void testShapeWithClipPath();
void testi125329();
void testMaskingPath07b();
void test123926();
@@ -102,6 +103,7 @@ public:
CPPUNIT_TEST(testTdf149893);
CPPUNIT_TEST(testClipPathAndParentStyle);
CPPUNIT_TEST(testClipPathAndStyle);
+ CPPUNIT_TEST(testShapeWithClipPath);
CPPUNIT_TEST(testi125329);
CPPUNIT_TEST(testMaskingPath07b);
CPPUNIT_TEST(test123926);
@@ -632,6 +634,21 @@ void Test::testClipPathAndStyle()
}
+void Test::testShapeWithClipPath()
+{
+ // Check there is a mask and 3 polygons
+ Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPath.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon", 2);
+ assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
+}
+
void Test::testi125329()
{
//Check style inherit from * css element
diff --git a/svgio/qa/cppunit/data/ShapeWithClipPath.svg b/svgio/qa/cppunit/data/ShapeWithClipPath.svg
new file mode 100644
index 000000000000..28c51b4dfb79
--- /dev/null
+++ b/svgio/qa/cppunit/data/ShapeWithClipPath.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<svg width="120" height="120"
+ viewPort="0 0 120 120" version="1.1"
+ xmlns="http://www.w3.org/2000/svg">
+
+ <clipPath id="myClip">
+ <rect x="30" y="30" width="20" height="20"/>
+ <rect x="70" y="70" width="20" height="20"/>
+ </clipPath>
+
+ <rect x="10" y="10" width="100" height="100" fill="#00D000"
+ clip-path="url(#myClip)"/>
+</svg>