diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-03-14 23:53:49 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-03-15 01:06:22 +0100 |
commit | b240f6198fae7221b7cd3e4678403ad99827b53d (patch) | |
tree | 4fe24d057f26b58ccc17af4355485ad8ae0518dd /svgio/qa/cppunit | |
parent | ad161bf882099553949469f99759493c38169c8a (diff) |
tdf#48062: Add support for xor, in and out operators in feComposite
atop and arithmetic are still missing
Change-Id: I9b5bfeaa87b48071708ca4cb082916ea5f260adb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164852
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 28 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/filterFeComposite.svg | 44 |
2 files changed, 53 insertions, 19 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 1d875e2b74a7..dc933c9693dc 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -235,20 +235,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterFeComposite) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]"_ostr, "color"_ostr, "#ff0000"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "height"_ostr, "100"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "width"_ostr, "100"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "minx"_ostr, "70"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "miny"_ostr, "70"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "maxx"_ostr, "170"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[1]/polypolygon"_ostr, "maxy"_ostr, "170"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]"_ostr, "color"_ostr, "#6ab150"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "height"_ostr, "100"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "width"_ostr, "100"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "minx"_ostr, "30"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "miny"_ostr, "30"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "maxx"_ostr, "130"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor[2]/polypolygon"_ostr, "maxy"_ostr, "130"); + assertXPath(pDocument, "/primitive2D/transform/mask"_ostr, 5); + // over operator + assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point"_ostr, 8); + // xor operator + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon[1]/point"_ostr, 8); + assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon[2]/point"_ostr, 4); + // in operator + assertXPath(pDocument, "/primitive2D/transform/mask[3]/polypolygoncolor"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/mask[3]/polypolygon/polygon/point"_ostr, 4); + // out operator + assertXPath(pDocument, "/primitive2D/transform/mask[4]/polypolygoncolor"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/mask[4]/polypolygon/polygon/point"_ostr, 6); } CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur) diff --git a/svgio/qa/cppunit/data/filterFeComposite.svg b/svgio/qa/cppunit/data/filterFeComposite.svg index 0662eaa6f547..eea28d04647f 100644 --- a/svgio/qa/cppunit/data/filterFeComposite.svg +++ b/svgio/qa/cppunit/data/filterFeComposite.svg @@ -1,10 +1,44 @@ -<svg width="100" height="120" viewBox="0 0 200 240" xmlns="http://www.w3.org/2000/svg"> +<svg width="100%" height="100%" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg"> <defs> - <filter id="filter" filterUnits="userSpaceOnUse" x="0" y="0" width="100%" height="100%"> - <feFlood x="30" y="30" width="100" height="100" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> - <feFlood x="70" y="70" width="100" height="100" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> + <filter id="over" filterUnits="userSpaceOnUse"> + <feFlood x="3" y="3" width="10" height="10" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> + <feFlood x="7" y="7" width="10" height="10" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> <feComposite in="img1" in2="img2" operator="over"></feComposite> </filter> + <filter id="xor" filterUnits="userSpaceOnUse"> + <feFlood x="3" y="23" width="10" height="10" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> + <feFlood x="7" y="27" width="10" height="10" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> + <feComposite in="img1" in2="img2" operator="xor"></feComposite> + </filter> + <filter id="in" filterUnits="userSpaceOnUse"> + <feFlood x="3" y="43" width="10" height="10" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> + <feFlood x="7" y="47" width="10" height="10" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> + <feComposite in="img1" in2="img2" operator="in"></feComposite> + </filter> + <filter id="out" filterUnits="userSpaceOnUse"> + <feFlood x="3" y="63" width="10" height="10" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> + <feFlood x="7" y="67" width="10" height="10" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> + <feComposite in="img1" in2="img2" operator="out"></feComposite> + </filter> + <filter id="atop" filterUnits="userSpaceOnUse"> + <feFlood x="3" y="83" width="10" height="10" flood-color="#6ab150" flood-opacity="1" result="img1"></feFlood> + <feFlood x="7" y="87" width="10" height="10" flood-color="#ff0000" flood-opacity="1" result="img2"></feFlood> + <feComposite in="img1" in2="img2" operator="atop"></feComposite> + </filter> </defs> - <use style="filter: url(#filter)"></use> + + <use style="filter: url(#over)"></use> + <text x="20" y="10" dominant-baseline="middle" style="font-size:5px;">operator="over"</text> + + <use style="filter: url(#xor)"></use> + <text x="20" y="30" dominant-baseline="middle" style="font-size:5px;">operator="xor"</text> + + <use style="filter: url(#in)"></use> + <text x="20" y="50" dominant-baseline="middle" style="font-size:5px;">operator="in"</text> + + <use style="filter: url(#out)"></use> + <text x="20" y="70" dominant-baseline="middle" style="font-size:5px;">operator="out"</text> + + <use style="filter: url(#atop)"></use> + <text x="20" y="90" dominant-baseline="middle" style="font-size:5px;">operator="atop"</text> </svg> |