summaryrefslogtreecommitdiffstats
path: root/tests/core/math/test_rect2.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/math/test_rect2.h')
-rw-r--r--tests/core/math/test_rect2.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/core/math/test_rect2.h b/tests/core/math/test_rect2.h
index 26ab185aa2..c4368808a6 100644
--- a/tests/core/math/test_rect2.h
+++ b/tests/core/math/test_rect2.h
@@ -180,6 +180,28 @@ TEST_CASE("[Rect2] Expanding") {
"expand() with non-contained Vector2 should return the expected result.");
}
+TEST_CASE("[Rect2] Get support") {
+ const Rect2 rect = Rect2(Vector2(-1.5, 2), Vector2(4, 5));
+ CHECK_MESSAGE(
+ rect.get_support(Vector2(1, 0)) == Vector2(2.5, 2),
+ "get_support() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_support(Vector2(0.5, 1)) == Vector2(2.5, 7),
+ "get_support() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_support(Vector2(0.5, 1)) == Vector2(2.5, 7),
+ "get_support() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_support(Vector2(0, -1)) == Vector2(-1.5, 2),
+ "get_support() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_support(Vector2(0, -0.1)) == Vector2(-1.5, 2),
+ "get_support() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_support(Vector2()) == Vector2(-1.5, 2),
+ "get_support() should return the Rect2 position when given a zero vector.");
+}
+
TEST_CASE("[Rect2] Growing") {
CHECK_MESSAGE(
Rect2(0, 100, 1280, 720).grow(100).is_equal_approx(Rect2(-100, 0, 1480, 920)),