summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/core/io/test_image.h38
-rw-r--r--tests/scene/test_code_edit.h2
-rw-r--r--tests/scene/test_text_edit.h20
3 files changed, 30 insertions, 30 deletions
diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.h
index 1c778c3228..e6e23912d3 100644
--- a/tests/core/io/test_image.h
+++ b/tests/core/io/test_image.h
@@ -161,8 +161,8 @@ TEST_CASE("[Image] Basic getters") {
CHECK(image->get_height() == 4);
CHECK(image->get_size() == Vector2(8, 4));
CHECK(image->get_format() == Image::FORMAT_LA8);
- CHECK(image->get_used_rect() == Rect2(0, 0, 0, 0));
- Ref<Image> image_get_rect = image->get_rect(Rect2(0, 0, 2, 1));
+ CHECK(image->get_used_rect() == Rect2i(0, 0, 0, 0));
+ Ref<Image> image_get_rect = image->get_rect(Rect2i(0, 0, 2, 1));
CHECK(image_get_rect->get_size() == Vector2(2, 1));
}
@@ -213,8 +213,8 @@ TEST_CASE("[Image] Modifying pixels of an image") {
image->get_pixelv(Vector2(0, 0)).is_equal_approx(Color(1, 1, 1, 1)),
"Image's get_pixel() should return the same color value as the one being set with set_pixel() in the same position.");
CHECK_MESSAGE(
- image->get_used_rect() == Rect2(0, 0, 1, 1),
- "Image's get_used_rect should return the expected value, larger than Rect2(0, 0, 0, 0) if it's visible.");
+ image->get_used_rect() == Rect2i(0, 0, 1, 1),
+ "Image's get_used_rect should return the expected value, larger than Rect2i(0, 0, 0, 0) if it's visible.");
image->set_pixelv(Vector2(0, 0), Color(0.5, 0.5, 0.5, 0.5));
Ref<Image> image2 = memnew(Image(3, 3, false, Image::FORMAT_RGBA8));
@@ -233,19 +233,19 @@ TEST_CASE("[Image] Modifying pixels of an image") {
{
const int img_width = 3;
const int img_height = 3;
- Vector<Rect2> rects;
- rects.push_back(Rect2());
- rects.push_back(Rect2(-5, -5, 3, 3));
- rects.push_back(Rect2(img_width, 0, 12, 12));
- rects.push_back(Rect2(0, img_height, 12, 12));
- rects.push_back(Rect2(img_width + 1, img_height + 2, 12, 12));
- rects.push_back(Rect2(1, 1, 1, 1));
- rects.push_back(Rect2(0, 1, 2, 3));
- rects.push_back(Rect2(-5, 0, img_width + 10, 2));
- rects.push_back(Rect2(0, -5, 2, img_height + 10));
- rects.push_back(Rect2(-1, -1, img_width + 1, img_height + 1));
-
- for (const Rect2 &rect : rects) {
+ Vector<Rect2i> rects;
+ rects.push_back(Rect2i());
+ rects.push_back(Rect2i(-5, -5, 3, 3));
+ rects.push_back(Rect2i(img_width, 0, 12, 12));
+ rects.push_back(Rect2i(0, img_height, 12, 12));
+ rects.push_back(Rect2i(img_width + 1, img_height + 2, 12, 12));
+ rects.push_back(Rect2i(1, 1, 1, 1));
+ rects.push_back(Rect2i(0, 1, 2, 3));
+ rects.push_back(Rect2i(-5, 0, img_width + 10, 2));
+ rects.push_back(Rect2i(0, -5, 2, img_height + 10));
+ rects.push_back(Rect2i(-1, -1, img_width + 1, img_height + 1));
+
+ for (const Rect2i &rect : rects) {
Ref<Image> img = memnew(Image(img_width, img_height, false, Image::FORMAT_RGBA8));
CHECK_NOTHROW_MESSAGE(
img->fill_rect(rect, Color(1, 1, 1, 1)),
@@ -267,7 +267,7 @@ TEST_CASE("[Image] Modifying pixels of an image") {
}
// Blend two images together
- image->blend_rect(image2, Rect2(Vector2(0, 0), image2->get_size()), Vector2(0, 0));
+ image->blend_rect(image2, Rect2i(Vector2i(0, 0), image2->get_size()), Vector2i(0, 0));
CHECK_MESSAGE(
image->get_pixel(0, 0).a > 0.7,
"blend_rect() should blend the alpha values of the two images.");
@@ -279,7 +279,7 @@ TEST_CASE("[Image] Modifying pixels of an image") {
image3->set_pixel(0, 0, Color(0, 1, 0, 1));
//blit_rect() two images together
- image->blit_rect(image3, Rect2(Vector2(0, 0), image3->get_size()), Vector2(0, 0));
+ image->blit_rect(image3, Rect2i(Vector2i(0, 0), image3->get_size()), Vector2i(0, 0));
CHECK_MESSAGE(
image->get_pixel(0, 0).is_equal_approx(Color(0, 1, 0, 1)),
"blit_rect() should replace old colors and not blend them.");
diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h
index d28380d056..7605f24cf8 100644
--- a/tests/scene/test_code_edit.h
+++ b/tests/scene/test_code_edit.h
@@ -3251,7 +3251,7 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
SIGNAL_WATCH(code_edit, "symbol_validate");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(code_edit, Key::META);
#else
SEND_GUI_KEY_EVENT(code_edit, Key::CTRL);
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index 4098dd7ace..0fce359c5a 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -724,7 +724,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
CHECK(text_edit->has_selection());
CHECK(text_edit->get_selected_text() == "t");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::ALT)
#else
SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::CMD)
@@ -736,7 +736,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
CHECK(text_edit->has_selection());
CHECK(text_edit->get_selected_text() == "tes");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::ALT)
#else
SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::CMD)
@@ -1902,7 +1902,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::ALT | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
@@ -2013,7 +2013,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::ALT | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
@@ -2244,7 +2244,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::UP | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::HOME | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
@@ -2285,7 +2285,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::DOWN | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::END | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
@@ -2326,7 +2326,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::HOME | KeyModifierMask::SHIFT);
@@ -2383,7 +2383,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_DISCARD("lines_edited_from");
SIGNAL_DISCARD("caret_changed");
-#ifdef OSX_ENABLED
+#ifdef MACOS_ENABLED
SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::CMD | KeyModifierMask::SHIFT);
#else
SEND_GUI_KEY_EVENT(text_edit, Key::END | KeyModifierMask::SHIFT);
@@ -3139,7 +3139,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
v_scroll = text_edit->get_v_scroll();
SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButton::WHEEL_DOWN, Key::NONE);
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
- CHECK(text_edit->get_v_scroll() > v_scroll);
+ CHECK(text_edit->get_v_scroll() >= v_scroll);
SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_UP, MouseButton::WHEEL_UP, Key::NONE);
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
CHECK(text_edit->get_v_scroll() == v_scroll);
@@ -3148,7 +3148,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
text_edit->set_v_scroll_speed(10000);
SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButton::WHEEL_DOWN, Key::NONE);
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
- CHECK(text_edit->get_v_scroll() > v_scroll);
+ CHECK(text_edit->get_v_scroll() >= v_scroll);
SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_UP, MouseButton::WHEEL_UP, Key::NONE);
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
CHECK(text_edit->get_v_scroll() == v_scroll);