bin/find-mergedlib-can-be-private-symbols.functions.results | 2 drawinglayer/source/tools/primitive2dxmldump.cxx | 20 - emfio/qa/cppunit/emf/EmfImportTest.cxx | 200 +++++++----- include/test/xmltesttools.hxx | 4 include/tools/XmlWriter.hxx | 10 sd/qa/unit/layout-tests.cxx | 11 svgio/qa/cppunit/SvgImportTest.cxx | 138 ++++---- svx/qa/unit/sdr.cxx | 42 +- svx/qa/unit/svdraw.cxx | 6 tools/source/xml/XmlWriter.cxx | 2 10 files changed, 244 insertions(+), 191 deletions(-)
New commits: commit 8459f0be517b067a69e2cfaaf10fe1eedbc2014b Author: Noel Grandin <[email protected]> AuthorDate: Sat Mar 7 15:21:04 2026 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Mar 10 15:49:17 2026 +0100 XmlWriter::attribute(double) should actually write a double value And not truncate it to an integer value. Add additional overload for attribute that takes an enumerated type, otherwise the compiler will complain about ambiguous conversion because it cannot choose between the attribute that takes a integral value and the one that takes a double value. Change-Id: I9eae22817ec3b26da7b9468d1c8b5e6f3e900538 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201193 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Jenkins diff --git a/bin/find-mergedlib-can-be-private-symbols.functions.results b/bin/find-mergedlib-can-be-private-symbols.functions.results index d50c4fc4df7f..ec603f82ca4c 100644 --- a/bin/find-mergedlib-can-be-private-symbols.functions.results +++ b/bin/find-mergedlib-can-be-private-symbols.functions.results @@ -15903,7 +15903,7 @@ tools::Time::init(unsigned int, unsigned int, unsigned int, unsigned long) tools::WritePolyPolygon(SvStream&, tools::PolyPolygon const&) tools::WritePolygon(SvStream&, tools::Polygon const&) tools::XmlWriter::attributeBase64(char const*, std::vector<char, std::allocator<char> > const&) -tools::XmlWriter::attributeDouble(char const*, double) +tools::XmlWriter::attribute(char const*, double) tools::XmlWriter::element(char const*) tools::isEmptyFileUrl(rtl::OUString const&) tools::operator+(tools::Time const&, tools::Time const&) diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 4cd2d1604b16..0a0ba8513e24 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -141,8 +141,8 @@ void writePolyPolygon(::tools::XmlWriter& rWriter, const basegfx::B2DPolyPolygon basegfx::B2DPoint const& rPoint = rPolygon.getB2DPoint(i); rWriter.startElement("point"); - rWriter.attributeDouble("x", rPoint.getX()); - rWriter.attributeDouble("y", rPoint.getY()); + rWriter.attribute("x", rPoint.getX()); + rWriter.attribute("y", rPoint.getY()); rWriter.endElement(); } rWriter.endElement(); @@ -796,8 +796,8 @@ void Primitive2dXmlDump::decomposeAndWrite( iter != aPositions.end(); ++iter) { rWriter.startElement("point"); - rWriter.attributeDouble("x", iter->getX()); - rWriter.attributeDouble("y", iter->getY()); + rWriter.attribute("x", iter->getX()); + rWriter.attribute("y", iter->getY()); rWriter.endElement(); } @@ -986,7 +986,7 @@ void Primitive2dXmlDump::decomposeAndWrite( for (size_t iDx = 0; iDx < aDx.size(); ++iDx) { OString sName = "dx" + OString::number(iDx); - rWriter.attributeDouble(sName.getStr(), aDx[iDx]); + rWriter.attribute(sName.getStr(), aDx[iDx]); } } rWriter.endElement(); @@ -1064,9 +1064,9 @@ void Primitive2dXmlDump::decomposeAndWrite( basegfx::B2DPoint aStartPoint = rSvgRadialGradientPrimitive2D.getStart(); rWriter.attribute("startx", aStartPoint.getX()); rWriter.attribute("starty", aStartPoint.getY()); - rWriter.attributeDouble("radius", rSvgRadialGradientPrimitive2D.getRadius()); + rWriter.attribute("radius", rSvgRadialGradientPrimitive2D.getRadius()); writeSpreadMethod(rWriter, rSvgRadialGradientPrimitive2D.getSpreadMethod()); - rWriter.attributeDouble( + rWriter.attribute( "opacity", rSvgRadialGradientPrimitive2D.getGradientEntries().front().getOpacity()); @@ -1092,7 +1092,7 @@ void Primitive2dXmlDump::decomposeAndWrite( rWriter.attribute("endx", aEndAttribute.getX()); rWriter.attribute("endy", aEndAttribute.getY()); writeSpreadMethod(rWriter, rSvgLinearGradientPrimitive2D.getSpreadMethod()); - rWriter.attributeDouble( + rWriter.attribute( "opacity", rSvgLinearGradientPrimitive2D.getGradientEntries().front().getOpacity()); @@ -1182,7 +1182,7 @@ void Primitive2dXmlDump::decomposeAndWrite( rWriter.startElement("shadow"); rWriter.attribute("color", convertColorToString(rShadowPrimitive2D.getShadowColor())); - rWriter.attributeDouble("blur", rShadowPrimitive2D.getShadowBlur()); + rWriter.attribute("blur", rShadowPrimitive2D.getShadowBlur()); rWriter.startElement("transform"); writeMatrix(rWriter, rShadowPrimitive2D.getShadowTransform()); @@ -1212,7 +1212,7 @@ void Primitive2dXmlDump::decomposeAndWrite( const auto& rSoftEdgePrimitive2D = static_cast<const SoftEdgePrimitive2D&>(*pBasePrimitive); rWriter.startElement("softedge"); - rWriter.attributeDouble("radius", rSoftEdgePrimitive2D.getRadius()); + rWriter.attribute("radius", rSoftEdgePrimitive2D.getRadius()); decomposeAndWrite(rSoftEdgePrimitive2D.getChildren(), rWriter); rWriter.endElement(); diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 349985874108..87a3e1b068ed 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -128,12 +128,12 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawImagePointsTypeBitmap) CPPUNIT_ASSERT(pDocument); assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color", u"#0080ff"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy11", u"5347"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy12", u"0"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy13", u"5558"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy21", u"0"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy22", u"4717"); - assertXPath(pDocument, aXPathPrefix + "bitmap", "xy23", u"5565"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy11", 5346.738, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy12", 0.0, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy13", 5558.490, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy21", 0.0, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy22", 4716.827, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "bitmap", "xy23", 5564.796, 0.001); assertXPath( pDocument, aXPathPrefix + "bitmap/data[2]", "row", u"020202,ffffff,ffffff,ffffff,fefefe,ffffff,ffffff,fefefe,ffffff,ffffff,f8f8f8,ffffff," @@ -164,12 +164,16 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawImagePointsWithMetafile) assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "miny", u"0"); assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "maxx", u"6921"); assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "maxy", u"20306"); - assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy11", u"1"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy11", 1.360, + 0.001); assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy12", u"0"); - assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy13", u"-3279"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy13", + -3278.561, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy21", u"0"); - assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy22", u"1"); - assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy23", u"-176"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy22", 1.341, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/mask/metafile/transform", "xy23", + -176.139, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/polypolygon", "height", u"15747"); @@ -180,24 +184,24 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawImagePointsWithMetafile) pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform/mask/group", 17); - assertXPath(pDocument, - aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy11", - u"1"); + assertXPathDoubleValue( + pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", + "xy11", 0.791, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy12", u"0"); - assertXPath(pDocument, - aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy13", - u"3"); + assertXPathDoubleValue( + pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", + "xy13", 3.448, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy21", u"0"); - assertXPath(pDocument, - aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy22", - u"1"); - assertXPath(pDocument, - aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", "xy23", - u"-140"); + assertXPathDoubleValue( + pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", + "xy22", 0.799, 0.001); + assertXPathDoubleValue( + pDocument, aXPathPrefix + "mask/mask/metafile/transform/mask/mask/metafile/transform", + "xy23", -139.638, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testFillRectsWithTextureBrush) @@ -239,7 +243,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFillRectsWithTextureBrush) u"fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe," u"fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe,fefefe"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke/line", "width", u"26"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke/line", "width", 26.439, + 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke/polypolygon", "minx", u"397"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke/polypolygon", "miny", u"397"); } @@ -258,8 +263,10 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawString) // check correct import of the DrawString: height, position, text, color and font assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "height", u"120"); - assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "x", u"817"); - assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "y", u"1138"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform/textsimpleportion", "x", 817.219, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform/textsimpleportion", "y", 1137.569, + 0.001); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "text", u"TEST"); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "fontcolor", u"#000000"); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "familyname", u"CALIBRI"); @@ -290,7 +297,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringAlign) assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "width", u"12"); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "height", u"12"); - assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "x", u"144"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "x", + 143.666, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "y", u"22"); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "text", u"HCVT"); @@ -307,7 +315,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringAlign) assertXPath(pDocument, aXPathPrefix + "mask/transform[4]/textsimpleportion", "y", u"66"); assertXPath(pDocument, aXPathPrefix + "mask/transform[4]/textsimpleportion", "text", u"HLVC"); - assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "x", u"143"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "x", + 143.0, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "y", u"66"); assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "text", u"HCVC"); @@ -322,7 +331,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringAlign) assertXPath(pDocument, aXPathPrefix + "mask/transform[7]/textsimpleportion", "y", u"110"); assertXPath(pDocument, aXPathPrefix + "mask/transform[7]/textsimpleportion", "text", u"HLVB"); - assertXPath(pDocument, aXPathPrefix + "mask/transform[8]/textsimpleportion", "x", u"143"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/transform[8]/textsimpleportion", "x", + 143.330, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/transform[8]/textsimpleportion", "y", u"110"); assertXPath(pDocument, aXPathPrefix + "mask/transform[8]/textsimpleportion", "text", u"HCVB"); @@ -407,12 +417,12 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusDrawBeziers) u"#000000"); assertXPath(pDocument, aXPathPrefix + "transform[1]/textsimpleportion", "text", u"% Efficiency"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy11", u"0"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy12", u"4"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy13", u"800"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy21", u"-4"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy22", u"0"); - assertXPath(pDocument, aXPathPrefix + "transform[1]", "xy23", u"3196"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy11", 0.0, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy12", 4.235, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy13", 800.471, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy21", -4.227, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy22", 0.0, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "transform[1]", "xy23", 3195.818, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testDrawLine) @@ -429,8 +439,9 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawLine) assertXPath(pDocument, aXPathPrefix + "mask/unifiedtransparence", "transparence", u"14"); assertXPath(pDocument, aXPathPrefix + "mask/unifiedtransparence/polypolygonstroke/line", "color", u"#c01002"); - assertXPath(pDocument, aXPathPrefix + "mask/unifiedtransparence/polypolygonstroke/line", - "width", u"115"); + assertXPathDoubleValue(pDocument, + aXPathPrefix + "mask/unifiedtransparence/polypolygonstroke/line", + "width", 115.273, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/unifiedtransparence/polypolygonstroke/line", "linecap", u"BUTT"); assertXPath(pDocument, aXPathPrefix + "mask/unifiedtransparence/polypolygonstroke/polypolygon", @@ -449,19 +460,22 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawLineWithCaps) CPPUNIT_ASSERT(pDocument); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow", 3); - assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[1]/line", "width", u"212"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polygonstrokearrow[1]/line", "width", 211.597, + 0.001); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[1]/stroke", 0); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[1]/linestartattribute/polypolygon", "path", u"m0-1 1 2h-2z"); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[1]/lineendattribute", 0); - assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[2]/line", "width", u"212"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polygonstrokearrow[2]/line", "width", 211.597, + 0.001); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[2]/stroke", 0); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[2]/linestartattribute/polypolygon", "path", u"m0-1 1 2h-2z"); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[2]/lineendattribute", 0); - assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[3]/line", "width", u"423"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polygonstrokearrow[3]/line", "width", 423.194, + 0.001); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[3]/stroke", 0); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[3]/linestartattribute", 0); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow[3]/lineendattribute/polypolygon", @@ -505,25 +519,31 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawLineWithDash) // check correct import of the DrawLine: color and width of the line assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke", 10); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[1]/line", "color", u"#000000"); - assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[1]/line", "width", u"185"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polypolygonstroke[1]/line", "width", + 185.147, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[1]/stroke", 0); - assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[2]/line", "width", u"185"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polypolygonstroke[2]/line", "width", + 185.149, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[2]/stroke", "dotDashArray", u"185 185 "); - assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[3]/line", "width", u"185"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polypolygonstroke[3]/line", "width", + 185.156, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[3]/stroke", "dotDashArray", u"556 185 "); - assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[4]/line", "width", u"185"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polypolygonstroke[4]/line", "width", + 185.167, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[4]/stroke", "dotDashArray", u"556 185 185 185 "); - assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[5]/line", "width", u"370"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polypolygonstroke[5]/line", "width", + 370.360, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygonstroke[5]/stroke", "dotDashArray", u"556 185 185 185 185 185 "); assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow", 2); //TODO polypolygonstroke[6-9]/stroke add support for PenDataDashedLineOffset - assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow[1]/line", "width", u"370"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polygonstrokearrow[1]/line", "width", + 370.453, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow[1]/stroke", "dotDashArray", u"1851 741 5554 1481 "); // Arrows on both ends @@ -533,7 +553,8 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawLineWithDash) assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow[1]/lineendattribute/polypolygon", "path", u"m0-1 1 2h-2z"); - assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow[2]/line", "width", u"370"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/polygonstrokearrow[2]/line", "width", + 370.443, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow[2]/stroke", "dotDashArray", u"1852 741 5555 1481 "); assertXPath(pDocument, @@ -555,12 +576,12 @@ CPPUNIT_TEST_FIXTURE(Test, testLinearGradient) xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); CPPUNIT_ASSERT(pDocument); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy11", u"1"); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy12", u"0"); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy13", u"0"); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy21", u"0"); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy22", u"1"); - assertXPath(pDocument, "/primitive2D/metafile/transform", "xy23", u"0"); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy11", 1.0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy12", 0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy13", 0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy21", 0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy22", 1.0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/metafile/transform", "xy23", 0, 0.001); assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "height", u"7610"); assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "width", u"15232"); assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", u"m0 0h15232v7610h-15232z"); @@ -568,18 +589,24 @@ CPPUNIT_TEST_FIXTURE(Test, testLinearGradient) assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "spreadmethod", u"repeat"); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "startx", u"0"); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "starty", u"-1"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "endx", u"0"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "endy", u"-1"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "endx", 0.333, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "endy", -1.0, + 0.001); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "opacity", u"0.392156862745098"); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]/polypolygon", "path", u"m0 0.216110019646294h7615.75822989747v7610.21611001965h-7615.75822989747z"); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "spreadmethod", u"repeat"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "startx", u"-1"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "starty", u"-1"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "endx", u"-1"); - assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "endy", u"-1"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "startx", -1.083, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "starty", -1.0, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "endx", -0.916, + 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "endy", -1.0, + 0.001); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "opacity", u"1"); assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]/polypolygon", "path", u"m7615.75822989747 " @@ -1025,8 +1052,8 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusBrushPathGradientWithBlendColors) assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "radius", u"0.7"); assertXPath(pDocument, aXPathPrefix + "svgradialgradient/focalx", 0); assertXPath(pDocument, aXPathPrefix + "svgradialgradient/focaly", 0); - assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "startx", u"1"); - assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "starty", u"1"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "svgradialgradient", "startx", 0.5, 0.001); + assertXPathDoubleValue(pDocument, aXPathPrefix + "svgradialgradient", "starty", 0.5, 0.001); assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "spreadmethod", u"pad"); } @@ -1235,7 +1262,8 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusDrawPathWithCustomCap) assertXPathContent(pDocument, aXPathPrefix + "polygonstrokearrow/polygon", u"1423.297394625,1268.98481214025 705.717657763014,1304.88786195939"); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", "color", u"#cc0000"); - assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", "width", u"96"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polygonstrokearrow/line", "width", 96.465, + 0.001); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/line", "linecap", u"BUTT"); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/stroke", 0); assertXPath(pDocument, aXPathPrefix + "polygonstrokearrow/linestartattribute", 0); @@ -1258,7 +1286,8 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusDrawPathWithMiterLimit) assertXPath(pDocument, aXPathPrefix + "polypolygonstroke", 3); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "color", u"#c800c8"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", u"1058"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", 1057.985, + 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linejoin", u"Miter"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "miterangle", u"5"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/stroke", 0); @@ -1267,27 +1296,33 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusDrawPathWithMiterLimit) assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]", "transparence", u"85"); assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "color", u"#6400c8"); - assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "width", - u"1058"); + assertXPathDoubleValue(pDocument, + aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "width", + 1057.985, 0.001); assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", "linejoin", u"Miter"); - assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", - "miterangle", u"19"); + assertXPathDoubleValue(pDocument, + aXPathPrefix + "unifiedtransparence[1]/polypolygonstroke/line", + "miterangle", 19.188, 0.001); assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[2]", "transparence", u"69"); - assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[2]/polypolygonstroke/line", - "miterangle", u"19"); + assertXPathDoubleValue(pDocument, + aXPathPrefix + "unifiedtransparence[2]/polypolygonstroke/line", + "miterangle", 19.188, 0.001); assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[3]", "transparence", u"53"); - assertXPath(pDocument, aXPathPrefix + "unifiedtransparence[3]/polypolygonstroke/line", - "miterangle", u"19"); + assertXPathDoubleValue(pDocument, + aXPathPrefix + "unifiedtransparence[3]/polypolygonstroke/line", + "miterangle", 19.188, 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "color", u"#0000ff"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", u"1058"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", 1057.985, + 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "linejoin", u"Miter"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "miterangle", u"60"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/stroke", 0); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "color", u"#0000ff"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "width", u"1058"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "width", 1057.985, + 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "linejoin", u"Miter"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/line", "miterangle", u"60"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[3]/stroke", 0); @@ -1353,12 +1388,15 @@ CPPUNIT_TEST_FIXTURE(Test, testEmfPlusFillClosedCurve) assertXPath(pDocument, aXPathPrefix + "polypolygonstroke", 2); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "color", u"#00ff00"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", u"4"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "width", 4.233, + 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linejoin", u"Miter"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "miterangle", u"4"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "miterangle", + 3.82, 0.001); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[1]/line", "linecap", u"BUTT"); assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "color", u"#aaaa00"); - assertXPath(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", u"4"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "polypolygonstroke[2]/line", "width", 4.233, + 0.001); } CPPUNIT_TEST_FIXTURE(Test, testExtTextOutOpaqueAndClipTransform) @@ -1437,7 +1475,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExtTextOutScaleGM_COMPATIBLE) assertXPath(pDocument, aXPathPrefix + "textsimpleportion[2]", "text", u"23"); assertXPath(pDocument, aXPathPrefix + "textsimpleportion[2]", "fontcolor", u"#000000"); - assertXPath(pDocument, aXPathPrefix + "textsimpleportion[2]", "width", u"161"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "textsimpleportion[2]", "width", 160.0, 1.0); assertXPath(pDocument, aXPathPrefix + "textsimpleportion[2]", "height", u"317"); assertXPath(pDocument, aXPathPrefix + "textsimpleportion[3]", "text", u"24"); @@ -1445,7 +1483,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExtTextOutScaleGM_COMPATIBLE) #ifndef _WIN32 //FIXME assertXPath(pDocument, aXPathPrefix + "textsimpleportion[3]", "width", u"201"); #else - assertXPath(pDocument, aXPathPrefix + "textsimpleportion[3]", "width", u"199"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "textsimpleportion[3]", "width", 199.0, 1.0); #endif assertXPath(pDocument, aXPathPrefix + "textsimpleportion[3]", "height", u"317"); @@ -1454,7 +1492,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExtTextOutScaleGM_COMPATIBLE) #ifndef _WIN32 //FIXME assertXPath(pDocument, aXPathPrefix + "textsimpleportion[4]", "width", u"268"); #else - assertXPath(pDocument, aXPathPrefix + "textsimpleportion[4]", "width", u"267"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "textsimpleportion[4]", "width", 267.0, 1.0); #endif assertXPath(pDocument, aXPathPrefix + "textsimpleportion[4]", "height", u"317"); @@ -1813,7 +1851,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCreatePen) #ifndef _WIN32 // FIXME assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "width", u"310"); #else - assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "width", u"308"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "width", 308.0, + 2.0); #endif assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "x", u"28124"); assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "y", u"16581"); @@ -1821,7 +1860,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCreatePen) assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[1]", "fontcolor", u"#000000"); assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "height", u"266"); - assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "width", u"221"); + assertXPathDoubleValue(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "width", 220.0, + 1.0); assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "x", u"28000"); assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "y", u"428"); assertXPath(pDocument, aXPathPrefix + "mask/textsimpleportion[10]", "text", u"-6"); diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index 8c6b3fbe2e22..b60da3a09fe2 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -138,6 +138,10 @@ protected: */ void assertXPathDoubleValue(const xmlDocUniquePtr& pXmlDoc, const char* pXPath, const char* pAttribute, double expectedValue, double delta); + void assertXPathDoubleValue(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const char* pAttribute, + double expectedValue, double delta) + { assertXPathDoubleValue(pXmlDoc, rXPath.getStr(), pAttribute, expectedValue, delta); } + /** * Assert that pXPath exists, and returns exactly nNumberOfNodes nodes (1 by default). * Also useful for checking that we do _not_ export some node (nNumberOfNodes == 0). diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx index 1ad34bcdac0e..843762699f78 100644 --- a/include/tools/XmlWriter.hxx +++ b/include/tools/XmlWriter.hxx @@ -59,13 +59,15 @@ public: void attribute(const char* sTagName, sal_Int64 aNumber); template <o3tl::integral T> void attribute(const char* sTagName, T aNumber) { - return attribute(sTagName, static_cast<sal_Int64>(aNumber)); + attribute(sTagName, static_cast<sal_Int64>(aNumber)); } - template <o3tl::floating_point T> void attribute(const char* sTagName, T aNumber) + template <class T> + typename std::enable_if<std::is_enum<T>::value, void>::type attribute(const char* sTagName, + T aNumber) { - return attribute(sTagName, basegfx::fround64(aNumber)); + attribute(sTagName, static_cast<sal_Int64>(aNumber)); } - void attributeDouble(const char* sTagName, double aNumber); + void attribute(const char* sTagName, double aNumber); void attributeBase64(const char* sTagName, std::vector<sal_uInt8> const& rValueInBytes); void attributeBase64(const char* sTagName, std::vector<char> const& rValueInBytes); diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index afffbf4cfb37..9dbad5d9f539 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -365,11 +365,16 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testFitToFrameTextFitting) assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", u"0"); assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "y", u"406"); - assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "first", u"114"); #ifndef _WIN32 // FIXME: Windows seems to differ in text layouting - assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "last", u"6984"); + assertXPathDoubleValue(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "first", + 114.087, 0.001); + assertXPathDoubleValue(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "last", + 6983.573, 0.001); #else - assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "last", u"6956"); + assertXPathDoubleValue(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "first", + 113.64, 0.001); + assertXPathDoubleValue(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "last", + 6956.219, 0.001); #endif } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index f8a6892c7c61..8e350fb9ebb6 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -385,17 +385,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeKeywords) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"9"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", 9.259, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#ffffff"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"11"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", 11.111, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", u"#ffd700"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"13"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", 13.333, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", u"#ff0000"); @@ -405,27 +405,27 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeKeywords) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", u"#ffff00"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", u"19"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", 19.2, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", u"#0000ff"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", u"23"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", 23.04, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", u"#008000"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", u"28"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", 27.648, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", u"#ff7f50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", u"13"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", 13.333, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", u"#ffc0cb"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"Sample"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", u"19"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", 19.2, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "fontcolor", u"#fffff0"); @@ -665,20 +665,20 @@ CPPUNIT_TEST_FIXTURE(Test, testMarkerOrient) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg"); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy11", u"0"); - assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy12", u"1"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform[1]", "xy12", 0.6, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy13", u"7"); - assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy21", u"-1"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform[1]", "xy21", -0.6, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy22", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy23", u"13"); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy31", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy32", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy33", u"1"); - assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy11", u"1"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform[2]", "xy11", 0.6, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy12", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy13", u"87"); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy21", u"0"); - assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy22", u"1"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform[2]", "xy22", 0.6, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy23", u"87"); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy31", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy32", u"0"); @@ -749,7 +749,7 @@ CPPUNIT_TEST_FIXTURE(Test, testMarkerInCssStyle) assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", u"#008000"); assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "width", u"1"); assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linejoin", u"Miter"); - assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", u"29"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", 28.955, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", u"BUTT"); } @@ -808,8 +808,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156777) // - Expected: #008000 // - Actual : #000000 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#008000"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"85"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"23"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 84.91, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 23.341, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testTdf156834) @@ -823,7 +823,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Middle"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"57"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 56.84, 0.1); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Hanging"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"30"); @@ -831,7 +831,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"Central"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", u"30"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"117"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", 116.84, 0.1); } CPPUNIT_TEST_FIXTURE(Test, testTdf104339) @@ -847,15 +847,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Start Middle End"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"11"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", 11.111, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#000000"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Start "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"11"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", 11.111, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", u"Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", u"#000000"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u" End"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"11"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", 11.111, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", u"Times New Roman"); } @@ -883,17 +883,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf93583) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf93583.svg"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"This is the"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"56"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 55.796, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"303"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u" first "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"122"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 122.461, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"303"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"32"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"32"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"line"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"190"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", 190.007, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"303"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "width", u"16"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"16"); @@ -907,28 +907,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156616) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"114"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"103"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"line "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"147"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 147.343, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"103"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Second line"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"114"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"122"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"First "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", u"83"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", 83.332, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"153"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"line "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", u"117"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", 116.676, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "y", u"153"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"Second line"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", u"76"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", 76.453, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "y", u"172"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"First "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "x", u"53"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[7]", "x", 52.664, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "y", u"203"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"line "); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", u"86"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", 86.007, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "y", u"203"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"Second line"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", u"39"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", 38.906, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "y", u"222"); } @@ -1325,14 +1325,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94765) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf94765.svg"); //Check that both rectangles use the gradient as fill - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "startx", u"1"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "starty", u"1"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endx", u"2"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endy", u"1"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "startx", u"0"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "starty", u"0"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endx", u"1"); - assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endy", u"0"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "startx", 1.07, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "starty", 1.157, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endx", 2.07, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endy", 1.157, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "startx", 0.0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "starty", 0.5, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endx", 1.0, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endy", 0.499, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testTdf156236) @@ -1424,8 +1424,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158445) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf158445.svg"); assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor", "color", u"#000000"); - assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "height", u"8"); - assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "width", u"5"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "height", 8.052, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "width", 5.328, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testTdf159594) @@ -1433,8 +1433,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159594) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf159594.svg"); assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#000000"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "height", u"12"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "width", u"8"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "height", 11.671, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "width", 7.5, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testTdf97663) @@ -1444,7 +1444,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97663) // tdf#97663: Without the fix in place, this test would have failed with // - Expected: 236 // - Actual : 204 - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"237"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 236.976, 0.001); } CPPUNIT_TEST_FIXTURE(Test, testTdf156269) @@ -1481,7 +1481,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf95400) assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", 69, 0.5); assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", 102, 0.5); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"50"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", 49.607, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"16"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"30"); @@ -1497,11 +1497,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTextAnchor) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"44"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 43.55, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"27"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", 27.101, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"ABC"); @@ -1509,11 +1509,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTextAnchor) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", u"44"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", 43.55, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", u"27"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", 27.102, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"ABC"); @@ -1521,11 +1521,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTextAnchor) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", u"44"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", 43.551, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"ABC"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", u"27"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", 27.102, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"ABC"); @@ -1533,38 +1533,38 @@ CPPUNIT_TEST_FIXTURE(Test, testTextAnchor) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "text", u"A"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "x", u"72"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[11]", "x", 71.554, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "text", u"B"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "x", u"82"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[12]", "x", 82.227, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "y", u"40"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "text", u"C"); // Without the fix in place, this test would have failed with // - Expected: 43 // - Actual : 54 - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "x", u"44"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[13]", "x", 43.55, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "text", u"A"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "x", u"55"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[14]", "x", 55.105, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "text", u"B"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "x", u"66"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[15]", "x", 65.777, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "text", u"C"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "x", u"27"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[16]", "x", 27.101, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "text", u"A"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "x", u"39"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[17]", "x", 38.656, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "text", u"B"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "x", u"49"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[18]", "x", 49.328, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "y", u"60"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "text", u"C"); } @@ -1662,8 +1662,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156837) // Without the fix in place, this test would have failed with // - Expected: 94 // - Actual : 103 - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"94"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"10"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 94.29, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", 10.4, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"3"); } @@ -1677,9 +1677,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160773) // tdf#159661 Check there is text in the right position assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", 1); assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "x", u"0"); - assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "y", u"1"); - assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "height", u"0"); - assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "width", u"0"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "y", 0.568, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "height", 0.2, 0.001); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "width", 0.2, 0.001); assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "text", u"Red"); } @@ -1914,16 +1914,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160782) assertXPath(pDocument, "/primitive2D/transform/transform/bitmap/data", 255); - assertXPath(pDocument, - "/primitive2D/transform/transform/bitmap", "xy11", u"255"); + assertXPathDoubleValue(pDocument, + "/primitive2D/transform/transform/bitmap", "xy11", 255.377, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform/bitmap", "xy12", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform/bitmap", "xy13", u"0"); assertXPath(pDocument, "/primitive2D/transform/transform/bitmap", "xy21", u"0"); - assertXPath(pDocument, - "/primitive2D/transform/transform/bitmap", "xy22", u"255"); + assertXPathDoubleValue(pDocument, + "/primitive2D/transform/transform/bitmap", "xy22", 255.377, 0.001); assertXPath(pDocument, "/primitive2D/transform/transform/bitmap", "xy23", u"0"); assertXPath(pDocument, @@ -2143,12 +2143,12 @@ CPPUNIT_TEST_FIXTURE(Test, testRTLtext) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"داستان SVG 1.1 SE طولا ني است."); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "rtl", u"true"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"57"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 57.281, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"50"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"داستان SVG 1.2 SE طولا ني است."); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "rtl", u"true"); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"179"); + assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 178.64, 0.001); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"100"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"داستان SVG 1.3 SE طولا ني است."); diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx index fa7f69c5cd75..ea224015d508 100644 --- a/svx/qa/unit/sdr.cxx +++ b/svx/qa/unit/sdr.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin) // i.e. the shadow origin was not the top right corner for scaling (larger x position, so it was // visible on the right of the shape as well). CPPUNIT_ASSERT_EQUAL(sal_Int32(-705), fShadowX); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-685), fShadowY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-684), fShadowY); } CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) @@ -102,32 +102,32 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Actual : 162 // - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value. // i.e. shadow alignment was ignored while scaling the shadow. - assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", u"-568"); - assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", u"162"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[1]", "xy13", -567.8, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[1]", "xy23", 162.3, 0.001); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", u"-1795"); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", u"162"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[2]", "xy13", -1794.55, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[2]", "xy23", 162.3, 0.001); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", u"-3021"); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", u"161"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[3]", "xy13", -3021.3, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[3]", "xy23", 161.1, 0.001); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", u"-568"); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", u"-749"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[4]", "xy13", -567.8, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[4]", "xy23", -749.25, 0.001); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", u"-3021"); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", u"-750"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[5]", "xy13", -3021.3, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[5]", "xy23", -750.45, 0.001); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", u"-567"); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", u"-1692"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[6]", "xy13", -566.6, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[6]", "xy23", -1691.7, 0.001); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", u"-1795"); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", u"-1693"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[7]", "xy13", -1794.55, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[7]", "xy23", -1693.0, 0.001); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy13", u"-3023"); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy23", u"-1692"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[8]", "xy13", -3022.5, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[8]", "xy23", -1691.7, 0.001); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy13", u"-1795"); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy23", u"-750"); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[9]", "xy13", -1794.55, 0.001); + assertXPathDoubleValue(pDocument, "(//shadow/transform)[9]", "xy23", -750.45, 0.001); } { // Page 2 contains a table with shadow alignment center @@ -144,8 +144,8 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Expected: -5196 // - Actual : 0 // - In<>, attribute 'xy13' of '//shadow/transform' incorrect value. - assertXPath(pDocument, "//shadow/transform", "xy13", u"-5196"); - assertXPath(pDocument, "//shadow/transform", "xy23", u"-2290"); + assertXPathDoubleValue(pDocument, "//shadow/transform", "xy13", -5196.45, 0.001); + assertXPathDoubleValue(pDocument, "//shadow/transform", "xy23", -2290.05, 0.001); } } diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 6ab24679e2ac..0fca922f0a66 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -815,8 +815,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow) // make sure the text that isn't overflowing is still aligned properly assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)", u"3"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", u"5074"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", u"6598"); + assertXPathDoubleValue(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", 5073.5, + 0.001); + assertXPathDoubleValue(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", 6597.5, + 0.001); // Test vertically overflowing text, with vertical text direction assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)", u"12"); diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 0df0b4e2c19d..b013f233173e 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -155,7 +155,7 @@ void XmlWriter::attribute(const char* name, const sal_Int64 aNumber) attribute(name, OString::number(aNumber)); } -void XmlWriter::attributeDouble(const char* name, const double aNumber) +void XmlWriter::attribute(const char* name, const double aNumber) { attribute(name, OString::number(aNumber)); }
