sc/qa/unit/helper/qahelper.cxx | 5 ----- sc/qa/unit/helper/qahelper.hxx | 2 -- sc/qa/unit/subsequent_export_test.cxx | 24 ++++-------------------- sc/qa/unit/ucalc.cxx | 12 ++++++------ 4 files changed, 10 insertions(+), 33 deletions(-)
New commits: commit 49fa5640f4ef262141594c4d7d86127afa4ff6a7 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Nov 24 11:36:07 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Nov 24 12:40:05 2022 +0100 sc: drop testEqualsWithTolerance Change-Id: I588bf862a21559f84b58e3af854f43e73dccfe7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143212 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 6627bd5636da..e464646ea783 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -114,11 +114,6 @@ const FileFormat ScBootstrapFixture::aFileFormats[] = { { "xltx", "Calc Office Open XML Template", "Office Open XML Spreadsheet Template", XLTX_FORMAT_TYPE } }; -bool testEqualsWithTolerance( tools::Long nVal1, tools::Long nVal2, tools::Long nTol ) -{ - return ( std::abs( nVal1 - nVal2 ) <= nTol ); -} - void ScModelTestBase::loadFile(const OUString& aFileName, std::string& aContent) { OString aOFileName = OUStringToOString(aFileName, RTL_TEXTENCODING_UTF8); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 91e3aed2b04f..c828135ca01e 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -63,8 +63,6 @@ namespace utl { class TempFileNamed; } enum class StringType { PureString, StringValue }; -SCQAHELPER_DLLPUBLIC bool testEqualsWithTolerance( tools::Long nVal1, tools::Long nVal2, tools::Long nTol ); - #define CHECK_OPTIMAL 0x1 class SdrOle2Obj; diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 195e97b69e7a..64ed8639c1aa 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -4191,32 +4191,16 @@ static void impl_testLegacyCellAnchoredRotatedShape(ScDocument& rDoc, const tool SdrObject* pObj = pPage->GetObj(0); const tools::Rectangle& aSnap = pObj->GetSnapRect(); - printf("expected height %" SAL_PRIdINT64 " actual %" SAL_PRIdINT64 "\n", - sal_Int64(aRect.GetHeight()), sal_Int64(aSnap.GetHeight())); - CPPUNIT_ASSERT_EQUAL(true, - testEqualsWithTolerance(aRect.GetHeight(), aSnap.GetHeight(), TOLERANCE)); - printf("expected width %" SAL_PRIdINT64 " actual %" SAL_PRIdINT64 "\n", - sal_Int64(aRect.GetWidth()), sal_Int64(aSnap.GetWidth())); - CPPUNIT_ASSERT_EQUAL(true, - testEqualsWithTolerance(aRect.GetWidth(), aSnap.GetWidth(), TOLERANCE)); - printf("expected left %" SAL_PRIdINT64 " actual %" SAL_PRIdINT64 "\n", sal_Int64(aRect.Left()), - sal_Int64(aSnap.Left())); - CPPUNIT_ASSERT_EQUAL(true, testEqualsWithTolerance(aRect.Left(), aSnap.Left(), TOLERANCE)); - printf("expected right %" SAL_PRIdINT64 " actual %" SAL_PRIdINT64 "\n", sal_Int64(aRect.Top()), - sal_Int64(aSnap.Top())); - CPPUNIT_ASSERT_EQUAL(true, testEqualsWithTolerance(aRect.Top(), aSnap.Top(), TOLERANCE)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aRect.GetHeight(), aSnap.GetHeight(), TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aRect.GetWidth(), aSnap.GetWidth(), TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aRect.Left(), aSnap.Left(), TOLERANCE); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aRect.Top(), aSnap.Top(), TOLERANCE); ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj); CPPUNIT_ASSERT_MESSAGE("expected object meta data", pData); - printf("expected startrow %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", - aAnchor.maStart.Row(), pData->maStart.Row()); CPPUNIT_ASSERT_EQUAL(aAnchor.maStart.Row(), pData->maStart.Row()); - printf("expected startcol %d actual %d\n", aAnchor.maStart.Col(), pData->maStart.Col()); CPPUNIT_ASSERT_EQUAL(aAnchor.maStart.Col(), pData->maStart.Col()); - printf("expected endrow %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", aAnchor.maEnd.Row(), - pData->maEnd.Row()); CPPUNIT_ASSERT_EQUAL(aAnchor.maEnd.Row(), pData->maEnd.Row()); - printf("expected endcol %d actual %d\n", aAnchor.maEnd.Col(), pData->maEnd.Col()); CPPUNIT_ASSERT_EQUAL(aAnchor.maEnd.Col(), pData->maEnd.Col()); } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 257a80bd4b50..3b41781df78c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5466,10 +5466,10 @@ void Test::testAnchoredRotatedShape() ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, true); tools::Rectangle aSnap = pObj->GetSnapRect(); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.GetHeight(), aSnap.GetHeight(), TOLERANCE ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.GetWidth(), aSnap.GetWidth(), TOLERANCE ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.Left(), aSnap.Left(), TOLERANCE ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.Top(), aSnap.Top(), TOLERANCE ) ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.GetHeight(), aSnap.GetHeight(), TOLERANCE ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.GetWidth(), aSnap.GetWidth(), TOLERANCE ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.Left(), aSnap.Left(), TOLERANCE ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.Top(), aSnap.Top(), TOLERANCE ); ScDrawObjData aAnchor; ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj.get() ); @@ -5493,8 +5493,8 @@ void Test::testAnchoredRotatedShape() aSnap = pObj->GetSnapRect(); // ensure that width and height have been adjusted accordingly - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.GetHeight(), aSnap.GetHeight(), TOLERANCE ) ); - CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRotRect.GetWidth(), aSnap.GetWidth(), TOLERANCE ) ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.GetHeight(), aSnap.GetHeight(), TOLERANCE ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( aRotRect.GetWidth(), aSnap.GetWidth(), TOLERANCE ); // ensure that anchor start and end addresses haven't changed CPPUNIT_ASSERT_EQUAL( aAnchor.maStart.Row(), pData->maStart.Row() ); // start row 0