summaryrefslogtreecommitdiff
path: root/svgio/qa/cppunit
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-16 15:57:14 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-16 21:09:59 +0200
commit7d231453fcc75c2c621522098fe1d42b14be546b (patch)
tree0fc55dce528ce6f5d707a7f6b52d8f3332eb85a5 /svgio/qa/cppunit
parentd2e7616c66812ab87828720c52f7e1ed975e00ba (diff)
tdf#155735: unify unittest
Change-Id: I8de80f869715d4476e62f526e0bb161de8274977 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153181 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx22
-rw-r--r--svgio/qa/cppunit/data/filterFeColorMatrix.svg60
-rw-r--r--svgio/qa/cppunit/data/filterLuminanceToAlpha.svg11
-rw-r--r--svgio/qa/cppunit/data/filterSaturate.svg11
4 files changed, 66 insertions, 38 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 7184c5fa500b..ba267f5443a5 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -153,9 +153,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf155819)
assertXPath(pDocument, "/primitive2D/transform/transform", 4);
}
-CPPUNIT_TEST_FIXTURE(Test, testFilterSaturate)
+CPPUNIT_TEST_FIXTURE(Test, testFeColorMatrix)
{
- Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/filterSaturate.svg");
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/filterFeColorMatrix.svg");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
@@ -163,20 +163,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterSaturate)
CPPUNIT_ASSERT (pDocument);
- assertXPath(pDocument, "/primitive2D/transform/modifiedColor", "modifier", "saturate");
-}
-
-CPPUNIT_TEST_FIXTURE(Test, testFilterLuminanceToAlpha)
-{
- Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg");
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
-
- drawinglayer::Primitive2dXmlDump dumper;
- xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
-
- CPPUNIT_ASSERT (pDocument);
-
- assertXPath(pDocument, "/primitive2D/transform/modifiedColor", "modifier", "luminance_to_alpha");
+ //assertXPath(pDocument, "/primitive2D/transform/mask/transform[1]/modifiedColor", "modifier", "matrix");
+ assertXPath(pDocument, "/primitive2D/transform/mask/transform[2]/modifiedColor", "modifier", "saturate");
+ //assertXPath(pDocument, "/primitive2D/transform/mask/transform[3]/modifiedColor", "modifier", "hueRotate");
+ assertXPath(pDocument, "/primitive2D/transform/mask/transform[4]/modifiedColor", "modifier", "luminance_to_alpha");
}
CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur)
diff --git a/svgio/qa/cppunit/data/filterFeColorMatrix.svg b/svgio/qa/cppunit/data/filterFeColorMatrix.svg
new file mode 100644
index 000000000000..07d5559ed1b6
--- /dev/null
+++ b/svgio/qa/cppunit/data/filterFeColorMatrix.svg
@@ -0,0 +1,60 @@
+<svg
+ width="100%"
+ height="100%"
+ viewBox="0 0 150 500"
+ preserveAspectRatio="xMidYMid meet"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- ref -->
+ <defs>
+ <g id="circles">
+ <circle cx="30" cy="30" r="20" fill="blue" fill-opacity="0.5" />
+ </g>
+ </defs>
+ <use href="#circles" />
+ <text x="70" y="50">Reference</text>
+
+ <!-- Combine RGB into green matrix -->
+ <filter id="colorMeGreen">
+ <feColorMatrix
+ in="SourceGraphic"
+ type="matrix"
+ values="0 0 0 0 0
+ 1 1 1 1 0
+ 0 0 0 0 0
+ 0 0 0 1 0" />
+ </filter>
+ <use
+ href="#circles"
+ transform="translate(0 70)"
+ filter="url(#colorMeGreen)" />
+ <text x="70" y="120">rgbToGreen</text>
+
+ <!-- saturate -->
+ <filter id="colorMeSaturate">
+ <feColorMatrix in="SourceGraphic" type="saturate" values="0.2" />
+ </filter>
+ <use
+ href="#circles"
+ transform="translate(0 140)"
+ filter="url(#colorMeSaturate)" />
+ <text x="70" y="190">saturate</text>
+
+ <!-- hueRotate -->
+ <filter id="colorMeHueRotate">
+ <feColorMatrix in="SourceGraphic" type="hueRotate" values="180" />
+ </filter>
+ <use
+ href="#circles"
+ transform="translate(0 210)"
+ filter="url(#colorMeHueRotate)" />
+ <text x="70" y="260">hueRotate</text>
+
+ <!-- luminanceToAlpha -->
+ <filter id="colorMeLTA">
+ <feColorMatrix in="SourceGraphic" type="luminanceToAlpha" />
+ </filter>
+ <use href="#circles" transform="translate(0 280)" filter="url(#colorMeLTA)" />
+ <text x="70" y="330">luminanceToAlpha</text>
+</svg>
+
diff --git a/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg b/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg
deleted file mode 100644
index 854fad125446..000000000000
--- a/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<svg
- width="230"
- height="120"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink">
- <filter id="luminanceToAlpha">
- <feColorMatrix type="luminanceToAlpha"/>
- </filter>
- <circle cx="170" cy="60" r="50" fill="green" filter="url(#luminanceToAlpha)" />
-</svg>
-
diff --git a/svgio/qa/cppunit/data/filterSaturate.svg b/svgio/qa/cppunit/data/filterSaturate.svg
deleted file mode 100644
index 3fc1ab89f538..000000000000
--- a/svgio/qa/cppunit/data/filterSaturate.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<svg
- width="230"
- height="120"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink">
- <filter id="saturate">
- <feColorMatrix type="saturate" values="0.5"/>
- </filter>
- <circle cx="170" cy="60" r="50" fill="green" filter="url(#saturate)" />
-</svg>
-