summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-17 07:50:25 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-17 09:21:59 +0200
commit59e969def7488977be8c554d37bebe535c6511cb (patch)
tree6513dfce2329752c71ad5acbfd138c9b7fe59204 /tools
parent615a340fcf05845397ea3c9917e2eadf074b4514 (diff)
Fix ctor taking Point and Size, to properly handle regative sizes
(alinged to SetSize) Change-Id: I123a584ead91faae0fec4d25938529b2d68e4a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120559 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_rectangle.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx
index e4992f3f44f9..29aa6cde94df 100644
--- a/tools/qa/cppunit/test_rectangle.cxx
+++ b/tools/qa/cppunit/test_rectangle.cxx
@@ -57,6 +57,17 @@ void Test::test_rectangle()
aRect.SetPosY(12);
CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth());
}
+
+ {
+ constexpr tools::Rectangle aRect(Point(), Size(-1, -2));
+ static_assert(!aRect.IsEmpty());
+ static_assert(aRect.Right() == 0);
+ static_assert(aRect.Bottom() == -1);
+
+ tools::Rectangle aRect2;
+ aRect2.SetSize(Size(-1, -2));
+ CPPUNIT_ASSERT_EQUAL(aRect, aRect2);
+ }
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);