summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_code_edit.h36
-rw-r--r--tests/servers/test_physics_2d.cpp8
-rw-r--r--tests/servers/test_physics_3d.cpp4
-rw-r--r--tests/test_macros.h4
4 files changed, 26 insertions, 26 deletions
diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h
index 202ba8dca5..a95dd02ba5 100644
--- a/tests/scene/test_code_edit.h
+++ b/tests/scene/test_code_edit.h
@@ -2673,18 +2673,18 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
/* Check typing inserts closing pair. */
code_edit->clear();
- SEND_GUI_KEY_EVENT(code_edit, KEY_BRACKETLEFT);
+ SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT);
CHECK(code_edit->get_line(0) == "[]");
/* Should first match and insert smaller key. */
code_edit->clear();
- SEND_GUI_KEY_EVENT(code_edit, KEY_APOSTROPHE);
+ SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
CHECK(code_edit->get_line(0) == "''");
CHECK(code_edit->get_caret_column() == 1);
/* Move out from centre, Should match and insert larger key. */
SEND_GUI_ACTION(code_edit, "ui_text_caret_right");
- SEND_GUI_KEY_EVENT(code_edit, KEY_APOSTROPHE);
+ SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
CHECK(code_edit->get_line(0) == "''''''");
CHECK(code_edit->get_caret_column() == 3);
@@ -2693,30 +2693,30 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
CHECK(code_edit->get_line(0).is_empty());
/* If in between and typing close key should "skip". */
- SEND_GUI_KEY_EVENT(code_edit, KEY_BRACKETLEFT);
+ SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT);
CHECK(code_edit->get_line(0) == "[]");
CHECK(code_edit->get_caret_column() == 1);
- SEND_GUI_KEY_EVENT(code_edit, KEY_BRACKETRIGHT);
+ SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETRIGHT);
CHECK(code_edit->get_line(0) == "[]");
CHECK(code_edit->get_caret_column() == 2);
/* If current is char and inserting a string, do not autocomplete. */
code_edit->clear();
- SEND_GUI_KEY_EVENT(code_edit, KEY_A);
- SEND_GUI_KEY_EVENT(code_edit, KEY_APOSTROPHE);
+ SEND_GUI_KEY_EVENT(code_edit, Key::A);
+ SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
CHECK(code_edit->get_line(0) == "A'");
/* If in comment, do not complete. */
code_edit->add_comment_delimiter("#", "");
code_edit->clear();
- SEND_GUI_KEY_EVENT(code_edit, KEY_NUMBERSIGN);
- SEND_GUI_KEY_EVENT(code_edit, KEY_APOSTROPHE);
+ SEND_GUI_KEY_EVENT(code_edit, Key::NUMBERSIGN);
+ SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
CHECK(code_edit->get_line(0) == "#'");
/* If in string, and inserting string do not complete. */
code_edit->clear();
- SEND_GUI_KEY_EVENT(code_edit, KEY_APOSTROPHE);
- SEND_GUI_KEY_EVENT(code_edit, KEY_QUOTEDBL);
+ SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE);
+ SEND_GUI_KEY_EVENT(code_edit, Key::QUOTEDBL);
CHECK(code_edit->get_line(0) == "'\"'");
}
@@ -2862,7 +2862,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
SEND_GUI_ACTION(code_edit, "ui_down");
CHECK(code_edit->get_code_completion_selected_index() == 0);
- SEND_GUI_KEY_EVENT(code_edit, KEY_T);
+ SEND_GUI_KEY_EVENT(code_edit, Key::T);
CHECK(code_edit->get_code_completion_selected_index() == 0);
SEND_GUI_ACTION(code_edit, "ui_left");
@@ -2876,14 +2876,14 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
Point2 caret_pos = code_edit->get_caret_draw_pos();
caret_pos.y -= code_edit->get_line_height();
- SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MOUSE_BUTTON_WHEEL_DOWN, MOUSE_BUTTON_NONE);
+ SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_DOWN, MouseButton::NONE);
CHECK(code_edit->get_code_completion_selected_index() == 1);
- SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_NONE);
+ SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::WHEEL_UP, MouseButton::NONE);
CHECK(code_edit->get_code_completion_selected_index() == 0);
/* Single click selects. */
- SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MASK_LEFT);
+ SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::LEFT, MouseButton::MASK_LEFT);
CHECK(code_edit->get_code_completion_selected_index() == 2);
/* Double click inserts. */
@@ -3091,15 +3091,15 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
Point2 caret_pos = code_edit->get_caret_draw_pos();
caret_pos.x += 55;
- SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE);
+ SEND_GUI_MOUSE_EVENT(code_edit, caret_pos, MouseButton::NONE, MouseButton::NONE);
CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text");
SIGNAL_WATCH(code_edit, "symbol_validate");
#ifdef OSX_ENABLED
- SEND_GUI_KEY_EVENT(code_edit, KEY_META);
+ SEND_GUI_KEY_EVENT(code_edit, Key::META);
#else
- SEND_GUI_KEY_EVENT(code_edit, KEY_CTRL);
+ SEND_GUI_KEY_EVENT(code_edit, Key::CTRL);
#endif
Array signal_args;
diff --git a/tests/servers/test_physics_2d.cpp b/tests/servers/test_physics_2d.cpp
index b6360cde8a..06aa88b5c0 100644
--- a/tests/servers/test_physics_2d.cpp
+++ b/tests/servers/test_physics_2d.cpp
@@ -196,10 +196,10 @@ protected:
if (mb->is_pressed()) {
Point2 p = mb->get_position();
- if (mb->get_button_index() == 1) {
+ if (mb->get_button_index() == MouseButton::LEFT) {
ray_to = p;
_do_ray_query();
- } else if (mb->get_button_index() == 2) {
+ } else if (mb->get_button_index() == MouseButton::RIGHT) {
ray_from = p;
_do_ray_query();
}
@@ -211,10 +211,10 @@ protected:
if (mm.is_valid()) {
Point2 p = mm->get_position();
- if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+ if ((mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
ray_to = p;
_do_ray_query();
- } else if (mm->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) {
+ } else if ((mm->get_button_mask() & MouseButton::MASK_RIGHT) != MouseButton::NONE) {
ray_from = p;
_do_ray_query();
}
diff --git a/tests/servers/test_physics_3d.cpp b/tests/servers/test_physics_3d.cpp
index 4e483d628d..7cb74b1ee3 100644
--- a/tests/servers/test_physics_3d.cpp
+++ b/tests/servers/test_physics_3d.cpp
@@ -245,12 +245,12 @@ protected:
public:
virtual void input_event(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> mm = p_event;
- if (mm.is_valid() && mm->get_button_mask() & 4) {
+ if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) {
ofs_y -= mm->get_relative().y / 200.0;
ofs_x += mm->get_relative().x / 200.0;
}
- if (mm.is_valid() && mm->get_button_mask() & 1) {
+ if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
real_t y = -mm->get_relative().y / 20.0;
real_t x = mm->get_relative().x / 20.0;
diff --git a/tests/test_macros.h b/tests/test_macros.h
index 0ec6eb9e7c..b04c2117b7 100644
--- a/tests/test_macros.h
+++ b/tests/test_macros.h
@@ -133,7 +133,7 @@ int register_test_command(String p_command, TestFunc p_function);
// Utility macros to send an event actions to a given object
// Requires Message Queue and InputMap to be setup.
// SEND_GUI_ACTION - takes an object and a input map key. e.g SEND_GUI_ACTION(code_edit, "ui_text_newline").
-// SEND_GUI_KEY_EVENT - takes an object and a keycode set. e.g SEND_GUI_KEY_EVENT(code_edit, KEY_A | KEY_MASK_CMD).
+// SEND_GUI_KEY_EVENT - takes an object and a keycode set. e.g SEND_GUI_KEY_EVENT(code_edit, Key::A | KeyModifierMask::CMD).
// SEND_GUI_MOUSE_EVENT - takes an object, position, mouse button and mouse mask e.g SEND_GUI_MOUSE_EVENT(code_edit, Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE);
// SEND_GUI_DOUBLE_CLICK - takes an object and a postion. e.g SEND_GUI_DOUBLE_CLICK(code_edit, Vector2(50, 50));
@@ -172,7 +172,7 @@ int register_test_command(String p_command, TestFunc p_function);
#define SEND_GUI_DOUBLE_CLICK(m_object, m_local_pos) \
{ \
- _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_LEFT); \
+ _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MouseButton::LEFT, MouseButton::LEFT); \
event->set_double_click(true); \
m_object->get_viewport()->push_input(event); \
MessageQueue::get_singleton()->flush(); \