summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-21 21:30:30 +0200
committerGitHub <noreply@github.com>2021-09-21 21:30:30 +0200
commitba57252bd8d7928c29e818b1ccf557e279c33ca0 (patch)
tree6b037a4a0b8b6907d571b1b847ed6ab3bc7507c3 /tests
parent726b826b310900ff475122ed65934d2499b8db4d (diff)
parent90908cd67d3f44ba70cc4b7b32f024ce508cc0ee (diff)
Merge pull request #52878 from AnilBK/add-get-center
Diffstat (limited to 'tests')
-rw-r--r--tests/test_aabb.h3
-rw-r--r--tests/test_rect2.h12
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_aabb.h b/tests/test_aabb.h
index c4daa56e5a..2724d9481a 100644
--- a/tests/test_aabb.h
+++ b/tests/test_aabb.h
@@ -65,6 +65,9 @@ TEST_CASE("[AABB] Basic getters") {
CHECK_MESSAGE(
aabb.get_end().is_equal_approx(Vector3(2.5, 7, 3.5)),
"get_end() should return the expected value.");
+ CHECK_MESSAGE(
+ aabb.get_center().is_equal_approx(Vector3(0.5, 4.5, 0.5)),
+ "get_center() should return the expected value.");
}
TEST_CASE("[AABB] Basic setters") {
diff --git a/tests/test_rect2.h b/tests/test_rect2.h
index c5740167db..3d9fe5a32e 100644
--- a/tests/test_rect2.h
+++ b/tests/test_rect2.h
@@ -76,6 +76,12 @@ TEST_CASE("[Rect2] Basic getters") {
CHECK_MESSAGE(
rect.get_end().is_equal_approx(Vector2(1280, 820)),
"get_end() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_center().is_equal_approx(Vector2(640, 460)),
+ "get_center() should return the expected value.");
+ CHECK_MESSAGE(
+ Rect2(0, 100, 1281, 721).get_center().is_equal_approx(Vector2(640.5, 460.5)),
+ "get_center() should return the expected value.");
}
TEST_CASE("[Rect2] Basic setters") {
@@ -288,6 +294,12 @@ TEST_CASE("[Rect2i] Basic getters") {
CHECK_MESSAGE(
rect.get_end() == Vector2i(1280, 820),
"get_end() should return the expected value.");
+ CHECK_MESSAGE(
+ rect.get_center() == Vector2i(640, 460),
+ "get_center() should return the expected value.");
+ CHECK_MESSAGE(
+ Rect2i(0, 100, 1281, 721).get_center() == Vector2i(640, 460),
+ "get_center() should return the expected value.");
}
TEST_CASE("[Rect2i] Basic setters") {