From 9e83d35c4a22bcb465f0736dda9b752b29f83959 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 23 Jun 2022 21:52:52 +0200 Subject: 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 > > > > > > > > > > > > > > > > rather than the expected > > > > > > > 0,0 50,0 50,100 0,100 > > > > 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 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 --- svgio/qa/cppunit/SvgImportTest.cxx | 3 ++- svgio/qa/cppunit/data/CssClassRedefinition.svg | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'svgio') 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 @@