summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-05-09 19:28:54 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-05-09 19:28:54 +0200
commit6bca6beea3e1212ad1eb22ffe8630ea25c7e92c2 (patch)
treef8bd79189341d30e34fd2eac578c4e6c5c086140 /tests
parentf20061d2d91ee8150082026a43e20dafd78cffa4 (diff)
parent8e7afec479b29bfe7f6d33ca9bce70c9d1abf7cf (diff)
downloadredot-engine-6bca6beea3e1212ad1eb22ffe8630ea25c7e92c2.tar.gz
Merge pull request #76878 from RedworkDE/tests-fix-errors
Fix various errors when running the unit tests
Diffstat (limited to 'tests')
-rw-r--r--tests/core/object/test_class_db.h11
-rw-r--r--tests/scene/test_code_edit.h4
-rw-r--r--tests/scene/test_viewport.h2
-rw-r--r--tests/test_macros.h2
-rw-r--r--tests/test_main.cpp2
5 files changed, 9 insertions, 12 deletions
diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h
index e68995e539..3f091fd2fe 100644
--- a/tests/core/object/test_class_db.h
+++ b/tests/core/object/test_class_db.h
@@ -487,13 +487,13 @@ void add_exposed_classes(Context &r_context) {
}
if (!ClassDB::is_class_exposed(class_name)) {
- MESSAGE(vformat("Ignoring class '%s' because it's not exposed.", class_name));
+ INFO(vformat("Ignoring class '%s' because it's not exposed.", class_name));
class_list.pop_front();
continue;
}
if (!ClassDB::is_class_enabled(class_name)) {
- MESSAGE(vformat("Ignoring class '%s' because it's not enabled.", class_name));
+ INFO(vformat("Ignoring class '%s' because it's not enabled.", class_name));
class_list.pop_front();
continue;
}
@@ -717,15 +717,10 @@ void add_exposed_classes(Context &r_context) {
bool method_conflict = exposed_class.find_property_by_name(signal.name);
- // TODO:
- // ClassDB allows signal names that conflict with method or property names.
- // However registering a signal with a conflicting name is still considered wrong.
- // Unfortunately there are some existing cases that are yet to be fixed.
- // Until those are fixed we will print a warning instead of failing the test.
String warn_msg = vformat(
"Signal name conflicts with %s: '%s.%s.",
method_conflict ? "method" : "property", class_name, signal.name);
- TEST_FAIL_COND_WARN((method_conflict || exposed_class.find_method_by_name(signal.name)),
+ TEST_FAIL_COND((method_conflict || exposed_class.find_method_by_name(signal.name)),
warn_msg.utf8().get_data());
exposed_class.signals_.push_back(signal);
diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h
index 9b8ad32e32..a201f0f3b0 100644
--- a/tests/scene/test_code_edit.h
+++ b/tests/scene/test_code_edit.h
@@ -3482,9 +3482,9 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
SIGNAL_CHECK("symbol_validate", signal_args);
SIGNAL_UNWATCH(code_edit, "symbol_validate");
-
- memdelete(code_edit);
}
+
+ memdelete(code_edit);
}
TEST_CASE("[SceneTree][CodeEdit] line length guidelines") {
diff --git a/tests/scene/test_viewport.h b/tests/scene/test_viewport.h
index 62f4635927..d76fc40125 100644
--- a/tests/scene/test_viewport.h
+++ b/tests/scene/test_viewport.h
@@ -221,7 +221,9 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
}
SUBCASE("[Viewport][GuiInputEvent] nullptr as argument doesn't lead to a crash.") {
+ ERR_PRINT_OFF;
CHECK_NOTHROW(root->push_input(nullptr));
+ ERR_PRINT_ON;
}
// Unit tests for Viewport::_gui_input_event (Mouse Buttons)
diff --git a/tests/test_macros.h b/tests/test_macros.h
index 5d1bcdecf4..d39da7f8e8 100644
--- a/tests/test_macros.h
+++ b/tests/test_macros.h
@@ -147,7 +147,7 @@ int register_test_command(String p_command, TestFunc p_function);
{ \
const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(m_action); \
const List<Ref<InputEvent>>::Element *first_event = events->front(); \
- Ref<InputEventKey> event = first_event->get(); \
+ Ref<InputEventKey> event = first_event->get()->duplicate(); \
event->set_pressed(true); \
_SEND_DISPLAYSERVER_EVENT(event); \
MessageQueue::get_singleton()->flush(); \
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 291321a45e..a0359162d9 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -255,8 +255,8 @@ struct GodotTestCaseListener : public doctest::IReporter {
}
if (suite_name.find("[Navigation]") != -1 && navigation_server_2d == nullptr && navigation_server_3d == nullptr) {
- navigation_server_2d = memnew(NavigationServer2D);
navigation_server_3d = NavigationServer3DManager::new_default_server();
+ navigation_server_2d = memnew(NavigationServer2D);
return;
}
}