diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-20 18:15:08 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-20 20:52:13 +0200 |
commit | b0c2e580a1c5b055295d303ebb9c9e905ab4890c (patch) | |
tree | 135becb68cc5850232a2c224c7080fe842ea1ce8 /svgio/qa/cppunit | |
parent | 862cdd148d5c6f9563f8a9b11f7559cd022c9c4a (diff) |
tdf#155814: only check parent style when it has a local css style
This also fixes the problem for filters and mask, since they
are call from add_postProcess
Adapt some tests to the new xml output. Visually nothing has changed
Change-Id: I65d2491409019f4cd0b1113a9a7931fc602c57b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153355
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 46 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf155814.svg | 25 |
2 files changed, 55 insertions, 16 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index cb7fc790c375..87c99ba72509 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -163,10 +163,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFeColorMatrix) CPPUNIT_ASSERT (pDocument); - //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"); + //assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor", "modifier", "matrix"); + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[1]", "modifier", "saturate"); + //assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor", "modifier", "hueRotate"); + assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[2]", "modifier", "luminance_to_alpha"); } CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur) @@ -717,10 +717,24 @@ CPPUNIT_TEST_FIXTURE(Test, testClipPathAndParentStyle) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#ff0000"); - assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#000000"); - assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#000000"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "5"); + +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf155814) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155814.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/mask/mask/transform/unifiedtransparence", "transparence", "50"); + assertXPath(pDocument, "/primitive2D/transform/mask/mask/transform/unifiedtransparence/polypolygoncolor", "color", "#0000ff"); } CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle) @@ -735,9 +749,9 @@ CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#ccccff"); - assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#0000cc"); - assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "2"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#ccccff"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#0000cc"); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "2"); } @@ -915,10 +929,10 @@ CPPUNIT_TEST_FIXTURE(Test, testMaskText) CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#000000"); - assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion", "fontcolor", "#ffffff"); - assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion", "text", "Black White"); - assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion", "height", "26"); - assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion", "familyname", "Times New Roman"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "fontcolor", "#ffffff"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "text", "Black White"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "height", "26"); + assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "familyname", "Times New Roman"); } CPPUNIT_TEST_FIXTURE(Test, testTdf99994) @@ -1096,12 +1110,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf155733) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/transform[1]/softedge", "radius", "5"); + assertXPath(pDocument, "/primitive2D/transform/softedge", "radius", "5"); // Without the fix in place, the softedge would have been applied to the second element // - Expected: 1 // - Actual : 0 - assertXPath(pDocument, "/primitive2D/transform/transform[2]/unifiedtransparence", "transparence", "50"); + assertXPath(pDocument, "/primitive2D/transform/transform/unifiedtransparence", "transparence", "50"); } CPPUNIT_TEST_FIXTURE(Test, testTdf97663) diff --git a/svgio/qa/cppunit/data/tdf155814.svg b/svgio/qa/cppunit/data/tdf155814.svg new file mode 100644 index 000000000000..5ac2e8297379 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf155814.svg @@ -0,0 +1,25 @@ +<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> + <clipPath id="myClip"> + <!-- + Everything outside the circle will be + clipped and therefore invisible. + --> + <circle r="35" /> + </clipPath> + + <use xlink:href="#circles" transform="translate(0 50)" clip-path="url(#myClip)" /> + <use xlink:href="#circles" transform="translate(0 100)" /> +</svg> + |