diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-02-28 13:10:04 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-02-29 17:52:05 +0100 |
commit | c73f3491bedafef884196c761d8f3d89f4dcff75 (patch) | |
tree | b717a9b94efa2180f82ef2c13e4a00b229b5dd34 /svgio/qa | |
parent | 1245614991654b9d3ddb15f644a689585fd4c9de (diff) |
tdf#159947: Add support for in and result filter attributes
Change-Id: I8bc7e319a64c528893de8454c64545146ad4e9d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164108
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 47 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/inFilterAttribute.svg | 13 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/resultFilterAttribute.svg | 13 |
3 files changed, 73 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 9eb8b37d70ca..99541f0b63b7 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -212,6 +212,53 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur) assertXPath(pDocument, "/primitive2D/transform/softedge"_ostr, "radius"_ostr, "5"); } +CPPUNIT_TEST_FIXTURE(Test, testInFilterAttribute) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/inFilterAttribute.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, the feGaussianBlur and feColorMatrix filter would have been applied + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy11"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy13"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy22"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy23"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy33"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#ffffff"); +} + +CPPUNIT_TEST_FIXTURE(Test, testResultFilterAttribute) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/resultFilterAttribute.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, the feColorMatrix filter would have been applied + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy11"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy12"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy13"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy21"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy22"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy23"_ostr, "40"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy31"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy32"_ostr, "0"); + assertXPath(pDocument, "/primitive2D/transform/transform"_ostr, "xy33"_ostr, "1"); + assertXPath(pDocument, "/primitive2D/transform/transform/softedge"_ostr, "radius"_ostr, "2"); + assertXPath(pDocument, "/primitive2D/transform/transform/softedge/polypolygoncolor"_ostr, "color"_ostr, "#ffffff"); +} + CPPUNIT_TEST_FIXTURE(Test, testFilterFeOffset) { Primitive2DSequence aSequenceTdf132246 = parseSvg(u"/svgio/qa/cppunit/data/filterFeOffset.svg"); diff --git a/svgio/qa/cppunit/data/inFilterAttribute.svg b/svgio/qa/cppunit/data/inFilterAttribute.svg new file mode 100644 index 000000000000..f6e17e46e4cc --- /dev/null +++ b/svgio/qa/cppunit/data/inFilterAttribute.svg @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 500 500"> + <defs> + <filter height="100" id="f1" width="100"> + <feGaussianBlur stdDeviation="2.0"/> + <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0"/> + <feOffset dx="40" dy="40" in="SourceGraphic"/> + </filter> + </defs> + <g> + <rect fill="#FFFFFF" filter="url(#f1)" height="70" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="10" y="10"/> + </g> +</svg> diff --git a/svgio/qa/cppunit/data/resultFilterAttribute.svg b/svgio/qa/cppunit/data/resultFilterAttribute.svg new file mode 100644 index 000000000000..8d46731095e1 --- /dev/null +++ b/svgio/qa/cppunit/data/resultFilterAttribute.svg @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 500 500"> + <defs> + <filter height="100" id="f1" width="100"> + <feGaussianBlur stdDeviation="2.0" result="output"/> + <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0"/> + <feOffset dx="40" dy="40" in="output"/> + </filter> + </defs> + <g> + <rect fill="#FFFFFF" filter="url(#f1)" height="70" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="10" y="10"/> + </g> +</svg> |