mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Fix various errors when running the unit tests
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
This commit is contained in:
parent
668cf3c66f
commit
8e7afec479
@ -484,7 +484,10 @@ Ref<InputEventKey> InputEventKey::create_reference(Key p_keycode, bool p_physica
|
|||||||
ie->set_keycode(p_keycode & KeyModifierMask::CODE_MASK);
|
ie->set_keycode(p_keycode & KeyModifierMask::CODE_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
ie->set_unicode(char32_t(p_keycode & KeyModifierMask::CODE_MASK));
|
char32_t ch = char32_t(p_keycode & KeyModifierMask::CODE_MASK);
|
||||||
|
if (ch < 0xd800 || (ch > 0xdfff && ch <= 0x10ffff)) {
|
||||||
|
ie->set_unicode(ch);
|
||||||
|
}
|
||||||
|
|
||||||
if ((p_keycode & KeyModifierMask::SHIFT) != Key::NONE) {
|
if ((p_keycode & KeyModifierMask::SHIFT) != Key::NONE) {
|
||||||
ie->set_shift_pressed(true);
|
ie->set_shift_pressed(true);
|
||||||
|
@ -581,8 +581,6 @@ void Main::test_cleanup() {
|
|||||||
TextServerManager::get_singleton()->get_interface(i)->cleanup();
|
TextServerManager::get_singleton()->get_interface(i)->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
EngineDebugger::deinitialize();
|
|
||||||
|
|
||||||
ResourceLoader::remove_custom_loaders();
|
ResourceLoader::remove_custom_loaders();
|
||||||
ResourceSaver::remove_custom_savers();
|
ResourceSaver::remove_custom_savers();
|
||||||
|
|
||||||
@ -594,6 +592,7 @@ void Main::test_cleanup() {
|
|||||||
|
|
||||||
GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_SCENE);
|
GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_SCENE);
|
||||||
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
|
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||||
|
|
||||||
unregister_platform_apis();
|
unregister_platform_apis();
|
||||||
unregister_driver_types();
|
unregister_driver_types();
|
||||||
unregister_scene_types();
|
unregister_scene_types();
|
||||||
@ -604,8 +603,12 @@ void Main::test_cleanup() {
|
|||||||
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
|
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
|
||||||
unregister_server_types();
|
unregister_server_types();
|
||||||
|
|
||||||
|
EngineDebugger::deinitialize();
|
||||||
OS::get_singleton()->finalize();
|
OS::get_singleton()->finalize();
|
||||||
|
|
||||||
|
if (packed_data) {
|
||||||
|
memdelete(packed_data);
|
||||||
|
}
|
||||||
if (translation_server) {
|
if (translation_server) {
|
||||||
memdelete(translation_server);
|
memdelete(translation_server);
|
||||||
}
|
}
|
||||||
@ -621,16 +624,13 @@ void Main::test_cleanup() {
|
|||||||
if (globals) {
|
if (globals) {
|
||||||
memdelete(globals);
|
memdelete(globals);
|
||||||
}
|
}
|
||||||
if (packed_data) {
|
|
||||||
memdelete(packed_data);
|
|
||||||
}
|
|
||||||
if (engine) {
|
if (engine) {
|
||||||
memdelete(engine);
|
memdelete(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
unregister_core_driver_types();
|
unregister_core_driver_types();
|
||||||
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
|
||||||
unregister_core_extensions();
|
unregister_core_extensions();
|
||||||
|
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
||||||
unregister_core_types();
|
unregister_core_types();
|
||||||
|
|
||||||
OS::get_singleton()->finalize_core();
|
OS::get_singleton()->finalize_core();
|
||||||
|
@ -3865,8 +3865,8 @@ bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) {
|
|||||||
}
|
}
|
||||||
prev_font = gl.font_rid;
|
prev_font = gl.font_rid;
|
||||||
|
|
||||||
double scale = _font_get_scale(gl.font_rid, gl.font_size);
|
|
||||||
if (gl.font_rid.is_valid()) {
|
if (gl.font_rid.is_valid()) {
|
||||||
|
double scale = _font_get_scale(gl.font_rid, gl.font_size);
|
||||||
bool subpos = (scale != 1.0) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_ONE_HALF) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_AUTO && gl.font_size <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE);
|
bool subpos = (scale != 1.0) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_ONE_HALF) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (_font_get_subpixel_positioning(gl.font_rid) == SUBPIXEL_POSITIONING_AUTO && gl.font_size <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE);
|
||||||
if (sd->text[j - sd->start] != 0 && !is_linebreak(sd->text[j - sd->start])) {
|
if (sd->text[j - sd->start] != 0 && !is_linebreak(sd->text[j - sd->start])) {
|
||||||
if (sd->orientation == ORIENTATION_HORIZONTAL) {
|
if (sd->orientation == ORIENTATION_HORIZONTAL) {
|
||||||
|
@ -40,11 +40,12 @@ Path3D::Path3D() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path3D::~Path3D() {
|
Path3D::~Path3D() {
|
||||||
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
|
||||||
if (debug_instance.is_valid()) {
|
if (debug_instance.is_valid()) {
|
||||||
|
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
||||||
RS::get_singleton()->free(debug_instance);
|
RS::get_singleton()->free(debug_instance);
|
||||||
}
|
}
|
||||||
if (debug_mesh.is_valid()) {
|
if (debug_mesh.is_valid()) {
|
||||||
|
ERR_FAIL_NULL(RenderingServer::get_singleton());
|
||||||
RS::get_singleton()->free(debug_mesh->get_rid());
|
RS::get_singleton()->free(debug_mesh->get_rid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,13 +487,13 @@ void add_exposed_classes(Context &r_context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ClassDB::is_class_exposed(class_name)) {
|
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();
|
class_list.pop_front();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClassDB::is_class_enabled(class_name)) {
|
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();
|
class_list.pop_front();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -717,15 +717,10 @@ void add_exposed_classes(Context &r_context) {
|
|||||||
|
|
||||||
bool method_conflict = exposed_class.find_property_by_name(signal.name);
|
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(
|
String warn_msg = vformat(
|
||||||
"Signal name conflicts with %s: '%s.%s.",
|
"Signal name conflicts with %s: '%s.%s.",
|
||||||
method_conflict ? "method" : "property", class_name, signal.name);
|
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());
|
warn_msg.utf8().get_data());
|
||||||
|
|
||||||
exposed_class.signals_.push_back(signal);
|
exposed_class.signals_.push_back(signal);
|
||||||
|
@ -3482,9 +3482,9 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
|
|||||||
SIGNAL_CHECK("symbol_validate", signal_args);
|
SIGNAL_CHECK("symbol_validate", signal_args);
|
||||||
|
|
||||||
SIGNAL_UNWATCH(code_edit, "symbol_validate");
|
SIGNAL_UNWATCH(code_edit, "symbol_validate");
|
||||||
|
|
||||||
memdelete(code_edit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memdelete(code_edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[SceneTree][CodeEdit] line length guidelines") {
|
TEST_CASE("[SceneTree][CodeEdit] line length guidelines") {
|
||||||
|
@ -221,7 +221,9 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("[Viewport][GuiInputEvent] nullptr as argument doesn't lead to a crash.") {
|
SUBCASE("[Viewport][GuiInputEvent] nullptr as argument doesn't lead to a crash.") {
|
||||||
|
ERR_PRINT_OFF;
|
||||||
CHECK_NOTHROW(root->push_input(nullptr));
|
CHECK_NOTHROW(root->push_input(nullptr));
|
||||||
|
ERR_PRINT_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unit tests for Viewport::_gui_input_event (Mouse Buttons)
|
// Unit tests for Viewport::_gui_input_event (Mouse Buttons)
|
||||||
|
@ -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>> *events = InputMap::get_singleton()->action_get_events(m_action); \
|
||||||
const List<Ref<InputEvent>>::Element *first_event = events->front(); \
|
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); \
|
event->set_pressed(true); \
|
||||||
_SEND_DISPLAYSERVER_EVENT(event); \
|
_SEND_DISPLAYSERVER_EVENT(event); \
|
||||||
MessageQueue::get_singleton()->flush(); \
|
MessageQueue::get_singleton()->flush(); \
|
||||||
|
@ -255,8 +255,8 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (suite_name.find("[Navigation]") != -1 && navigation_server_2d == nullptr && navigation_server_3d == nullptr) {
|
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_3d = NavigationServer3DManager::new_default_server();
|
||||||
|
navigation_server_2d = memnew(NavigationServer2D);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user