summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-06-23 21:52:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-06-23 23:03:21 +0200
commit9e83d35c4a22bcb465f0736dda9b752b29f83959 (patch)
tree9d3f53c8ab591d3a72dc3dfff0d2e5effd8cca79 /svgio
parentb901fd3b27191d5565376c5a708da43a2ac0f6ee (diff)
Make CppunitTest_svgio CPPUNIT_TEST_NAME=Test::testCssClassRedefinition robust
That recently introduced test systematically failed on my Fedora 36 machine with > /home/sbergman/lo2/core/test/source/xmltesttools.cxx:89:(anonymous namespace)::Test::testCssClassRedefinition > equality assertion failed > - Expected: 1 > - Actual : 0 > - In <>, XPath '/primitive2D/transform/textsimpleportion[1]' number of nodes is incorrect because the dumped data was > <?xml version="1.0" encoding="UTF-8"?> > <primitive2D> > <transform xy11="26" xy12="0" xy13="0" xy21="0" xy22="26" xy23="0" xy31="0" xy32="0" xy33="1"> > <mask> > <polypolygon height="100" width="50" minx="0" miny="0" maxx="50" maxy="100" path="m0 0h50v100h-50z"> > <polygon> > <point x="0" y="0"/> > <point x="50" y="0"/> > <point x="50" y="100"/> > <point x="0" y="100"/> > </polygon> > </polypolygon> > <textsimpleportion width="16" height="16" x="20" y="20" text="test" fontcolor="#ff0000" familyname="Sans"/> > </mask> > </transform> > </primitive2D> rather than the expected > <?xml version="1.0" encoding="UTF-8"?> > <primitive2D> > <transform xy11="26" xy12="0" xy13="0" xy21="0" xy22="26" xy23="0" xy31="0" xy32="0" xy33="1"> > <textsimpleportion width="16" height="16" x="20" y="20" text="test" fontcolor="#ff0000" familyname="Sans"/> > <hiddengeometry> > <polygonhairline color="#000000"> > <polygon>0,0 50,0 50,100 0,100</polygon> > </polygonhairline> > </hiddengeometry> > </transform> > </primitive2D> because in SvgSvgNode::decomposeSvgNode (svgio/source/svgreader/svgsvgnode.cxx) aSvgCanvasRange = 50x100@(0,0) vs. aContentRange = 31x11@(20,9) did not match the > if(aSvgCanvasRange.isInside(aContentRange)) branch ("no clip needed, but an invisible HiddenGeometryPrimitive2D...") but rather the > else if(aSvgCanvasRange.overlaps(aContentRange)) branch ("Clip is necessary") introducing the additional <mask> element. The size of aContentRange (and thus whether it is contained in or merely overlaps aSvgCanvasRange) is apparently affected by what actual font gets substituted for "Sans" in any given environment. The only font that is guaranteed to always be available and is not subject to --with-fonts (which isn't already demanded via gb_CppunitTest_use_more_fonts in svgio/CppunitTest_svgio.mk) appears to be "Open Symbol" (cf. extras/Package_fonts.mk), so use that (even if it doesn't have glyphs for the given text, but which should be irrelevant for this test). Change-Id: If6f6fdc481b313aa08803b4b3f406e01ff0be1ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136350 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx3
-rw-r--r--svgio/qa/cppunit/data/CssClassRedefinition.svg2
2 files changed, 3 insertions, 2 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 650dbdde67f6..4b5af1e54d84 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -852,7 +852,8 @@ void Test::testCssClassRedefinition()
CPPUNIT_ASSERT (pDocument);
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "test");
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#ff0000");
- assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans");
+ assertXPath(
+ pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Open Symbol");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/svgio/qa/cppunit/data/CssClassRedefinition.svg b/svgio/qa/cppunit/data/CssClassRedefinition.svg
index 87eb2023384b..384cf88482f9 100644
--- a/svgio/qa/cppunit/data/CssClassRedefinition.svg
+++ b/svgio/qa/cppunit/data/CssClassRedefinition.svg
@@ -2,7 +2,7 @@
<style type="text/css">
.c1 {fill:#00ff00}
<!-- this redefinition should be appended -->
- .c1 {font-family:Sans}
+ .c1 {font-family:Open Symbol}
<!-- this redefinition should change the color to red, replacing the first definition -->
.c1 {fill:#ff0000}
<!-- finally c1 should be equal to fill:#ff0000 and font-family:Sans -->