diff options
Diffstat (limited to 'tests/test_main.cpp')
-rw-r--r-- | tests/test_main.cpp | 83 |
1 files changed, 63 insertions, 20 deletions
diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 7f49805274..edadc52a16 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -30,8 +30,13 @@ #include "test_main.h" +#include "modules/modules_enabled.gen.h" + +#ifdef TOOLS_ENABLED #include "editor/editor_paths.h" #include "editor/editor_settings.h" +#endif // TOOLS_ENABLED + #include "tests/core/config/test_project_settings.h" #include "tests/core/input/test_input_event.h" #include "tests/core/input/test_input_event_key.h" @@ -41,6 +46,7 @@ #include "tests/core/io/test_file_access.h" #include "tests/core/io/test_http_client.h" #include "tests/core/io/test_image.h" +#include "tests/core/io/test_ip.h" #include "tests/core/io/test_json.h" #include "tests/core/io/test_marshalls.h" #include "tests/core/io/test_pck_packer.h" @@ -70,6 +76,7 @@ #include "tests/core/object/test_class_db.h" #include "tests/core/object/test_method_bind.h" #include "tests/core/object/test_object.h" +#include "tests/core/object/test_undo_redo.h" #include "tests/core/os/test_os.h" #include "tests/core/string/test_node_path.h" #include "tests/core/string/test_string.h" @@ -81,6 +88,7 @@ #include "tests/core/templates/test_list.h" #include "tests/core/templates/test_local_vector.h" #include "tests/core/templates/test_lru.h" +#include "tests/core/templates/test_oa_hash_map.h" #include "tests/core/templates/test_paged_array.h" #include "tests/core/templates/test_rid.h" #include "tests/core/templates/test_vector.h" @@ -89,46 +97,61 @@ #include "tests/core/test_time.h" #include "tests/core/threads/test_worker_thread_pool.h" #include "tests/core/variant/test_array.h" +#include "tests/core/variant/test_callable.h" #include "tests/core/variant/test_dictionary.h" #include "tests/core/variant/test_variant.h" #include "tests/core/variant/test_variant_utility.h" #include "tests/scene/test_animation.h" -#include "tests/scene/test_arraymesh.h" #include "tests/scene/test_audio_stream_wav.h" #include "tests/scene/test_bit_map.h" -#include "tests/scene/test_code_edit.h" -#include "tests/scene/test_color_picker.h" +#include "tests/scene/test_camera_2d.h" #include "tests/scene/test_control.h" #include "tests/scene/test_curve.h" #include "tests/scene/test_curve_2d.h" #include "tests/scene/test_curve_3d.h" #include "tests/scene/test_gradient.h" -#include "tests/scene/test_navigation_agent_2d.h" -#include "tests/scene/test_navigation_obstacle_2d.h" -#include "tests/scene/test_navigation_region_2d.h" +#include "tests/scene/test_image_texture.h" +#include "tests/scene/test_image_texture_3d.h" +#include "tests/scene/test_instance_placeholder.h" #include "tests/scene/test_node.h" #include "tests/scene/test_node_2d.h" #include "tests/scene/test_packed_scene.h" #include "tests/scene/test_path_2d.h" -#include "tests/scene/test_primitives.h" +#include "tests/scene/test_path_follow_2d.h" #include "tests/scene/test_sprite_frames.h" -#include "tests/scene/test_text_edit.h" #include "tests/scene/test_theme.h" +#include "tests/scene/test_timer.h" #include "tests/scene/test_viewport.h" #include "tests/scene/test_visual_shader.h" #include "tests/scene/test_window.h" #include "tests/servers/rendering/test_shader_preprocessor.h" -#include "tests/servers/test_navigation_server_2d.h" #include "tests/servers/test_text_server.h" #include "tests/test_validate_testing.h" +#ifndef ADVANCED_GUI_DISABLED +#include "tests/scene/test_code_edit.h" +#include "tests/scene/test_color_picker.h" +#include "tests/scene/test_graph_node.h" +#include "tests/scene/test_text_edit.h" +#endif // ADVANCED_GUI_DISABLED + #ifndef _3D_DISABLED -#include "tests/scene/test_camera_3d.h" +#ifdef MODULE_NAVIGATION_ENABLED +#include "tests/scene/test_navigation_agent_2d.h" #include "tests/scene/test_navigation_agent_3d.h" +#include "tests/scene/test_navigation_obstacle_2d.h" #include "tests/scene/test_navigation_obstacle_3d.h" +#include "tests/scene/test_navigation_region_2d.h" #include "tests/scene/test_navigation_region_3d.h" -#include "tests/scene/test_path_3d.h" +#include "tests/servers/test_navigation_server_2d.h" #include "tests/servers/test_navigation_server_3d.h" +#endif // MODULE_NAVIGATION_ENABLED + +#include "tests/scene/test_arraymesh.h" +#include "tests/scene/test_camera_3d.h" +#include "tests/scene/test_path_3d.h" +#include "tests/scene/test_path_follow_3d.h" +#include "tests/scene/test_primitives.h" #endif // _3D_DISABLED #include "modules/modules_tests.gen.h" @@ -137,10 +160,14 @@ #include "tests/test_macros.h" #include "scene/theme/theme_db.h" +#ifndef _3D_DISABLED #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" +#endif // _3D_DISABLED #include "servers/physics_server_2d.h" +#ifndef _3D_DISABLED #include "servers/physics_server_3d.h" +#endif // _3D_DISABLED #include "servers/rendering/rendering_server_default.h" int test_main(int argc, char *argv[]) { @@ -174,7 +201,7 @@ int test_main(int argc, char *argv[]) { } // Doctest runner. doctest::Context test_context; - List<String> test_args; + LocalVector<String> test_args; // Clean arguments of "--test" from the args. for (int x = 0; x < argc; x++) { @@ -187,7 +214,7 @@ int test_main(int argc, char *argv[]) { if (test_args.size() > 0) { // Convert Godot command line arguments back to standard arguments. char **doctest_args = new char *[test_args.size()]; - for (int x = 0; x < test_args.size(); x++) { + for (uint32_t x = 0; x < test_args.size(); x++) { // Operation to convert Godot string to non wchar string. CharString cs = test_args[x].utf8(); const char *str = cs.get_data(); @@ -199,7 +226,7 @@ int test_main(int argc, char *argv[]) { test_context.applyCommandLine(test_args.size(), doctest_args); - for (int x = 0; x < test_args.size(); x++) { + for (uint32_t x = 0; x < test_args.size(); x++) { delete[] doctest_args[x]; } delete[] doctest_args; @@ -215,10 +242,12 @@ struct GodotTestCaseListener : public doctest::IReporter { SignalWatcher *signal_watcher = nullptr; - PhysicsServer3D *physics_server_3d = nullptr; PhysicsServer2D *physics_server_2d = nullptr; +#ifndef _3D_DISABLED + PhysicsServer3D *physics_server_3d = nullptr; NavigationServer3D *navigation_server_3d = nullptr; NavigationServer2D *navigation_server_2d = nullptr; +#endif // _3D_DISABLED void test_case_start(const doctest::TestCaseData &p_in) override { reinitialize(); @@ -226,7 +255,7 @@ struct GodotTestCaseListener : public doctest::IReporter { String name = String(p_in.m_name); String suite_name = String(p_in.m_test_suite); - if (name.find("[SceneTree]") != -1 || name.find("[Editor]") != -1) { + if (name.contains("[SceneTree]") || name.contains("[Editor]")) { memnew(MessageQueue); memnew(Input); @@ -236,7 +265,7 @@ struct GodotTestCaseListener : public doctest::IReporter { OS::get_singleton()->set_has_server_feature_callback(nullptr); for (int i = 0; i < DisplayServer::get_create_function_count(); i++) { if (String("mock") == DisplayServer::get_create_function_name(i)) { - DisplayServer::create(i, "", DisplayServer::WindowMode::WINDOW_MODE_MINIMIZED, DisplayServer::VSyncMode::VSYNC_ENABLED, 0, nullptr, Vector2i(0, 0), DisplayServer::SCREEN_PRIMARY, err); + DisplayServer::create(i, "", DisplayServer::WindowMode::WINDOW_MODE_MINIMIZED, DisplayServer::VSyncMode::VSYNC_ENABLED, 0, nullptr, Vector2i(0, 0), DisplayServer::SCREEN_PRIMARY, DisplayServer::CONTEXT_EDITOR, err); break; } } @@ -250,16 +279,20 @@ struct GodotTestCaseListener : public doctest::IReporter { ThemeDB::get_singleton()->finalize_theme(); ThemeDB::get_singleton()->initialize_theme_noproject(); +#ifndef _3D_DISABLED physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server(); physics_server_3d->init(); +#endif // _3D_DISABLED physics_server_2d = PhysicsServer2DManager::get_singleton()->new_default_server(); physics_server_2d->init(); +#ifndef _3D_DISABLED ERR_PRINT_OFF; navigation_server_3d = NavigationServer3DManager::new_default_server(); navigation_server_2d = NavigationServer2DManager::new_default_server(); ERR_PRINT_ON; +#endif // _3D_DISABLED memnew(InputMap); InputMap::get_singleton()->load_default(); @@ -270,16 +303,18 @@ struct GodotTestCaseListener : public doctest::IReporter { SceneTree::get_singleton()->get_root()->set_embedding_subwindows(true); } - if (name.find("[Editor]") != -1) { +#ifdef TOOLS_ENABLED + if (name.contains("[Editor]")) { Engine::get_singleton()->set_editor_hint(true); EditorPaths::create(); EditorSettings::create(); } +#endif // TOOLS_ENABLED return; } - if (name.find("Audio") != -1) { + if (name.contains("Audio")) { // The last driver index should always be the dummy driver. int dummy_idx = AudioDriverManager::get_driver_count() - 1; AudioDriverManager::initialize(dummy_idx); @@ -288,19 +323,23 @@ struct GodotTestCaseListener : public doctest::IReporter { return; } - if (suite_name.find("[Navigation]") != -1 && navigation_server_2d == nullptr && navigation_server_3d == nullptr) { +#ifndef _3D_DISABLED + if (suite_name.contains("[Navigation]") && navigation_server_2d == nullptr && navigation_server_3d == nullptr) { ERR_PRINT_OFF; navigation_server_3d = NavigationServer3DManager::new_default_server(); navigation_server_2d = NavigationServer2DManager::new_default_server(); ERR_PRINT_ON; return; } +#endif // _3D_DISABLED } void test_case_end(const doctest::CurrentTestCaseStats &) override { +#ifdef TOOLS_ENABLED if (EditorSettings::get_singleton()) { EditorSettings::destroy(); } +#endif // TOOLS_ENABLED Engine::get_singleton()->set_editor_hint(false); @@ -316,6 +355,7 @@ struct GodotTestCaseListener : public doctest::IReporter { memdelete(SceneTree::get_singleton()); } +#ifndef _3D_DISABLED if (navigation_server_3d) { memdelete(navigation_server_3d); navigation_server_3d = nullptr; @@ -325,12 +365,15 @@ struct GodotTestCaseListener : public doctest::IReporter { memdelete(navigation_server_2d); navigation_server_2d = nullptr; } +#endif // _3D_DISABLED +#ifndef _3D_DISABLED if (physics_server_3d) { physics_server_3d->finish(); memdelete(physics_server_3d); physics_server_3d = nullptr; } +#endif // _3D_DISABLED if (physics_server_2d) { physics_server_2d->finish(); |