summaryrefslogtreecommitdiff
path: root/include/test
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-12-14 18:46:19 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-15 07:43:49 +0000
commit15df8e5422010e0806eb9e93bd8822519c1ab989 (patch)
tree44937ad1f0b2c30d22f282936486e76db6b077ea /include/test
parent99fc50c4facbe87642717faa0d780889168eabfd (diff)
UnoApiTest: introduce CPPUNIT_ASSERT_RECTANGLE_EQUAL
and get rid of duplicated code Change-Id: Iccbd3147fab71b43b1725af308df8ed37c807b7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144173 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'include/test')
-rw-r--r--include/test/unoapi_test.hxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index f228f70e21ca..e008b11ca2f0 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -84,6 +84,22 @@ private:
OUString maImportFilterName;
};
+inline void assertRectangleEqual(const tools::Rectangle& rExpected, const tools::Rectangle& rActual,
+ const sal_Int32 nTolerance, const CppUnit::SourceLine& rSourceLine)
+{
+ CPPUNIT_NS::assertDoubleEquals(rExpected.Top(), rActual.Top(), nTolerance, rSourceLine,
+ "different Top");
+ CPPUNIT_NS::assertDoubleEquals(rExpected.Left(), rActual.Left(), nTolerance, rSourceLine,
+ "different Left");
+ CPPUNIT_NS::assertDoubleEquals(rExpected.GetWidth(), rActual.GetWidth(), nTolerance,
+ rSourceLine, "different Width");
+ CPPUNIT_NS::assertDoubleEquals(rExpected.GetHeight(), rActual.GetHeight(), nTolerance,
+ rSourceLine, "different Height");
+}
+
+#define CPPUNIT_ASSERT_RECTANGLE_EQUAL(aExpected, aActual, aTolerance) \
+ assertRectangleEqual(aExpected, aActual, aTolerance, CPPUNIT_SOURCELINE())
+
#endif // INCLUDED_TEST_UNOAPI_TEST_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */