diff --git a/core/templates/fixed_vector.h b/core/templates/fixed_vector.h index e56f9fdf0e..18e61d8dfe 100644 --- a/core/templates/fixed_vector.h +++ b/core/templates/fixed_vector.h @@ -30,6 +30,7 @@ #pragma once +#include "core/os/memory.h" #include "core/templates/span.h" GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Warray-bounds") diff --git a/misc/error_suppressions/tsan.txt b/misc/error_suppressions/tsan.txt index 83be638b15..00cfb3f147 100644 --- a/misc/error_suppressions/tsan.txt +++ b/misc/error_suppressions/tsan.txt @@ -3,7 +3,7 @@ deadlock:modules/text_server_adv/text_server_adv.cpp deadlock:modules/text_server_fb/text_server_fb.cpp -deadlock:tests/core/templates/test_command_queue.h +deadlock:tests/core/templates/test_command_queue.cpp race:modules/navigation_2d/nav_map_2d.cpp race:modules/navigation_3d/nav_map_3d.cpp race:thirdparty/thorvg/src/loaders/external_jpg/tvgJpgLoader.cpp diff --git a/modules/dds/tests/test_dds.h b/modules/dds/tests/test_dds.h index 3029bc9c97..90507590e0 100644 --- a/modules/dds/tests/test_dds.h +++ b/modules/dds/tests/test_dds.h @@ -34,8 +34,8 @@ #include "core/config/project_settings.h" #include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/image.h" -#include "tests/core/config/test_project_settings.h" #include "tests/test_macros.h" #include "tests/test_utils.h" diff --git a/modules/gltf/tests/test_gltf.h b/modules/gltf/tests/test_gltf.h index f37f1b1423..267bd1883e 100644 --- a/modules/gltf/tests/test_gltf.h +++ b/modules/gltf/tests/test_gltf.h @@ -34,6 +34,8 @@ #ifdef TOOLS_ENABLED +#include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/os/os.h" #include "drivers/png/image_loader_png.h" #include "editor/import/3d/resource_importer_scene.h" @@ -46,7 +48,7 @@ #include "scene/resources/compressed_texture.h" #include "scene/resources/material.h" #include "scene/resources/packed_scene.h" -#include "tests/core/config/test_project_settings.h" +#include "tests/test_utils.h" #include "modules/gltf/editor/editor_scene_importer_gltf.h" #include "modules/gltf/gltf_document.h" diff --git a/scu_builders.py b/scu_builders.py index 3efb8bf343..20633838eb 100644 --- a/scu_builders.py +++ b/scu_builders.py @@ -390,6 +390,25 @@ def generate_scu_files(max_includes_per_scu): process_folder(["servers/navigation_3d"]) process_folder(["servers/xr"]) + # NOTE: Tests previously compiled as one large unit. We replicate this behavior in SCU builds. + process_folder([ + "tests", + "/core", + "/core/config", + "/core/input", + "/core/io", + "/core/math", + "/core/object", + "/core/os", + "/core/string", + "/core/templates", + "/core/threads", + "/core/variant", + "/scene", + "/servers", + "/servers/rendering", + ]) + # Finally change back the path to the calling folder os.chdir(curr_folder) diff --git a/tests/SCsub b/tests/SCsub index 169c7c1efa..068481d475 100644 --- a/tests/SCsub +++ b/tests/SCsub @@ -1,9 +1,11 @@ #!/usr/bin/env python from misc.utility.scons_hints import * -Import("env") +import glob -env.tests_sources = [] +import test_builders + +Import("env") env_tests = env.Clone() @@ -17,7 +19,19 @@ if env_tests["platform"] == "windows": if env["disable_exceptions"]: env_tests.Append(CPPDEFINES=["DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS"]) -env_tests.add_source_files(env.tests_sources, "*.cpp") +# Sources with tests must be explicitly linked first. +force_link_sources = glob.glob("*/**/*.cpp", recursive=True) +force_link_header = env.CommandNoCache( + "force_link.gen.h", env_tests.Value(force_link_sources), env.Run(test_builders.force_link_builder) +) +env.Depends(force_link_header, "test_builders.py") -lib = env_tests.add_library("tests", env.tests_sources) +tests_obj = [] +if env["scu_build"]: + # HACK: SCU setup doesn't support recursive/dynamic setup, so we must manually pass the files. + env_tests.add_source_files(tests_obj, glob.glob(".scu/*.cpp")) +else: + env_tests.add_source_files(tests_obj, glob.glob("*.cpp") + force_link_sources) + +lib = env_tests.add_library("tests", tests_obj) env.Prepend(LIBS=[lib]) diff --git a/tests/core/config/test_project_settings.h b/tests/core/config/test_project_settings.cpp similarity index 98% rename from tests/core/config/test_project_settings.h rename to tests/core/config/test_project_settings.cpp index b79d38da13..7efb8247ce 100644 --- a/tests/core/config/test_project_settings.h +++ b/tests/core/config/test_project_settings.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_project_settings.h */ +/* test_project_settings.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,19 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_project_settings) #include "core/config/project_settings.h" #include "core/io/dir_access.h" #include "core/variant/variant.h" -#include "tests/test_macros.h" - -class TestProjectSettingsInternalsAccessor { -public: - static String &resource_path() { - return ProjectSettings::get_singleton()->resource_path; - } -}; +#include "tests/test_utils.h" namespace TestProjectSettings { diff --git a/tests/core/input/test_input_event.h b/tests/core/input/test_input_event.cpp similarity index 97% rename from tests/core/input/test_input_event.h rename to tests/core/input/test_input_event.cpp index 094bb6746b..594660d4b2 100644 --- a/tests/core/input/test_input_event.h +++ b/tests/core/input/test_input_event.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_input_event.h */ +/* test_input_event.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_input_event) #include "core/input/input_event.h" #include "core/math/rect2.h" #include "core/os/memory.h" #include "core/variant/array.h" -#include "tests/test_macros.h" - namespace TestInputEvent { + TEST_CASE("[InputEvent] Signal is emitted when device is changed") { Ref input_event; input_event.instantiate(); @@ -107,4 +108,5 @@ TEST_CASE("[InputEvent] Test xformed_by") { CHECK(iemm2->get_position().is_equal_approx(Vector2(2.0f, 3.0f))); } + } // namespace TestInputEvent diff --git a/tests/core/input/test_input_event_key.h b/tests/core/input/test_input_event_key.cpp similarity index 99% rename from tests/core/input/test_input_event_key.h rename to tests/core/input/test_input_event_key.cpp index a0da97c050..cc2add3d14 100644 --- a/tests/core/input/test_input_event_key.h +++ b/tests/core/input/test_input_event_key.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_input_event_key.h */ +/* test_input_event_key.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_input_event_key) #include "core/input/input_event.h" #include "core/os/keyboard.h" -#include "tests/test_macros.h" - namespace TestInputEventKey { TEST_CASE("[InputEventKey] Key correctly registers being pressed") { @@ -372,4 +372,5 @@ TEST_CASE("[IsMatch] Keys are correctly matched") { key3.set_keycode(Key::SHIFT); CHECK(key3.is_match(loc_ref, false) == true); } + } // namespace TestInputEventKey diff --git a/tests/core/input/test_input_event_mouse.h b/tests/core/input/test_input_event_mouse.cpp similarity index 97% rename from tests/core/input/test_input_event_mouse.h rename to tests/core/input/test_input_event_mouse.cpp index 0fa0f8dc03..62cf962220 100644 --- a/tests/core/input/test_input_event_mouse.h +++ b/tests/core/input/test_input_event_mouse.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_input_event_mouse.h */ +/* test_input_event_mouse.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_input_event_mouse) #include "core/input/input_event.h" -#include "tests/test_macros.h" namespace TestInputEventMouse { @@ -75,4 +76,5 @@ TEST_CASE("[InputEventMouse] Setting the global mouse position works correctly") CHECK(mousekey.get_global_position() == Vector2{ -1, -1 }); CHECK(mousekey.get_global_position() != Vector2{ 1, 1 }); } + } // namespace TestInputEventMouse diff --git a/tests/core/input/test_shortcut.h b/tests/core/input/test_shortcut.cpp similarity index 98% rename from tests/core/input/test_shortcut.h rename to tests/core/input/test_shortcut.cpp index 7c1acfbfd6..db0b9919d9 100644 --- a/tests/core/input/test_shortcut.h +++ b/tests/core/input/test_shortcut.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_shortcut.h */ +/* test_shortcut.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_shortcut) #include "core/input/input_event.h" #include "core/input/shortcut.h" @@ -37,8 +39,6 @@ #include "core/os/keyboard.h" #include "core/os/os.h" -#include "tests/test_macros.h" - namespace TestShortcut { TEST_CASE("[Shortcut] Empty shortcut should have no valid events and text equal to None") { @@ -215,4 +215,5 @@ TEST_CASE("[Shortcut] Equal arrays should be recognized as such.") { CHECK(s.is_event_array_equal(same, different2) == false); CHECK(s.is_event_array_equal(same, different3) == false); } + } // namespace TestShortcut diff --git a/tests/core/io/test_config_file.h b/tests/core/io/test_config_file.cpp similarity index 98% rename from tests/core/io/test_config_file.h rename to tests/core/io/test_config_file.cpp index c17f9c9c43..1b50a3beab 100644 --- a/tests/core/io/test_config_file.h +++ b/tests/core/io/test_config_file.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_config_file.h */ +/* test_config_file.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_config_file) #include "core/io/config_file.h" #include "core/os/os.h" -#include "tests/test_macros.h" - namespace TestConfigFile { TEST_CASE("[ConfigFile] Parsing well-formatted files") { @@ -158,4 +158,5 @@ antiAliasing=false CHECK_MESSAGE(file->get_as_utf8_string() == contents, "The saved configuration file should match the expected format."); } + } // namespace TestConfigFile diff --git a/tests/core/io/test_file_access.h b/tests/core/io/test_file_access.cpp similarity index 98% rename from tests/core/io/test_file_access.h rename to tests/core/io/test_file_access.cpp index 24b1bc6c54..038eaa4b76 100644 --- a/tests/core/io/test_file_access.h +++ b/tests/core/io/test_file_access.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_file_access.h */ +/* test_file_access.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/io/file_access.h" #include "tests/test_macros.h" + +TEST_FORCE_LINK(test_file_access) + +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "tests/test_utils.h" namespace TestFileAccess { diff --git a/tests/core/io/test_http_client.h b/tests/core/io/test_http_client.cpp similarity index 94% rename from tests/core/io/test_http_client.h rename to tests/core/io/test_http_client.cpp index db4fb79deb..9321506030 100644 --- a/tests/core/io/test_http_client.h +++ b/tests/core/io/test_http_client.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_http_client.h */ +/* test_http_client.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_http_client) #include "core/io/http_client.h" -#include "tests/test_macros.h" - -#include "modules/modules_enabled.gen.h" +#ifdef WEB_ENABLED +#include "modules/modules_enabled.gen.h" // For mbedtls. +#endif // WEB_ENABLED namespace TestHTTPClient { @@ -88,7 +90,7 @@ TEST_CASE("[HTTPClient] verify_headers") { ERR_PRINT_ON; } -#if defined(MODULE_MBEDTLS_ENABLED) || defined(WEB_ENABLED) +#ifdef MODULE_MBEDTLS_ENABLED TEST_CASE("[HTTPClient] connect_to_host") { Ref client = HTTPClient::create(); String host = "https://www.example.com"; @@ -99,6 +101,6 @@ TEST_CASE("[HTTPClient] connect_to_host") { Error err = client->connect_to_host(host, port, tls_options); CHECK_MESSAGE(err == OK, "Expected OK for successful connection"); } -#endif // MODULE_MBEDTLS_ENABLED || WEB_ENABLED +#endif // MODULE_MBEDTLS_ENABLED } // namespace TestHTTPClient diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.cpp similarity index 98% rename from tests/core/io/test_image.h rename to tests/core/io/test_image.cpp index b528ab4f25..59d90e0df0 100644 --- a/tests/core/io/test_image.h +++ b/tests/core/io/test_image.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_image.h */ +/* test_image.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" +TEST_FORCE_LINK(test_image) + +#include "core/io/file_access.h" #include "core/io/image.h" -#include "core/os/os.h" - #include "tests/test_utils.h" -#include "modules/modules_enabled.gen.h" - -#include "thirdparty/doctest/doctest.h" +#include "modules/modules_enabled.gen.h" // For bmp, jpg, svg, webp, tga. namespace TestImage { diff --git a/tests/core/io/test_ip.h b/tests/core/io/test_ip.cpp similarity index 96% rename from tests/core/io/test_ip.h rename to tests/core/io/test_ip.cpp index 88fc2270fb..092ec80277 100644 --- a/tests/core/io/test_ip.h +++ b/tests/core/io/test_ip.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_ip.h */ +/* test_ip.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_ip) #include "core/io/ip.h" -#include "tests/test_macros.h" - namespace TestIP { TEST_CASE("[IP] resolve_hostname") { diff --git a/tests/core/io/test_ip_address.h b/tests/core/io/test_ip_address.cpp similarity index 99% rename from tests/core/io/test_ip_address.h rename to tests/core/io/test_ip_address.cpp index c9bcde3fe9..5ec6b67dc4 100644 --- a/tests/core/io/test_ip_address.h +++ b/tests/core/io/test_ip_address.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_ip_address.h */ +/* test_ip_address.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_ip_address) #include "core/io/ip_address.h" -#include "tests/test_macros.h" - namespace TestIPAddress { struct IPTester : public IPAddress { diff --git a/tests/core/io/test_json.h b/tests/core/io/test_json.cpp similarity index 99% rename from tests/core/io/test_json.h rename to tests/core/io/test_json.cpp index 77dd5f45c7..93a3387d7f 100644 --- a/tests/core/io/test_json.h +++ b/tests/core/io/test_json.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_json.h */ +/* test_json.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_json) #include "core/io/json.h" -#include "thirdparty/doctest/doctest.h" - namespace TestJSON { TEST_CASE("[JSON] Stringify single data types") { @@ -423,4 +423,5 @@ TEST_CASE("[JSON] Serialization") { } } } + } // namespace TestJSON diff --git a/tests/core/io/test_json_native.h b/tests/core/io/test_json_native.cpp similarity index 98% rename from tests/core/io/test_json_native.h rename to tests/core/io/test_json_native.cpp index f6e067744a..ff4ef5259b 100644 --- a/tests/core/io/test_json_native.h +++ b/tests/core/io/test_json_native.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_json_native.h */ +/* test_json_native.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_json_native) #include "core/io/json.h" - #include "core/variant/typed_array.h" #include "core/variant/typed_dictionary.h" -#include "tests/test_macros.h" namespace TestJSONNative { diff --git a/tests/core/io/test_logger.h b/tests/core/io/test_logger.cpp similarity index 97% rename from tests/core/io/test_logger.h rename to tests/core/io/test_logger.cpp index e61b66df94..1b9d9affab 100644 --- a/tests/core/io/test_logger.h +++ b/tests/core/io/test_logger.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_logger.h */ +/* test_logger.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/io/dir_access.h" -#include "core/io/logger.h" -#include "modules/regex/regex.h" #include "tests/test_macros.h" +TEST_FORCE_LINK(test_logger) + +#include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" +#include "core/io/logger.h" + namespace TestLogger { constexpr int sleep_duration = 1200000; diff --git a/tests/core/io/test_marshalls.h b/tests/core/io/test_marshalls.cpp similarity index 99% rename from tests/core/io/test_marshalls.h rename to tests/core/io/test_marshalls.cpp index d16a3ea578..3dff271e90 100644 --- a/tests/core/io/test_marshalls.h +++ b/tests/core/io/test_marshalls.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_marshalls.h */ +/* test_marshalls.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_marshalls) #include "core/io/marshalls.h" -#include "tests/test_macros.h" - namespace TestMarshalls { TEST_CASE("[Marshalls] Unsigned 16 bit integer encoding") { diff --git a/tests/core/io/test_packet_peer.h b/tests/core/io/test_packet_peer.cpp similarity index 98% rename from tests/core/io/test_packet_peer.h rename to tests/core/io/test_packet_peer.cpp index a47b14feae..044f566efc 100644 --- a/tests/core/io/test_packet_peer.h +++ b/tests/core/io/test_packet_peer.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_packet_peer.h */ +/* test_packet_peer.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_packet_peer) #include "core/io/packet_peer.h" -#include "tests/test_macros.h" namespace TestPacketPeer { diff --git a/tests/core/io/test_pck_packer.h b/tests/core/io/test_pck_packer.cpp similarity index 97% rename from tests/core/io/test_pck_packer.h rename to tests/core/io/test_pck_packer.cpp index 6b2eb164d5..f17224f0e2 100644 --- a/tests/core/io/test_pck_packer.h +++ b/tests/core/io/test_pck_packer.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_pck_packer.h */ +/* test_pck_packer.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_pck_packer) #include "core/io/file_access_pack.h" #include "core/io/pck_packer.h" #include "core/os/os.h" - #include "tests/test_utils.h" -#include "thirdparty/doctest/doctest.h" namespace TestPCKPacker { @@ -119,4 +119,5 @@ TEST_CASE("[PCKPacker] Pack a PCK file with some files and directories") { f->get_length() <= 27000, "The generated non-empty PCK file shouldn't be too large."); } + } // namespace TestPCKPacker diff --git a/tests/core/io/test_resource.h b/tests/core/io/test_resource.cpp similarity index 99% rename from tests/core/io/test_resource.h rename to tests/core/io/test_resource.cpp index 9d909bfd06..f79c674c1c 100644 --- a/tests/core/io/test_resource.h +++ b/tests/core/io/test_resource.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_resource.h */ +/* test_resource.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_resource) #include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "scene/main/node.h" - -#include "thirdparty/doctest/doctest.h" - -#include "tests/test_macros.h" +#include "tests/test_utils.h" #include @@ -627,4 +626,5 @@ TEST_CASE("[Resource] Breaking circular references on save") { // Break circular reference to avoid memory leak resource_c->remove_meta("next"); } + } // namespace TestResource diff --git a/tests/core/io/test_resource_uid.h b/tests/core/io/test_resource_uid.cpp similarity index 97% rename from tests/core/io/test_resource_uid.h rename to tests/core/io/test_resource_uid.cpp index 0a8f04e8a8..1ad86c3fa7 100644 --- a/tests/core/io/test_resource_uid.h +++ b/tests/core/io/test_resource_uid.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_resource_uid.h */ +/* test_resource_uid.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_resource_uid) #include "core/io/resource_uid.h" -#include "thirdparty/doctest/doctest.h" - -#include "tests/test_macros.h" - namespace TestResourceUID { TEST_CASE("[ResourceUID] Must encode/decode maximum/minimum UID correctly") { diff --git a/tests/core/io/test_stream_peer.h b/tests/core/io/test_stream_peer.cpp similarity index 98% rename from tests/core/io/test_stream_peer.h rename to tests/core/io/test_stream_peer.cpp index 0aa7302ead..1c30088228 100644 --- a/tests/core/io/test_stream_peer.h +++ b/tests/core/io/test_stream_peer.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_stream_peer.h */ +/* test_stream_peer.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_stream_peer) #include "core/io/stream_peer.h" -#include "tests/test_macros.h" namespace TestStreamPeer { diff --git a/tests/core/io/test_stream_peer_buffer.h b/tests/core/io/test_stream_peer_buffer.cpp similarity index 98% rename from tests/core/io/test_stream_peer_buffer.h rename to tests/core/io/test_stream_peer_buffer.cpp index 766ccf415b..cb45548e13 100644 --- a/tests/core/io/test_stream_peer_buffer.h +++ b/tests/core/io/test_stream_peer_buffer.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_stream_peer_buffer.h */ +/* test_stream_peer_buffer.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_stream_peer_buffer) #include "core/io/stream_peer.h" -#include "tests/test_macros.h" namespace TestStreamPeerBuffer { diff --git a/tests/core/io/test_stream_peer_gzip.h b/tests/core/io/test_stream_peer_gzip.cpp similarity index 97% rename from tests/core/io/test_stream_peer_gzip.h rename to tests/core/io/test_stream_peer_gzip.cpp index 54935e2030..a6917c1e8f 100644 --- a/tests/core/io/test_stream_peer_gzip.h +++ b/tests/core/io/test_stream_peer_gzip.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_stream_peer_gzip.h */ +/* test_stream_peer_gzip.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/io/stream_peer_gzip.h" #include "tests/test_macros.h" -namespace TestStreamPeerGZIP { +TEST_FORCE_LINK(test_stream_peer_gzip) + +#include "core/io/stream_peer_gzip.h" + +namespace TestStreamGZIP { const String hello = "Hello World!!!"; @@ -192,4 +193,4 @@ TEST_CASE("[StreamPeerGZIP] Fails to get if nothing was compress/decompress") { ERR_PRINT_ON; } -} // namespace TestStreamPeerGZIP +} // namespace TestStreamGZIP diff --git a/tests/core/io/test_stream_peer_tcp.h b/tests/core/io/test_stream_peer_tcp.cpp similarity index 98% rename from tests/core/io/test_stream_peer_tcp.h rename to tests/core/io/test_stream_peer_tcp.cpp index f0ef21b89e..df17461cda 100644 --- a/tests/core/io/test_stream_peer_tcp.h +++ b/tests/core/io/test_stream_peer_tcp.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_stream_peer_tcp.h */ +/* test_stream_peer_tcp.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_stream_peer_tcp) #include "core/io/net_socket.h" #include "core/io/stream_peer_tcp.h" -#include "tests/test_macros.h" namespace TestStreamPeerTCP { diff --git a/tests/core/io/test_tcp_server.h b/tests/core/io/test_tcp_server.cpp similarity index 98% rename from tests/core/io/test_tcp_server.h rename to tests/core/io/test_tcp_server.cpp index 590567d0be..0c035fc510 100644 --- a/tests/core/io/test_tcp_server.h +++ b/tests/core/io/test_tcp_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_tcp_server.h */ +/* test_tcp_server.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" +TEST_FORCE_LINK(test_tcp_server) + +#include "core/config/project_settings.h" #include "core/io/stream_peer_tcp.h" #include "core/io/tcp_server.h" -#include "tests/test_macros.h" #include diff --git a/tests/core/io/test_udp_server.h b/tests/core/io/test_udp_server.cpp similarity index 98% rename from tests/core/io/test_udp_server.h rename to tests/core/io/test_udp_server.cpp index 9403ddc033..fb7f08ea5c 100644 --- a/tests/core/io/test_udp_server.h +++ b/tests/core/io/test_udp_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_udp_server.h */ +/* test_udp_server.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_udp_server) #include "core/io/packet_peer_udp.h" #include "core/io/udp_server.h" -#include "tests/test_macros.h" + +#include namespace TestUDPServer { diff --git a/tests/core/io/test_uds_server.h b/tests/core/io/test_uds_server.cpp similarity index 98% rename from tests/core/io/test_uds_server.h rename to tests/core/io/test_uds_server.cpp index 84e6b346a2..749732b624 100644 --- a/tests/core/io/test_uds_server.h +++ b/tests/core/io/test_uds_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_uds_server.h */ +/* test_uds_server.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,19 +28,21 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" +TEST_FORCE_LINK(test_uds_server) + +#ifdef UNIX_ENABLED + +#include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/io/stream_peer_uds.h" #include "core/io/uds_server.h" -#include "tests/test_macros.h" #include namespace TestUDSServer { -#ifdef UNIX_ENABLED - const String SOCKET_PATH = "/tmp/godot_test_uds_socket"; const uint32_t SLEEP_DURATION = 1000; const uint64_t MAX_WAIT_USEC = 2000000; @@ -297,6 +299,6 @@ TEST_CASE("[UDSServer] Test with different socket paths") { } } -#endif - } // namespace TestUDSServer + +#endif // UNIX_ENABLED diff --git a/tests/core/io/test_xml_parser.h b/tests/core/io/test_xml_parser.cpp similarity index 98% rename from tests/core/io/test_xml_parser.h rename to tests/core/io/test_xml_parser.cpp index 33020c7e5f..ac0fd8a959 100644 --- a/tests/core/io/test_xml_parser.h +++ b/tests/core/io/test_xml_parser.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_xml_parser.h */ +/* test_xml_parser.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_xml_parser) #include "core/io/xml_parser.h" -#include "tests/test_macros.h" - namespace TestXMLParser { + TEST_CASE("[XMLParser] End-to-end") { String source = "\ \ @@ -229,4 +230,5 @@ TEST_CASE("[XMLParser] CDATA") { CHECK_EQ(parser.get_node_type(), XMLParser::NodeType::NODE_ELEMENT_END); CHECK_EQ(parser.get_node_name(), "a"); } + } // namespace TestXMLParser diff --git a/tests/core/math/test_aabb.h b/tests/core/math/test_aabb.cpp similarity index 99% rename from tests/core/math/test_aabb.h rename to tests/core/math/test_aabb.cpp index 6c912b5c9d..8131255b59 100644 --- a/tests/core/math/test_aabb.h +++ b/tests/core/math/test_aabb.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_aabb.h */ +/* test_aabb.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_aabb) #include "core/math/aabb.h" -#include "tests/test_macros.h" - namespace TestAABB { TEST_CASE("[AABB] Constructor methods") { diff --git a/tests/core/math/test_astar.h b/tests/core/math/test_astar.cpp similarity index 98% rename from tests/core/math/test_astar.h rename to tests/core/math/test_astar.cpp index c0997c8837..fc973d3c64 100644 --- a/tests/core/math/test_astar.h +++ b/tests/core/math/test_astar.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_astar.h */ +/* test_astar.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_astar) #include "core/math/a_star.h" -#include "tests/test_macros.h" - namespace TestAStar { class ABCX : public AStar3D { @@ -233,4 +233,5 @@ TEST_CASE("[AStar3D] Path from disabled point is empty") { CHECK(a.get_point_path(1, 1).is_empty()); CHECK(a.get_point_path(1, 2).is_empty()); } + } // namespace TestAStar diff --git a/tests/core/math/test_basis.h b/tests/core/math/test_basis.cpp similarity index 99% rename from tests/core/math/test_basis.h rename to tests/core/math/test_basis.cpp index 3f44d3dfee..06657f6c61 100644 --- a/tests/core/math/test_basis.h +++ b/tests/core/math/test_basis.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_basis.h */ +/* test_basis.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_basis) #include "core/math/basis.h" #include "core/math/random_number_generator.h" -#include "tests/test_macros.h" - namespace TestBasis { Vector3 deg_to_rad(const Vector3 &p_rotation) { diff --git a/tests/core/math/test_color.h b/tests/core/math/test_color.cpp similarity index 99% rename from tests/core/math/test_color.h rename to tests/core/math/test_color.cpp index 297b380ea6..9f7a5620b8 100644 --- a/tests/core/math/test_color.h +++ b/tests/core/math/test_color.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_color.h */ +/* test_color.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_color) #include "core/math/color.h" -#include "tests/test_macros.h" - namespace TestColor { TEST_CASE("[Color] Constructor methods") { @@ -225,4 +225,5 @@ TEST_CASE("[Color] Manipulation methods") { red.lerp(yellow, 0.5).is_equal_approx(Color(1, 0.5, 0, 0.5)), "Red interpolated with yellow should be orange (with interpolated alpha)."); } + } // namespace TestColor diff --git a/tests/core/math/test_expression.h b/tests/core/math/test_expression.cpp similarity index 99% rename from tests/core/math/test_expression.h rename to tests/core/math/test_expression.cpp index 26c90b6557..30c6561591 100644 --- a/tests/core/math/test_expression.h +++ b/tests/core/math/test_expression.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_expression.h */ +/* test_expression.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_expression) #include "core/math/expression.h" -#include "tests/test_macros.h" - namespace TestExpression { TEST_CASE("[Expression] Integer arithmetic") { @@ -487,4 +487,5 @@ TEST_CASE("[Expression] Unusual expressions") { // int64_t(expression.execute()) == 0, // "`(-9223372036854775807 - 1) / -1` should return the expected result."); } + } // namespace TestExpression diff --git a/tests/core/math/test_geometry_2d.h b/tests/core/math/test_geometry_2d.cpp similarity index 99% rename from tests/core/math/test_geometry_2d.h rename to tests/core/math/test_geometry_2d.cpp index 415912fe9e..4b9981cece 100644 --- a/tests/core/math/test_geometry_2d.h +++ b/tests/core/math/test_geometry_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_geometry_2d.h */ +/* test_geometry_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_geometry_2d) #include "core/math/geometry_2d.h" -#include "thirdparty/doctest/doctest.h" - namespace TestGeometry2D { TEST_CASE("[Geometry2D] Point in circle") { @@ -889,4 +889,5 @@ TEST_CASE("[Geometry2D] Bresenham line") { CHECK(r[11] == Vector2i(11, 5)); } } + } // namespace TestGeometry2D diff --git a/tests/core/math/test_geometry_3d.h b/tests/core/math/test_geometry_3d.cpp similarity index 99% rename from tests/core/math/test_geometry_3d.h rename to tests/core/math/test_geometry_3d.cpp index b44e85ee4a..203e161c86 100644 --- a/tests/core/math/test_geometry_3d.h +++ b/tests/core/math/test_geometry_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_geometry_3d.h */ +/* test_geometry_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/math/geometry_3d.h" #include "tests/test_macros.h" +TEST_FORCE_LINK(test_geometry_3d) + +#include "core/math/geometry_3d.h" + namespace TestGeometry3D { + TEST_CASE("[Geometry3D] Closest Points Between Segments") { Vector3 ps, qt; Geometry3D::get_closest_points_between_segments(Vector3(1, -1, 1), Vector3(1, 1, -1), Vector3(-1, -2, -1), Vector3(-1, 1, 1), ps, qt); @@ -199,4 +201,5 @@ TEST_CASE("[Geometry3D] Triangle and Sphere Intersect") { CHECK(Geometry3D::triangle_sphere_intersection_test(triangle_a, triangle_b, triangle_c, Vector3(0, 1, 0), Vector3(0, 0, 0), 5, triangle_contact, sphere_contact) == true); CHECK(Geometry3D::triangle_sphere_intersection_test(triangle_a, triangle_b, triangle_c, Vector3(0, 1, 0), Vector3(20, 0, 0), 5, triangle_contact, sphere_contact) == false); } + } // namespace TestGeometry3D diff --git a/tests/core/math/test_math_funcs.h b/tests/core/math/test_math_funcs.cpp similarity index 99% rename from tests/core/math/test_math_funcs.h rename to tests/core/math/test_math_funcs.cpp index 98ce3bf076..c29249217d 100644 --- a/tests/core/math/test_math_funcs.h +++ b/tests/core/math/test_math_funcs.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_math_funcs.h */ +/* test_math_funcs.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - #include "tests/test_macros.h" -namespace TestMath { +TEST_FORCE_LINK(test_math_funcs) + +namespace TestMathFuncs { TEST_CASE("[Math] C++ macros") { CHECK(MIN(-2, 2) == -2); @@ -638,4 +638,4 @@ TEST_CASE_TEMPLATE("[Math] bezier_interpolate", T, float, double) { CHECK(Math::bezier_interpolate((T)0.0, (T)0.2, (T)0.8, (T)1.0, (T)1.0) == doctest::Approx((T)1.0)); } -} // namespace TestMath +} // namespace TestMathFuncs diff --git a/tests/core/math/test_plane.h b/tests/core/math/test_plane.cpp similarity index 98% rename from tests/core/math/test_plane.h rename to tests/core/math/test_plane.cpp index aefd27ca43..24304d3ea5 100644 --- a/tests/core/math/test_plane.h +++ b/tests/core/math/test_plane.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_plane.h */ +/* test_plane.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_plane) #include "core/math/plane.h" -#include "thirdparty/doctest/doctest.h" - namespace TestPlane { -// Plane - TEST_CASE("[Plane] Constructor methods") { constexpr Plane plane = Plane(32, 22, 16, 3); constexpr Plane plane_vector = Plane(Vector3(32, 22, 16), 3); diff --git a/tests/core/math/test_projection.h b/tests/core/math/test_projection.cpp similarity index 99% rename from tests/core/math/test_projection.h rename to tests/core/math/test_projection.cpp index d3bf3e2def..dea0d29dd7 100644 --- a/tests/core/math/test_projection.h +++ b/tests/core/math/test_projection.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_projection.h */ +/* test_projection.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_projection) #include "core/math/aabb.h" #include "core/math/plane.h" @@ -36,8 +38,6 @@ #include "core/math/rect2.h" #include "core/math/transform_3d.h" -#include "thirdparty/doctest/doctest.h" - namespace TestProjection { TEST_CASE("[Projection] Construction") { @@ -691,4 +691,5 @@ TEST_CASE("[Projection] Pixels per meter") { ppm = proj.get_pixels_per_meter(800); CHECK(ppm == 400); } -} //namespace TestProjection + +} // namespace TestProjection diff --git a/tests/core/math/test_quaternion.h b/tests/core/math/test_quaternion.cpp similarity index 99% rename from tests/core/math/test_quaternion.h rename to tests/core/math/test_quaternion.cpp index ea4c5ea89d..19938e54e7 100644 --- a/tests/core/math/test_quaternion.h +++ b/tests/core/math/test_quaternion.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_quaternion.h */ +/* test_quaternion.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_quaternion) #include "core/math/math_defs.h" #include "core/math/math_funcs.h" #include "core/math/quaternion.h" #include "core/math/vector3.h" -#include "tests/test_macros.h" - namespace TestQuaternion { Quaternion quat_euler_yxz_deg(Vector3 angle) { diff --git a/tests/core/math/test_random_number_generator.h b/tests/core/math/test_random_number_generator.cpp similarity index 98% rename from tests/core/math/test_random_number_generator.h rename to tests/core/math/test_random_number_generator.cpp index 57360a2710..11aef83555 100644 --- a/tests/core/math/test_random_number_generator.h +++ b/tests/core/math/test_random_number_generator.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_random_number_generator.h */ +/* test_random_number_generator.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_random_number_generator) #include "core/math/random_number_generator.h" -#include "tests/test_macros.h" namespace TestRandomNumberGenerator { @@ -269,4 +270,5 @@ TEST_CASE_MAY_FAIL("[RandomNumberGenerator] randi_range bias check") { CHECK_MESSAGE(std::abs(vals[i] / 1000000.0 - 0.1) < 0.01, "Each element should appear roughly 10% of the time"); } } + } // namespace TestRandomNumberGenerator diff --git a/tests/core/math/test_rect2.h b/tests/core/math/test_rect2.cpp similarity index 99% rename from tests/core/math/test_rect2.h rename to tests/core/math/test_rect2.cpp index 69280fe67f..1c92eaa870 100644 --- a/tests/core/math/test_rect2.h +++ b/tests/core/math/test_rect2.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_rect2.h */ +/* test_rect2.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_rect2) #include "core/math/rect2.h" #include "core/math/rect2i.h" -#include "thirdparty/doctest/doctest.h" - namespace TestRect2 { + TEST_CASE("[Rect2] Constructor methods") { constexpr Rect2 rect = Rect2(0, 100, 1280, 720); constexpr Rect2 rect_vector = Rect2(Vector2(0, 100), Vector2(1280, 720)); diff --git a/tests/core/math/test_rect2i.h b/tests/core/math/test_rect2i.cpp similarity index 99% rename from tests/core/math/test_rect2i.h rename to tests/core/math/test_rect2i.cpp index 68495bacf8..ec4597ce87 100644 --- a/tests/core/math/test_rect2i.h +++ b/tests/core/math/test_rect2i.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_rect2i.h */ +/* test_rect2i.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_rect2i) #include "core/math/rect2.h" #include "core/math/rect2i.h" -#include "thirdparty/doctest/doctest.h" - namespace TestRect2i { + TEST_CASE("[Rect2i] Constructor methods") { constexpr Rect2i recti = Rect2i(0, 100, 1280, 720); constexpr Rect2i recti_vector = Rect2i(Vector2i(0, 100), Vector2i(1280, 720)); @@ -305,4 +306,5 @@ TEST_CASE("[Rect2i] Merging") { Rect2i(0, 100, 1280, 720).merge(Rect2i(-4000, -4000, 100, 100)) == Rect2i(-4000, -4000, 5280, 4820), "merge() with non-enclosed Rect2i should return the expected result."); } + } // namespace TestRect2i diff --git a/tests/core/math/test_transform_2d.h b/tests/core/math/test_transform_2d.cpp similarity index 99% rename from tests/core/math/test_transform_2d.h rename to tests/core/math/test_transform_2d.cpp index b6f18bd7c6..2706b6a0fd 100644 --- a/tests/core/math/test_transform_2d.h +++ b/tests/core/math/test_transform_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_transform_2d.h */ +/* test_transform_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_transform_2d) #include "core/math/transform_2d.h" -#include "tests/test_macros.h" - namespace TestTransform2D { Transform2D create_dummy_transform() { diff --git a/tests/core/math/test_transform_3d.h b/tests/core/math/test_transform_3d.cpp similarity index 98% rename from tests/core/math/test_transform_3d.h rename to tests/core/math/test_transform_3d.cpp index c1030d57b8..abd306da76 100644 --- a/tests/core/math/test_transform_3d.h +++ b/tests/core/math/test_transform_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_transform_3d.h */ +/* test_transform_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_transform_3d) #include "core/math/transform_3d.h" -#include "tests/test_macros.h" - namespace TestTransform3D { Transform3D create_dummy_transform() { @@ -135,4 +135,5 @@ TEST_CASE("[Transform3D] Rotate in-place (local rotation)") { const Transform3D rotated_transform = Transform3D(transform.rotated_local(Vector3(0, 1, 0), Math::PI)); CHECK_MESSAGE(rotated_transform.is_equal_approx(expected), "The rotated transform should have a new orientation but still be based on the same origin."); } + } // namespace TestTransform3D diff --git a/tests/core/math/test_triangle_mesh.h b/tests/core/math/test_triangle_mesh.cpp similarity index 96% rename from tests/core/math/test_triangle_mesh.h rename to tests/core/math/test_triangle_mesh.cpp index f138b554c3..333ae5eb8a 100644 --- a/tests/core/math/test_triangle_mesh.h +++ b/tests/core/math/test_triangle_mesh.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_triangle_mesh.h */ +/* test_triangle_mesh.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_triangle_mesh) + +#ifndef _3D_DISABLED #include "core/math/triangle_mesh.h" #include "scene/resources/3d/primitive_meshes.h" -#include "tests/test_macros.h" - namespace TestTriangleMesh { TEST_CASE("[SceneTree][TriangleMesh] BVH creation and intersection") { @@ -79,4 +81,7 @@ TEST_CASE("[SceneTree][TriangleMesh] BVH creation and intersection") { CHECK(face_index == 8); } } + } // namespace TestTriangleMesh + +#endif // _3D_DISABLED diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.cpp similarity index 99% rename from tests/core/math/test_vector2.h rename to tests/core/math/test_vector2.cpp index 683da430eb..75c80b43d1 100644 --- a/tests/core/math/test_vector2.h +++ b/tests/core/math/test_vector2.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector2.h */ +/* test_vector2.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector2) #include "core/math/vector2.h" #include "core/math/vector2i.h" -#include "tests/test_macros.h" namespace TestVector2 { diff --git a/tests/core/math/test_vector2i.h b/tests/core/math/test_vector2i.cpp similarity index 98% rename from tests/core/math/test_vector2i.h rename to tests/core/math/test_vector2i.cpp index edd2f7a832..7aa2bcda7e 100644 --- a/tests/core/math/test_vector2i.h +++ b/tests/core/math/test_vector2i.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector2i.h */ +/* test_vector2i.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector2i) #include "core/math/vector2.h" #include "core/math/vector2i.h" -#include "tests/test_macros.h" namespace TestVector2i { @@ -165,4 +166,5 @@ TEST_CASE("[Vector2i] Abs and sign methods") { vector2.sign() == Vector2i(1, -1), "Vector2i sign should work as expected."); } + } // namespace TestVector2i diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.cpp similarity index 99% rename from tests/core/math/test_vector3.h rename to tests/core/math/test_vector3.cpp index c8f377dd52..76b5acaa13 100644 --- a/tests/core/math/test_vector3.h +++ b/tests/core/math/test_vector3.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector3.h */ +/* test_vector3.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector3) #include "core/math/vector3.h" -#include "tests/test_macros.h" namespace TestVector3 { diff --git a/tests/core/math/test_vector3i.h b/tests/core/math/test_vector3i.cpp similarity index 98% rename from tests/core/math/test_vector3i.h rename to tests/core/math/test_vector3i.cpp index cec23525c2..2aaa1e53a3 100644 --- a/tests/core/math/test_vector3i.h +++ b/tests/core/math/test_vector3i.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector3i.h */ +/* test_vector3i.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector3i) #include "core/math/vector3i.h" -#include "tests/test_macros.h" namespace TestVector3i { @@ -164,4 +165,5 @@ TEST_CASE("[Vector3i] Abs and sign methods") { vector2.sign() == Vector3i(1, -1, -1), "Vector3i sign should work as expected."); } + } // namespace TestVector3i diff --git a/tests/core/math/test_vector4.h b/tests/core/math/test_vector4.cpp similarity index 99% rename from tests/core/math/test_vector4.h rename to tests/core/math/test_vector4.cpp index 457c5327b6..1c05a4060f 100644 --- a/tests/core/math/test_vector4.h +++ b/tests/core/math/test_vector4.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector4.h */ +/* test_vector4.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector4) #include "core/math/vector4.h" -#include "tests/test_macros.h" namespace TestVector4 { diff --git a/tests/core/math/test_vector4i.h b/tests/core/math/test_vector4i.cpp similarity index 98% rename from tests/core/math/test_vector4i.h rename to tests/core/math/test_vector4i.cpp index 661cc369c7..d95fded53f 100644 --- a/tests/core/math/test_vector4i.h +++ b/tests/core/math/test_vector4i.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector4i.h */ +/* test_vector4i.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector4i) #include "core/math/vector4i.h" -#include "tests/test_macros.h" namespace TestVector4i { @@ -168,4 +169,5 @@ TEST_CASE("[Vector4i] Abs and sign methods") { vector2.sign() == Vector4i(1, -1, -1, 1), "Vector4i sign should work as expected."); } + } // namespace TestVector4i diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.cpp similarity index 99% rename from tests/core/object/test_class_db.h rename to tests/core/object/test_class_db.cpp index 39400ccd7f..c4db740aef 100644 --- a/tests/core/object/test_class_db.h +++ b/tests/core/object/test_class_db.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_class_db.h */ +/* test_class_db.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_class_db) #include "core/core_bind.h" #include "core/core_constants.h" #include "core/object/class_db.h" -#include "tests/test_macros.h" - namespace TestClassDB { struct TypeReference { @@ -887,4 +887,5 @@ TEST_SUITE("[ClassDB]") { } } } + } // namespace TestClassDB diff --git a/tests/core/object/test_method_bind.h b/tests/core/object/test_method_bind.cpp similarity index 98% rename from tests/core/object/test_method_bind.h rename to tests/core/object/test_method_bind.cpp index 4f278f5bb9..f88ab828ee 100644 --- a/tests/core/object/test_method_bind.h +++ b/tests/core/object/test_method_bind.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_method_bind.h */ +/* test_method_bind.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_method_bind) #include "core/object/class_db.h" -#include "tests/test_macros.h" - namespace TestMethodBind { class MethodBindTester : public Object { @@ -171,4 +171,5 @@ TEST_CASE("[MethodBind] check all method binds") { memdelete(mbt); } + } // namespace TestMethodBind diff --git a/tests/core/object/test_object.h b/tests/core/object/test_object.cpp similarity index 98% rename from tests/core/object/test_object.h rename to tests/core/object/test_object.cpp index 89fa5fa88b..cbc28f2ea0 100644 --- a/tests/core/object/test_object.h +++ b/tests/core/object/test_object.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_object.h */ +/* test_object.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,17 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_object) #include "core/object/class_db.h" #include "core/object/object.h" #include "core/object/script_language.h" -#include "tests/test_macros.h" +namespace TestObject { -// Declared in global namespace because of GDCLASS macro warning (Windows): -// "Unqualified friend declaration referring to type outside of the nearest enclosing namespace -// is a Microsoft extension; add a nested name specifier". class _TestDerivedObject : public Object { GDCLASS(_TestDerivedObject, Object); @@ -56,8 +55,6 @@ public: int get_property() const { return property_value; } }; -namespace TestObject { - class _MockScriptInstance : public ScriptInstance { StringName property_name = "NO_NAME"; Variant property_value; diff --git a/tests/core/object/test_undo_redo.h b/tests/core/object/test_undo_redo.cpp similarity index 95% rename from tests/core/object/test_undo_redo.h rename to tests/core/object/test_undo_redo.cpp index 51b2b000c6..941074fd52 100644 --- a/tests/core/object/test_undo_redo.h +++ b/tests/core/object/test_undo_redo.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_undo_redo.h */ +/* test_undo_redo.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/object/undo_redo.h" #include "tests/test_macros.h" -// Declared in global namespace because of GDCLASS macro warning (Windows): -// "Unqualified friend declaration referring to type outside of the nearest enclosing namespace -// is a Microsoft extension; add a nested name specifier". +TEST_FORCE_LINK(test_undo_redo) + +#include "core/object/undo_redo.h" + +namespace TestUndoRedo { + class _TestUndoRedoObject : public Object { GDCLASS(_TestUndoRedoObject, Object); int property_value = 0; @@ -54,8 +54,6 @@ public: void subtract_from_property(int value) { property_value -= value; } }; -namespace TestUndoRedo { - void set_property_action(UndoRedo *undo_redo, const String &name, _TestUndoRedoObject *test_object, int value, UndoRedo::MergeMode merge_mode = UndoRedo::MERGE_DISABLE) { undo_redo->create_action(name, merge_mode); undo_redo->add_do_property(test_object, "property", value); @@ -196,4 +194,4 @@ TEST_CASE("[UndoRedo] Merge Method UndoRedo") { memdelete(undo_redo); } -} //namespace TestUndoRedo +} // namespace TestUndoRedo diff --git a/tests/core/os/test_os.h b/tests/core/os/test_os.cpp similarity index 98% rename from tests/core/os/test_os.h rename to tests/core/os/test_os.cpp index 15d3b3af99..29c989956f 100644 --- a/tests/core/os/test_os.h +++ b/tests/core/os/test_os.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_os.h */ +/* test_os.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_os) #include "core/os/os.h" -#include "thirdparty/doctest/doctest.h" - namespace TestOS { TEST_CASE("[OS] Environment variables") { diff --git a/tests/core/string/test_fuzzy_search.h b/tests/core/string/test_fuzzy_search.cpp similarity index 95% rename from tests/core/string/test_fuzzy_search.h rename to tests/core/string/test_fuzzy_search.cpp index a7e52be1da..9d1536ef5b 100644 --- a/tests/core/string/test_fuzzy_search.h +++ b/tests/core/string/test_fuzzy_search.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_fuzzy_search.h */ +/* test_fuzzy_search.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/string/fuzzy_search.h" #include "tests/test_macros.h" +TEST_FORCE_LINK(test_fuzzy_search) + +#include "core/io/file_access.h" +#include "core/string/fuzzy_search.h" +#include "tests/test_utils.h" + namespace TestFuzzySearch { struct FuzzySearchTestCase { @@ -77,4 +80,4 @@ TEST_CASE("[FuzzySearch] Test fuzzy search results") { } } -} //namespace TestFuzzySearch +} // namespace TestFuzzySearch diff --git a/tests/core/string/test_node_path.h b/tests/core/string/test_node_path.cpp similarity index 99% rename from tests/core/string/test_node_path.h rename to tests/core/string/test_node_path.cpp index a30430dcbe..d33d1352b5 100644 --- a/tests/core/string/test_node_path.h +++ b/tests/core/string/test_node_path.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_node_path.h */ +/* test_node_path.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_node_path) #include "core/string/node_path.h" -#include "tests/test_macros.h" - namespace TestNodePath { TEST_CASE("[NodePath] Relative path") { diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.cpp similarity index 99% rename from tests/core/string/test_string.h rename to tests/core/string/test_string.cpp index 45a806fbe0..ee1effe091 100644 --- a/tests/core/string/test_string.h +++ b/tests/core/string/test_string.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_string.h */ +/* test_string.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_string) #include "core/string/ustring.h" -#include "tests/test_macros.h" - namespace TestString { int u32scmp(const char32_t *l, const char32_t *r) { @@ -2235,4 +2235,5 @@ TEST_CASE("[String][URL] Parse URL") { #undef CHECK_URL } + } // namespace TestString diff --git a/tests/core/string/test_translation.h b/tests/core/string/test_translation.cpp similarity index 99% rename from tests/core/string/test_translation.h rename to tests/core/string/test_translation.cpp index d2f2bd1670..bc1444d0d9 100644 --- a/tests/core/string/test_translation.h +++ b/tests/core/string/test_translation.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_translation.h */ +/* test_translation.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_translation) #include "core/string/optimized_translation.h" #include "core/string/plural_rules.h" @@ -39,7 +41,6 @@ #include "editor/import/resource_importer_csv_translation.h" #endif -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestTranslation { @@ -260,6 +261,7 @@ TEST_CASE("[TranslationCSV] CSV import") { TranslationServer::get_singleton()->remove_domain("godot.test"); } + #endif // TOOLS_ENABLED } // namespace TestTranslation diff --git a/tests/core/string/test_translation_server.h b/tests/core/string/test_translation_server.cpp similarity index 98% rename from tests/core/string/test_translation_server.h rename to tests/core/string/test_translation_server.cpp index e7cf57c2b3..5b50309628 100644 --- a/tests/core/string/test_translation_server.h +++ b/tests/core/string/test_translation_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_translation_server.h */ +/* test_translation_server.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_translation_server) #include "core/string/translation_server.h" -#include "tests/test_macros.h" - namespace TestTranslationServer { + TEST_CASE("[TranslationServer] Translation operations") { Ref td = TranslationServer::get_singleton()->get_or_add_domain("godot.test"); CHECK(td->get_translations().is_empty()); @@ -236,4 +237,5 @@ TEST_CASE("[TranslationServer] Comparing locales") { CHECK(res == 10); } + } // namespace TestTranslationServer diff --git a/tests/core/templates/test_a_hash_map.h b/tests/core/templates/test_a_hash_map.cpp similarity index 98% rename from tests/core/templates/test_a_hash_map.h rename to tests/core/templates/test_a_hash_map.cpp index 821ec523ed..e3ec85996e 100644 --- a/tests/core/templates/test_a_hash_map.h +++ b/tests/core/templates/test_a_hash_map.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_a_hash_map.h */ +/* test_a_hash_map.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_a_hash_map) #include "core/templates/a_hash_map.h" -#include "tests/test_macros.h" - namespace TestAHashMap { TEST_CASE("[AHashMap] List initialization") { diff --git a/tests/core/templates/test_command_queue.h b/tests/core/templates/test_command_queue.cpp similarity index 99% rename from tests/core/templates/test_command_queue.h rename to tests/core/templates/test_command_queue.cpp index 067954613e..b5b8c985ee 100644 --- a/tests/core/templates/test_command_queue.h +++ b/tests/core/templates/test_command_queue.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_command_queue.h */ +/* test_command_queue.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_command_queue) #include "core/config/project_settings.h" #include "core/math/random_number_generator.h" @@ -36,7 +38,6 @@ #include "core/os/os.h" #include "core/os/thread.h" #include "core/templates/command_queue_mt.h" -#include "tests/test_macros.h" namespace TestCommandQueue { @@ -518,4 +519,5 @@ TEST_CASE("[CommandQueue] Test Parameter Passing Semantics") { sts.destroy_threads(); } + } // namespace TestCommandQueue diff --git a/tests/core/templates/test_fixed_vector.h b/tests/core/templates/test_fixed_vector.cpp similarity index 97% rename from tests/core/templates/test_fixed_vector.h rename to tests/core/templates/test_fixed_vector.cpp index 72631f5fae..b6569519de 100644 --- a/tests/core/templates/test_fixed_vector.h +++ b/tests/core/templates/test_fixed_vector.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_fixed_vector.h */ +/* test_fixed_vector.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_fixed_vector) #include "core/templates/fixed_vector.h" -#include "tests/test_macros.h" - namespace TestFixedVector { struct MoveOnly { @@ -133,4 +133,4 @@ TEST_CASE("[FixedVector] Alignment Checks") { CHECK((size_t)&vector_uint64[3] % alignof(uint64_t) == 0); } -} //namespace TestFixedVector +} // namespace TestFixedVector diff --git a/tests/core/templates/test_hash_map.h b/tests/core/templates/test_hash_map.cpp similarity index 98% rename from tests/core/templates/test_hash_map.h rename to tests/core/templates/test_hash_map.cpp index e4b06c0ad5..59a8e0631e 100644 --- a/tests/core/templates/test_hash_map.h +++ b/tests/core/templates/test_hash_map.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_hash_map.h */ +/* test_hash_map.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_hash_map) #include "core/templates/hash_map.h" -#include "tests/test_macros.h" - namespace TestHashMap { TEST_CASE("[HashMap] List initialization") { @@ -173,4 +173,5 @@ TEST_CASE("[HashMap] Sort") { CHECK_EQ(kv.key, i); } } + } // namespace TestHashMap diff --git a/tests/core/templates/test_hash_set.h b/tests/core/templates/test_hash_set.cpp similarity index 98% rename from tests/core/templates/test_hash_set.h rename to tests/core/templates/test_hash_set.cpp index 81b3026a5b..85807d85a3 100644 --- a/tests/core/templates/test_hash_set.h +++ b/tests/core/templates/test_hash_set.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_hash_set.h */ +/* test_hash_set.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_hash_set) #include "core/templates/hash_set.h" -#include "tests/test_macros.h" - namespace TestHashSet { TEST_CASE("[HashSet] List initialization") { diff --git a/tests/core/templates/test_list.h b/tests/core/templates/test_list.cpp similarity index 99% rename from tests/core/templates/test_list.h rename to tests/core/templates/test_list.cpp index 7f6b8e04a6..d37243adda 100644 --- a/tests/core/templates/test_list.h +++ b/tests/core/templates/test_list.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_list.h */ +/* test_list.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_list) #include "core/templates/list.h" -#include "tests/test_macros.h" - namespace TestList { static void populate_integers(List &p_list, List::Element *r_elements[], int num_elements) { @@ -545,4 +545,5 @@ TEST_CASE("[List] Swap adjacent back and front (reverse order of elements)") { } } } + } // namespace TestList diff --git a/tests/core/templates/test_local_vector.h b/tests/core/templates/test_local_vector.cpp similarity index 98% rename from tests/core/templates/test_local_vector.h rename to tests/core/templates/test_local_vector.cpp index dc56a484fe..25a098a1fd 100644 --- a/tests/core/templates/test_local_vector.h +++ b/tests/core/templates/test_local_vector.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_local_vector.h */ +/* test_local_vector.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_local_vector) #include "core/templates/local_vector.h" -#include "tests/test_macros.h" - namespace TestLocalVector { TEST_CASE("[LocalVector] List Initialization.") { @@ -260,4 +260,5 @@ TEST_CASE("[LocalVector] Size / Resize / Reserve.") { CHECK(vector.size() == 4); CHECK(vector.get_capacity() >= 4); } + } // namespace TestLocalVector diff --git a/tests/core/templates/test_lru.h b/tests/core/templates/test_lru.cpp similarity index 97% rename from tests/core/templates/test_lru.h rename to tests/core/templates/test_lru.cpp index 44f6287edd..0b9b9efe3b 100644 --- a/tests/core/templates/test_lru.h +++ b/tests/core/templates/test_lru.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_lru.h */ +/* test_lru.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_lru) #include "core/templates/lru.h" -#include "tests/test_macros.h" - namespace TestLRU { TEST_CASE("[LRU] Store and read") { @@ -93,4 +93,5 @@ TEST_CASE("[LRU] Resize and clear") { CHECK(!lru.has(3)); CHECK(!lru.has(4)); } + } // namespace TestLRU diff --git a/tests/core/templates/test_paged_array.h b/tests/core/templates/test_paged_array.cpp similarity index 97% rename from tests/core/templates/test_paged_array.h rename to tests/core/templates/test_paged_array.cpp index e5cf3a7768..b3d80cdf0c 100644 --- a/tests/core/templates/test_paged_array.h +++ b/tests/core/templates/test_paged_array.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_paged_array.h */ +/* test_paged_array.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,16 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_paged_array) #include "core/templates/paged_array.h" -#include "thirdparty/doctest/doctest.h" - namespace TestPagedArray { -// PagedArray - TEST_CASE("[PagedArray] Simple fill and refill") { PagedArrayPool pool; PagedArray array; diff --git a/tests/core/templates/test_rid.h b/tests/core/templates/test_rid.cpp similarity index 98% rename from tests/core/templates/test_rid.h rename to tests/core/templates/test_rid.cpp index b8bdf8167b..b731b05823 100644 --- a/tests/core/templates/test_rid.h +++ b/tests/core/templates/test_rid.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_rid.h */ +/* test_rid.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,20 +28,21 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_rid) #include "core/os/thread.h" #include "core/templates/local_vector.h" #include "core/templates/rid.h" #include "core/templates/rid_owner.h" -#include "tests/test_macros.h" - #ifdef TSAN_ENABLED #include #endif namespace TestRID { + TEST_CASE("[RID] Default Constructor") { RID rid; diff --git a/tests/core/templates/test_self_list.h b/tests/core/templates/test_self_list.cpp similarity index 96% rename from tests/core/templates/test_self_list.h rename to tests/core/templates/test_self_list.cpp index 1abfc026b5..6bff7d6333 100644 --- a/tests/core/templates/test_self_list.h +++ b/tests/core/templates/test_self_list.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_self_list.h */ +/* test_self_list.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_self_list) #include "core/templates/self_list.h" -#include "tests/test_macros.h" - namespace TestSelfList { TEST_CASE("[SelfList] Sort") { @@ -69,4 +69,5 @@ TEST_CASE("[SelfList] Sort") { element.remove_from_list(); } } + } // namespace TestSelfList diff --git a/tests/core/templates/test_span.h b/tests/core/templates/test_span.cpp similarity index 97% rename from tests/core/templates/test_span.h rename to tests/core/templates/test_span.cpp index 869f8e4221..da71c9236c 100644 --- a/tests/core/templates/test_span.h +++ b/tests/core/templates/test_span.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_span.h */ +/* test_span.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_span) #include "core/templates/span.h" -#include "tests/test_macros.h" - namespace TestSpan { TEST_CASE("[Span] Constexpr Validators") { diff --git a/tests/core/templates/test_vector.h b/tests/core/templates/test_vector.cpp similarity index 99% rename from tests/core/templates/test_vector.h rename to tests/core/templates/test_vector.cpp index 6c6df5b78b..78f5cd3021 100644 --- a/tests/core/templates/test_vector.h +++ b/tests/core/templates/test_vector.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vector.h */ +/* test_vector.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vector) #include "core/templates/vector.h" -#include "tests/test_macros.h" - namespace TestVector { TEST_CASE("[Vector] List initialization") { diff --git a/tests/core/templates/test_vset.h b/tests/core/templates/test_vset.cpp similarity index 97% rename from tests/core/templates/test_vset.h rename to tests/core/templates/test_vset.cpp index f9def88040..df57475c41 100644 --- a/tests/core/templates/test_vset.h +++ b/tests/core/templates/test_vset.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_vset.h */ +/* test_vset.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_vset) #include "core/templates/vset.h" -#include "tests/test_macros.h" - namespace TestVSet { template diff --git a/tests/core/test_crypto.h b/tests/core/test_crypto.cpp similarity index 97% rename from tests/core/test_crypto.h rename to tests/core/test_crypto.cpp index 97564e3594..d9a1c4232e 100644 --- a/tests/core/test_crypto.h +++ b/tests/core/test_crypto.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_crypto.h */ +/* test_crypto.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_crypto) #include "core/crypto/crypto.h" -#include "tests/test_macros.h" namespace TestCrypto { @@ -67,4 +68,5 @@ TEST_CASE("[Crypto] PackedByteArray constant time compare") { equal = crypto.constant_time_compare(p1, p2); CHECK(!equal); } + } // namespace TestCrypto diff --git a/tests/core/test_hashing_context.h b/tests/core/test_hashing_context.cpp similarity index 98% rename from tests/core/test_hashing_context.h rename to tests/core/test_hashing_context.cpp index 89136b0581..9537631bf4 100644 --- a/tests/core/test_hashing_context.h +++ b/tests/core/test_hashing_context.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_hashing_context.h */ +/* test_hashing_context.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_hashing_context) #include "core/crypto/hashing_context.h" -#include "tests/test_macros.h" - namespace TestHashingContext { TEST_CASE("[HashingContext] Default - MD5/SHA1/SHA256") { @@ -159,4 +159,5 @@ TEST_CASE("[HashingContext] Invalid use of finish") { "Calling 'finish' before 'start' should return an empty byte array."); ERR_PRINT_ON; } + } // namespace TestHashingContext diff --git a/tests/core/test_time.h b/tests/core/test_time.cpp similarity index 99% rename from tests/core/test_time.h rename to tests/core/test_time.cpp index 41a6eb972b..cfdf9542e6 100644 --- a/tests/core/test_time.h +++ b/tests/core/test_time.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_time.h */ +/* test_time.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_time) #include "core/os/time.h" -#include "thirdparty/doctest/doctest.h" +namespace TestTime { #define YEAR_KEY "year" #define MONTH_KEY "month" @@ -43,8 +45,6 @@ #define SECOND_KEY "second" #define DST_KEY "dst" -namespace TestTime { - TEST_CASE("[Time] Unix time conversion to/from datetime string") { const Time *time = Time::get_singleton(); diff --git a/tests/test_validate_testing.h b/tests/core/test_validate_testing.cpp similarity index 97% rename from tests/test_validate_testing.h rename to tests/core/test_validate_testing.cpp index f5df399094..9cd5e12233 100644 --- a/tests/test_validate_testing.h +++ b/tests/core/test_validate_testing.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_validate_testing.h */ +/* test_validate_testing.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_validate_testing) #include "core/core_globals.h" #include "core/os/os.h" - -#include "tests/test_macros.h" #include "tests/test_tools.h" +namespace TestValidateTesting { + TEST_SUITE("Validate tests") { TEST_CASE("Always pass") { CHECK(true); @@ -200,3 +202,5 @@ TEST_SUITE("Validate tests") { REQUIRE(ed.has_error); } } + +} // namespace TestValidateTesting diff --git a/tests/core/threads/test_worker_thread_pool.h b/tests/core/threads/test_worker_thread_pool.cpp similarity index 98% rename from tests/core/threads/test_worker_thread_pool.h rename to tests/core/threads/test_worker_thread_pool.cpp index 26f08d7236..7b5b2fae0e 100644 --- a/tests/core/threads/test_worker_thread_pool.h +++ b/tests/core/threads/test_worker_thread_pool.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_worker_thread_pool.h */ +/* test_worker_thread_pool.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_worker_thread_pool) #include "core/object/worker_thread_pool.h" -#include "tests/test_macros.h" - namespace TestWorkerThreadPool { static LocalVector> counter; diff --git a/tests/core/variant/test_array.h b/tests/core/variant/test_array.cpp similarity index 99% rename from tests/core/variant/test_array.h rename to tests/core/variant/test_array.cpp index 62e1b3962c..1187cae6a2 100644 --- a/tests/core/variant/test_array.h +++ b/tests/core/variant/test_array.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_array.h */ +/* test_array.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_array) #include "core/variant/array.h" -#include "tests/test_macros.h" #include "tests/test_tools.h" namespace TestArray { + TEST_CASE("[Array] initializer list") { Array arr = { 0, 1, "test", true, { 0.0, 1.0 } }; CHECK(arr.size() == 5); diff --git a/tests/core/variant/test_callable.h b/tests/core/variant/test_callable.cpp similarity index 98% rename from tests/core/variant/test_callable.h rename to tests/core/variant/test_callable.cpp index a046be3b3e..fca557b25c 100644 --- a/tests/core/variant/test_callable.h +++ b/tests/core/variant/test_callable.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_callable.h */ +/* test_callable.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_callable) #include "core/object/class_db.h" #include "core/object/object.h" -#include "tests/test_macros.h" - namespace TestCallable { class TestClass : public Object { diff --git a/tests/core/variant/test_dictionary.h b/tests/core/variant/test_dictionary.cpp similarity index 99% rename from tests/core/variant/test_dictionary.h rename to tests/core/variant/test_dictionary.cpp index 7f5a5995ef..4c620fb0e0 100644 --- a/tests/core/variant/test_dictionary.h +++ b/tests/core/variant/test_dictionary.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_dictionary.h */ +/* test_dictionary.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "core/variant/typed_dictionary.h" #include "tests/test_macros.h" +TEST_FORCE_LINK(test_dictionary) + +#include "core/variant/typed_dictionary.h" + namespace TestDictionary { + TEST_CASE("[Dictionary] Assignment using bracket notation ([])") { Dictionary map; map["Hello"] = 0; diff --git a/tests/core/variant/test_variant.h b/tests/core/variant/test_variant.cpp similarity index 99% rename from tests/core/variant/test_variant.h rename to tests/core/variant/test_variant.cpp index aa1331b824..a442735c04 100644 --- a/tests/core/variant/test_variant.h +++ b/tests/core/variant/test_variant.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_variant.h */ +/* test_variant.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_variant) #include "core/variant/variant.h" #include "core/variant/variant_parser.h" -#include "tests/test_macros.h" - namespace TestVariant { + TEST_CASE("[Variant] Writer and parser integer") { int64_t a32 = 2147483648; // 2^31, so out of bounds for 32-bit signed int [-2^31, +2^31-1]. String a32_str; diff --git a/tests/core/variant/test_variant_utility.h b/tests/core/variant/test_variant_utility.cpp similarity index 98% rename from tests/core/variant/test_variant_utility.h rename to tests/core/variant/test_variant_utility.cpp index c184b6595a..4a48cd5519 100644 --- a/tests/core/variant/test_variant_utility.h +++ b/tests/core/variant/test_variant_utility.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_variant_utility.h */ +/* test_variant_utility.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_variant_utility) #include "core/variant/variant_utility.h" -#include "tests/test_macros.h" - namespace TestVariantUtility { TEST_CASE("[VariantUtility] Type conversion") { diff --git a/tests/scene/test_animation.h b/tests/scene/test_animation.cpp similarity index 99% rename from tests/scene/test_animation.h rename to tests/scene/test_animation.cpp index 1fae6edb33..78a9fe527d 100644 --- a/tests/scene/test_animation.h +++ b/tests/scene/test_animation.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_animation.h */ +/* test_animation.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_animation) #include "scene/resources/animation.h" -#include "tests/test_macros.h" - namespace TestAnimation { TEST_CASE("[Animation] Empty animation getters") { diff --git a/tests/scene/test_animation_blend_tree.h b/tests/scene/test_animation_blend_tree.cpp similarity index 96% rename from tests/scene/test_animation_blend_tree.h rename to tests/scene/test_animation_blend_tree.cpp index 3d0727d665..f168751d5b 100644 --- a/tests/scene/test_animation_blend_tree.h +++ b/tests/scene/test_animation_blend_tree.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_animation_blend_tree.h */ +/* test_animation_blend_tree.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_animation_blend_tree) #include "scene/animation/animation_blend_tree.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestAnimationBlendTree { + TEST_CASE("[SceneTree][AnimationBlendTree] Create AnimationBlendTree and add AnimationNode") { Ref blend_tree; blend_tree.instantiate(); @@ -81,4 +82,4 @@ TEST_CASE("[SceneTree][AnimationBlendTree] Create AnimationBlendTree and add Ani CHECK_EQ(connections[0], StringName()); } -} //namespace TestAnimationBlendTree +} // namespace TestAnimationBlendTree diff --git a/tests/scene/test_animation_player.h b/tests/scene/test_animation_player.cpp similarity index 96% rename from tests/scene/test_animation_player.h rename to tests/scene/test_animation_player.cpp index f1589a207c..597d72bbc1 100644 --- a/tests/scene/test_animation_player.h +++ b/tests/scene/test_animation_player.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_animation_player.h */ +/* test_animation_player.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_animation_player) #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" -#include "tests/test_macros.h" namespace TestAnimationPlayer { diff --git a/tests/scene/test_arraymesh.h b/tests/scene/test_arraymesh.cpp similarity index 99% rename from tests/scene/test_arraymesh.h rename to tests/scene/test_arraymesh.cpp index 73cd29a64b..1fe5728af3 100644 --- a/tests/scene/test_arraymesh.h +++ b/tests/scene/test_arraymesh.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_arraymesh.h */ +/* test_arraymesh.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_arraymesh) + +#ifndef _3D_DISABLED #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/mesh.h" -#include "tests/test_macros.h" - namespace TestArrayMesh { TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") { @@ -444,3 +446,5 @@ TEST_CASE("[SceneTree][ArrayMesh] Get/Set mesh metadata and actions") { } } // namespace TestArrayMesh + +#endif // _3D_DISABLED diff --git a/tests/scene/test_audio_stream_wav.h b/tests/scene/test_audio_stream_wav.cpp similarity index 97% rename from tests/scene/test_audio_stream_wav.h rename to tests/scene/test_audio_stream_wav.cpp index 58d24f5184..287082e99b 100644 --- a/tests/scene/test_audio_stream_wav.h +++ b/tests/scene/test_audio_stream_wav.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_audio_stream_wav.h */ +/* test_audio_stream_wav.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" +TEST_FORCE_LINK(test_audio_stream_wav) + +#include "core/io/file_access.h" +#include "core/io/marshalls.h" #include "core/math/math_defs.h" #include "core/math/math_funcs.h" #include "scene/resources/audio_stream_wav.h" - -#include "tests/test_macros.h" +#include "tests/test_utils.h" namespace TestAudioStreamWAV { diff --git a/tests/scene/test_bit_map.h b/tests/scene/test_bit_map.cpp similarity index 99% rename from tests/scene/test_bit_map.h rename to tests/scene/test_bit_map.cpp index 8c1e01956a..5c57fc2ceb 100644 --- a/tests/scene/test_bit_map.h +++ b/tests/scene/test_bit_map.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_bit_map.h */ +/* test_bit_map.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_bit_map) #include "core/os/memory.h" #include "scene/resources/bit_map.h" -#include "tests/test_macros.h" -namespace TestBitmap { +namespace TestBitMap { void reset_bit_map(BitMap &p_bm) { Size2i size = p_bm.get_size(); @@ -499,4 +500,4 @@ TEST_CASE("[BitMap] Clip to polygon") { CHECK_MESSAGE(polygons[0].size() == 6, "The polygon should have exactly 6 points"); } -} // namespace TestBitmap +} // namespace TestBitMap diff --git a/tests/scene/test_button.h b/tests/scene/test_button.cpp similarity index 96% rename from tests/scene/test_button.h rename to tests/scene/test_button.cpp index adb466f91f..f1b33675cd 100644 --- a/tests/scene/test_button.h +++ b/tests/scene/test_button.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_button.h */ +/* test_button.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_button) #include "scene/gui/button.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestButton { + TEST_CASE("[SceneTree][Button] is_hovered()") { // Create new button instance. Button *button = memnew(Button); @@ -61,4 +62,4 @@ TEST_CASE("[SceneTree][Button] is_hovered()") { memdelete(button); } -} //namespace TestButton +} // namespace TestButton diff --git a/tests/scene/test_camera_2d.h b/tests/scene/test_camera_2d.cpp similarity index 99% rename from tests/scene/test_camera_2d.h rename to tests/scene/test_camera_2d.cpp index 73f1aff0d3..063790f43e 100644 --- a/tests/scene/test_camera_2d.h +++ b/tests/scene/test_camera_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_camera_2d.h */ +/* test_camera_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_camera_2d) #include "scene/2d/camera_2d.h" #include "scene/main/viewport.h" #include "scene/main/window.h" -#include "tests/test_macros.h" namespace TestCamera2D { diff --git a/tests/scene/test_camera_3d.h b/tests/scene/test_camera_3d.cpp similarity index 98% rename from tests/scene/test_camera_3d.h rename to tests/scene/test_camera_3d.cpp index f4173a1277..878281111f 100644 --- a/tests/scene/test_camera_3d.h +++ b/tests/scene/test_camera_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_camera_3d.h */ +/* test_camera_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_camera_3d) + +#ifndef _3D_DISABLED #include "scene/3d/camera_3d.h" #include "scene/main/viewport.h" #include "scene/main/window.h" -#include "tests/test_macros.h" +namespace TestCamera3D { TEST_CASE("[SceneTree][Camera3D] Getters and setters") { Camera3D *test_camera = memnew(Camera3D); @@ -366,3 +370,7 @@ TEST_CASE("[SceneTree][Camera3D] Project ray") { memdelete(test_camera); memdelete(mock_viewport); } + +} // namespace TestCamera3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.cpp similarity index 99% rename from tests/scene/test_code_edit.h rename to tests/scene/test_code_edit.cpp index 62c9552a56..fe0a4c033f 100644 --- a/tests/scene/test_code_edit.h +++ b/tests/scene/test_code_edit.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_code_edit.h */ +/* test_code_edit.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_code_edit) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/code_edit.h" -#include "tests/test_macros.h" - namespace TestCodeEdit { + TEST_CASE("[SceneTree][CodeEdit] line gutters") { CodeEdit *code_edit = memnew(CodeEdit); SceneTree::get_singleton()->get_root()->add_child(code_edit); @@ -5708,3 +5711,5 @@ func _ready(): } } // namespace TestCodeEdit + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_color_picker.h b/tests/scene/test_color_picker.cpp similarity index 95% rename from tests/scene/test_color_picker.h rename to tests/scene/test_color_picker.cpp index ba0345142f..46f73ea11d 100644 --- a/tests/scene/test_color_picker.h +++ b/tests/scene/test_color_picker.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_color_picker.h */ +/* test_color_picker.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_color_picker) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/color_picker.h" -#include "tests/test_macros.h" - namespace TestColorPicker { TEST_CASE("[SceneTree][ColorPicker]") { @@ -56,3 +58,5 @@ TEST_CASE("[SceneTree][ColorPicker]") { } } // namespace TestColorPicker + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_control.h b/tests/scene/test_control.cpp similarity index 99% rename from tests/scene/test_control.h rename to tests/scene/test_control.cpp index e42c9c3a5d..00ec1a3424 100644 --- a/tests/scene/test_control.h +++ b/tests/scene/test_control.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_control.h */ +/* test_control.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_control) #include "scene/2d/node_2d.h" #include "scene/gui/control.h" - -#include "tests/test_macros.h" +#include "scene/main/window.h" namespace TestControl { diff --git a/tests/scene/test_convert_transform_modifier_3d.h b/tests/scene/test_convert_transform_modifier_3d.cpp similarity index 98% rename from tests/scene/test_convert_transform_modifier_3d.h rename to tests/scene/test_convert_transform_modifier_3d.cpp index 302b428dbc..554b9d4624 100644 --- a/tests/scene/test_convert_transform_modifier_3d.h +++ b/tests/scene/test_convert_transform_modifier_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_convert_transform_modifier_3d.h */ +/* test_convert_transform_modifier_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - #include "tests/test_macros.h" +TEST_FORCE_LINK(test_convert_transform_modifier_3d) + +#ifndef _3D_DISABLED + +#include "core/math/random_number_generator.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/convert_transform_modifier_3d.h" +#include "scene/main/window.h" namespace TestConvertTransformModifier3D { @@ -255,4 +259,7 @@ TEST_CASE("[SceneTree][ConvertTransformModifier3D]") { memdelete(mod); memdelete(skeleton); } + } // namespace TestConvertTransformModifier3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_copy_transform_modifier_3d.h b/tests/scene/test_copy_transform_modifier_3d.cpp similarity index 99% rename from tests/scene/test_copy_transform_modifier_3d.h rename to tests/scene/test_copy_transform_modifier_3d.cpp index 093cefa4d1..4fb70ce2f2 100644 --- a/tests/scene/test_copy_transform_modifier_3d.h +++ b/tests/scene/test_copy_transform_modifier_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_copy_transform_modifier_3d.h */ +/* test_copy_transform_modifier_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - #include "tests/test_macros.h" +TEST_FORCE_LINK(test_copy_transform_modifier_3d) + +#ifndef _3D_DISABLED + +#include "core/math/random_number_generator.h" #include "scene/3d/bone_attachment_3d.h" #include "scene/3d/copy_transform_modifier_3d.h" +#include "scene/main/window.h" namespace TestCopyTransformModifier3D { @@ -526,4 +530,7 @@ TEST_CASE("[SceneTree][CopyTransformModifier3D]") { memdelete(mod); memdelete(skeleton); } + } // namespace TestCopyTransformModifier3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.cpp similarity index 99% rename from tests/scene/test_curve.h rename to tests/scene/test_curve.cpp index 8f2aacc897..48f24e2212 100644 --- a/tests/scene/test_curve.h +++ b/tests/scene/test_curve.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_curve.h */ +/* test_curve.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_curve) #include "core/math/math_funcs.h" #include "scene/resources/curve.h" -#include "tests/test_macros.h" - namespace TestCurve { TEST_CASE("[Curve] Default curve") { diff --git a/tests/scene/test_curve_2d.h b/tests/scene/test_curve_2d.cpp similarity index 99% rename from tests/scene/test_curve_2d.h rename to tests/scene/test_curve_2d.cpp index 9b070bb7bb..3c1f546db3 100644 --- a/tests/scene/test_curve_2d.h +++ b/tests/scene/test_curve_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_curve_2d.h */ +/* test_curve_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_curve_2d) #include "core/math/math_funcs.h" #include "scene/resources/curve.h" -#include "tests/test_macros.h" - namespace TestCurve2D { void add_sample_curve_points(Ref &curve) { diff --git a/tests/scene/test_curve_3d.h b/tests/scene/test_curve_3d.cpp similarity index 99% rename from tests/scene/test_curve_3d.h rename to tests/scene/test_curve_3d.cpp index 9722121980..25d499179a 100644 --- a/tests/scene/test_curve_3d.h +++ b/tests/scene/test_curve_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_curve_3d.h */ +/* test_curve_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_curve_3d) #include "core/math/math_funcs.h" #include "scene/resources/curve.h" -#include "tests/test_macros.h" - namespace TestCurve3D { void add_sample_curve_points(Ref &curve) { diff --git a/tests/scene/test_decal.h b/tests/scene/test_decal.cpp similarity index 97% rename from tests/scene/test_decal.h rename to tests/scene/test_decal.cpp index 951b9b15fd..7dc529713e 100644 --- a/tests/scene/test_decal.h +++ b/tests/scene/test_decal.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_decal.h */ +/* test_decal.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_decal) + +#ifndef _3D_DISABLED #include "scene/3d/decal.h" -#include "tests/test_macros.h" - namespace TestDecal { + TEST_CASE("[SceneTree][Decal] Getters/Setters") { Decal *decal = memnew(Decal); AABB default_aabb{ @@ -130,4 +133,6 @@ TEST_CASE("[SceneTree][Decal] Getters/Setters") { memdelete(decal); } -} //namespace TestDecal +} // namespace TestDecal + +#endif // _3D_DISABLED diff --git a/tests/scene/test_fontfile.h b/tests/scene/test_fontfile.cpp similarity index 97% rename from tests/scene/test_fontfile.h rename to tests/scene/test_fontfile.cpp index 8571831b90..843f97d61c 100644 --- a/tests/scene/test_fontfile.h +++ b/tests/scene/test_fontfile.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_fontfile.h */ +/* test_fontfile.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "modules/modules_enabled.gen.h" - -#include "scene/resources/font.h" #include "tests/test_macros.h" -namespace TestFontfile { +TEST_FORCE_LINK(test_fontfile) + +#include "modules/modules_enabled.gen.h" // For freetype. +#include "scene/resources/font.h" + +namespace TestFontFile { TEST_CASE("[FontFile] Load Dynamic Font - getters") { #ifdef MODULE_FREETYPE_ENABLED @@ -124,4 +124,4 @@ TEST_CASE("[FontFile] Create font file and check data") { #endif } -} // namespace TestFontfile +} // namespace TestFontFile diff --git a/tests/scene/test_gltf_document.h b/tests/scene/test_gltf_document.cpp similarity index 96% rename from tests/scene/test_gltf_document.h rename to tests/scene/test_gltf_document.cpp index dfaf0759ed..13fe773d67 100644 --- a/tests/scene/test_gltf_document.h +++ b/tests/scene/test_gltf_document.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_gltf_document.h */ +/* test_gltf_document.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_gltf_document) + +#ifndef _3D_DISABLED + +#include "modules/modules_enabled.gen.h" // For gltf. + +#ifdef MODULE_GLTF_ENABLED #include "modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h" #include "modules/gltf/gltf_document.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestGLTFDocument { @@ -245,3 +251,7 @@ TEST_CASE("[SceneTree][GLTFDocument] Load suzanne.glb") { } } // namespace TestGLTFDocument + +#endif // MODULE_GLTF_ENABLED + +#endif // _3D_DISABLED diff --git a/tests/scene/test_gradient.h b/tests/scene/test_gradient.cpp similarity index 98% rename from tests/scene/test_gradient.h rename to tests/scene/test_gradient.cpp index e8a6979240..8f721dc8a3 100644 --- a/tests/scene/test_gradient.h +++ b/tests/scene/test_gradient.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_gradient.h */ +/* test_gradient.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_gradient) #include "scene/resources/gradient.h" -#include "thirdparty/doctest/doctest.h" - namespace TestGradient { TEST_CASE("[Gradient] Default gradient") { @@ -141,4 +141,5 @@ TEST_CASE("[Gradient] Custom gradient (points specified out-of-order)") { gradient->get_color_at_offset(0.1).is_equal_approx(Color(1, 0, 0)), "Custom out-of-order gradient should return the expected interpolated value at offset 0.1 after removing point at index 0."); } + } // namespace TestGradient diff --git a/tests/scene/test_gradient_texture.h b/tests/scene/test_gradient_texture.cpp similarity index 96% rename from tests/scene/test_gradient_texture.h rename to tests/scene/test_gradient_texture.cpp index c6e5246616..029cfebf9b 100644 --- a/tests/scene/test_gradient_texture.h +++ b/tests/scene/test_gradient_texture.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_gradient_texture.h */ +/* test_gradient_texture.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_gradient_texture) #include "scene/resources/gradient_texture.h" -#include "tests/test_macros.h" - namespace TestGradientTexture { // [SceneTree] in a test case name enables initializing a mock render server, @@ -81,4 +81,4 @@ TEST_CASE("[SceneTree][GradientTexture2D] Create GradientTexture2D") { CHECK(gradient_texture->get_repeat() == GradientTexture2D::Repeat::REPEAT); } -} //namespace TestGradientTexture +} // namespace TestGradientTexture diff --git a/tests/scene/test_graph_node.h b/tests/scene/test_graph_node.cpp similarity index 94% rename from tests/scene/test_graph_node.h rename to tests/scene/test_graph_node.cpp index ca507bb2fa..eef3094033 100644 --- a/tests/scene/test_graph_node.h +++ b/tests/scene/test_graph_node.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_graph_node.h */ +/* test_graph_node.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_graph_node) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/graph_node.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestGraphNode { TEST_CASE("[GraphNode][SceneTree]") { @@ -56,3 +58,5 @@ TEST_CASE("[GraphNode][SceneTree]") { } } // namespace TestGraphNode + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_height_map_shape_3d.h b/tests/scene/test_height_map_shape_3d.cpp similarity index 96% rename from tests/scene/test_height_map_shape_3d.h rename to tests/scene/test_height_map_shape_3d.cpp index 92a63789ea..016aa7b5d0 100644 --- a/tests/scene/test_height_map_shape_3d.h +++ b/tests/scene/test_height_map_shape_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_height_map_shape_3d.h */ +/* test_height_map_shape_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_height_map_shape_3d) + +#ifndef PHYSICS_3D_DISABLED #include "scene/resources/3d/height_map_shape_3d.h" #include "scene/resources/image_texture.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestHeightMapShape3D { @@ -117,3 +119,5 @@ TEST_CASE("[SceneTree][HeightMapShape3D] update_map_data_from_image") { } } // namespace TestHeightMapShape3D + +#endif // PHYSICS_3D_DISABLED diff --git a/tests/scene/test_image_texture.h b/tests/scene/test_image_texture.cpp similarity index 97% rename from tests/scene/test_image_texture.h rename to tests/scene/test_image_texture.cpp index c1c53b89a9..1ee7b59d03 100644 --- a/tests/scene/test_image_texture.h +++ b/tests/scene/test_image_texture.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_image_texture.h */ +/* test_image_texture.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_image_texture) #include "core/io/image.h" #include "scene/resources/image_texture.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestImageTexture { @@ -105,4 +105,4 @@ TEST_CASE("[SceneTree][ImageTexture] set_path") { CHECK(image_texture->get_path() == path); } -} //namespace TestImageTexture +} // namespace TestImageTexture diff --git a/tests/scene/test_image_texture_3d.h b/tests/scene/test_image_texture_3d.cpp similarity index 97% rename from tests/scene/test_image_texture_3d.h rename to tests/scene/test_image_texture_3d.cpp index 2ec77dee8a..b80e8823ab 100644 --- a/tests/scene/test_image_texture_3d.h +++ b/tests/scene/test_image_texture_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_image_texture_3d.h */ +/* test_image_texture_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_image_texture_3d) #include "core/io/image.h" #include "scene/resources/image_texture.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestImageTexture3D { @@ -95,4 +95,4 @@ TEST_CASE("[SceneTree][ImageTexture3D] set_path") { CHECK(image_texture_3d->get_path() == path); } -} //namespace TestImageTexture3D +} // namespace TestImageTexture3D diff --git a/tests/scene/test_instance_placeholder.h b/tests/scene/test_instance_placeholder.cpp similarity index 98% rename from tests/scene/test_instance_placeholder.h rename to tests/scene/test_instance_placeholder.cpp index 2c06093b37..c10f96b0fb 100644 --- a/tests/scene/test_instance_placeholder.h +++ b/tests/scene/test_instance_placeholder.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_instance_placeholder.h */ +/* test_instance_placeholder.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,20 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "scene/main/instance_placeholder.h" -#include "scene/resources/packed_scene.h" - #include "tests/test_macros.h" +TEST_FORCE_LINK(test_instance_placeholder) + +#include "core/io/dir_access.h" +#include "core/io/resource_loader.h" +#include "core/io/resource_saver.h" +#include "scene/main/instance_placeholder.h" +#include "scene/main/window.h" +#include "scene/resources/packed_scene.h" +#include "tests/test_utils.h" + +namespace TestInstancePlaceholder { + class _TestInstancePlaceholderNode : public Node { GDCLASS(_TestInstancePlaceholderNode, Node); @@ -93,8 +100,6 @@ public: } }; -namespace TestInstancePlaceholder { - TEST_CASE("[SceneTree][InstancePlaceholder] Instantiate from placeholder with no overrides") { GDREGISTER_CLASS(_TestInstancePlaceholderNode); @@ -527,6 +532,7 @@ TEST_CASE("[SceneTree][InstancePlaceholder] Instance a PackedScene containing an DirAccess::remove_file_or_error(internal_path); DirAccess::remove_file_or_error(main_path); } + #endif // TOOLS_ENABLED -} //namespace TestInstancePlaceholder +} // namespace TestInstancePlaceholder diff --git a/tests/scene/test_navigation_agent_2d.h b/tests/scene/test_navigation_agent_2d.cpp similarity index 92% rename from tests/scene/test_navigation_agent_2d.h rename to tests/scene/test_navigation_agent_2d.cpp index 929e812756..b429813dd1 100644 --- a/tests/scene/test_navigation_agent_2d.h +++ b/tests/scene/test_navigation_agent_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_agent_2d.h */ +/* test_navigation_agent_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_agent_2d) + +#include "modules/modules_enabled.gen.h" // For navigation 2D. + +#ifdef MODULE_NAVIGATION_2D_ENABLED #include "scene/2d/navigation/navigation_agent_2d.h" #include "scene/2d/node_2d.h" #include "scene/main/window.h" #include "scene/resources/world_2d.h" -#include "tests/test_macros.h" - namespace TestNavigationAgent2D { TEST_SUITE("[Navigation2D]") { @@ -66,4 +70,6 @@ TEST_SUITE("[Navigation2D]") { } } -} //namespace TestNavigationAgent2D +} // namespace TestNavigationAgent2D + +#endif // MODULE_NAVIGATION_2D_ENABLED diff --git a/tests/scene/test_navigation_agent_3d.h b/tests/scene/test_navigation_agent_3d.cpp similarity index 92% rename from tests/scene/test_navigation_agent_3d.h rename to tests/scene/test_navigation_agent_3d.cpp index 649bf61250..1ca8dfbf68 100644 --- a/tests/scene/test_navigation_agent_3d.h +++ b/tests/scene/test_navigation_agent_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_agent_3d.h */ +/* test_navigation_agent_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_agent_3d) + +#include "modules/modules_enabled.gen.h" // For navigation 3D. + +#ifdef MODULE_NAVIGATION_3D_ENABLED #include "scene/3d/navigation/navigation_agent_3d.h" #include "scene/3d/node_3d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestNavigationAgent3D { TEST_SUITE("[Navigation3D]") { @@ -65,4 +69,6 @@ TEST_SUITE("[Navigation3D]") { } } -} //namespace TestNavigationAgent3D +} // namespace TestNavigationAgent3D + +#endif // MODULE_NAVIGATION_3D_ENABLED diff --git a/tests/scene/test_navigation_obstacle_2d.h b/tests/scene/test_navigation_obstacle_2d.cpp similarity index 91% rename from tests/scene/test_navigation_obstacle_2d.h rename to tests/scene/test_navigation_obstacle_2d.cpp index 8c17a696bf..a0071c0302 100644 --- a/tests/scene/test_navigation_obstacle_2d.h +++ b/tests/scene/test_navigation_obstacle_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_obstacle_2d.h */ +/* test_navigation_obstacle_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_obstacle_2d) + +#include "modules/modules_enabled.gen.h" // For navigation 2D. + +#ifdef MODULE_NAVIGATION_2D_ENABLED #include "scene/2d/navigation/navigation_obstacle_2d.h" #include "scene/main/window.h" - -#include "tests/test_macros.h" +#include "scene/resources/world_2d.h" namespace TestNavigationObstacle2D { @@ -63,4 +68,6 @@ TEST_SUITE("[Navigation2D]") { } } -} //namespace TestNavigationObstacle2D +} // namespace TestNavigationObstacle2D + +#endif // MODULE_NAVIGATION_2D_ENABLED diff --git a/tests/scene/test_navigation_obstacle_3d.h b/tests/scene/test_navigation_obstacle_3d.cpp similarity index 91% rename from tests/scene/test_navigation_obstacle_3d.h rename to tests/scene/test_navigation_obstacle_3d.cpp index c2d9c1ce99..6481709be3 100644 --- a/tests/scene/test_navigation_obstacle_3d.h +++ b/tests/scene/test_navigation_obstacle_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_obstacle_3d.h */ +/* test_navigation_obstacle_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_obstacle_3d) + +#include "modules/modules_enabled.gen.h" // For navigation 3D. + +#ifdef MODULE_NAVIGATION_3D_ENABLED #include "scene/3d/navigation/navigation_obstacle_3d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestNavigationObstacle3D { TEST_SUITE("[Navigation3D]") { @@ -63,4 +67,6 @@ TEST_SUITE("[Navigation3D]") { } } -} //namespace TestNavigationObstacle3D +} // namespace TestNavigationObstacle3D + +#endif // MODULE_NAVIGATION_3D_ENABLED diff --git a/tests/scene/test_navigation_region_2d.h b/tests/scene/test_navigation_region_2d.cpp similarity index 90% rename from tests/scene/test_navigation_region_2d.h rename to tests/scene/test_navigation_region_2d.cpp index 8a76215a20..5a90089974 100644 --- a/tests/scene/test_navigation_region_2d.h +++ b/tests/scene/test_navigation_region_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_region_2d.h */ +/* test_navigation_region_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_region_2d) + +#include "modules/modules_enabled.gen.h" // For navigation 2D. + +#ifdef MODULE_NAVIGATION_2D_ENABLED #include "scene/2d/navigation/navigation_region_2d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestNavigationRegion2D { TEST_SUITE("[Navigation2D]") { @@ -45,4 +49,6 @@ TEST_SUITE("[Navigation2D]") { } } -} //namespace TestNavigationRegion2D +} // namespace TestNavigationRegion2D + +#endif // MODULE_NAVIGATION_2D_ENABLED diff --git a/tests/scene/test_navigation_region_3d.h b/tests/scene/test_navigation_region_3d.cpp similarity index 93% rename from tests/scene/test_navigation_region_3d.h rename to tests/scene/test_navigation_region_3d.cpp index 1a5777c5d2..3d63c5b6e4 100644 --- a/tests/scene/test_navigation_region_3d.h +++ b/tests/scene/test_navigation_region_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_region_3d.h */ +/* test_navigation_region_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_region_3d) + +#include "modules/modules_enabled.gen.h" // For navigation 3D. + +#ifdef MODULE_NAVIGATION_3D_ENABLED #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/navigation/navigation_region_3d.h" #include "scene/main/window.h" #include "scene/resources/3d/primitive_meshes.h" -#include "tests/test_macros.h" - namespace TestNavigationRegion3D { TEST_SUITE("[Navigation3D]") { @@ -78,4 +82,6 @@ TEST_SUITE("[Navigation3D]") { } } -} //namespace TestNavigationRegion3D +} // namespace TestNavigationRegion3D + +#endif // MODULE_NAVIGATION_3D_ENABLED diff --git a/tests/scene/test_node.h b/tests/scene/test_node.cpp similarity index 99% rename from tests/scene/test_node.h rename to tests/scene/test_node.cpp index 500d34fda3..115a01b2d5 100644 --- a/tests/scene/test_node.h +++ b/tests/scene/test_node.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_node.h */ +/* test_node.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" +TEST_FORCE_LINK(test_node) + +#include "core/io/file_access.h" +#include "core/io/resource_saver.h" #include "core/object/class_db.h" #include "scene/main/node.h" +#include "scene/main/window.h" #include "scene/resources/packed_scene.h" - -#include "tests/test_macros.h" +#include "tests/test_utils.h" namespace TestNode { diff --git a/tests/scene/test_node_2d.h b/tests/scene/test_node_2d.cpp similarity index 98% rename from tests/scene/test_node_2d.h rename to tests/scene/test_node_2d.cpp index 21f9ea13f3..19d2d4471a 100644 --- a/tests/scene/test_node_2d.h +++ b/tests/scene/test_node_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_node_2d.h */ +/* test_node_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_node_2d) #include "scene/2d/node_2d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestNode2D { TEST_CASE("[SceneTree][Node2D]") { diff --git a/tests/scene/test_option_button.h b/tests/scene/test_option_button.cpp similarity index 97% rename from tests/scene/test_option_button.h rename to tests/scene/test_option_button.cpp index 59966b7d5e..8e8fcf907f 100644 --- a/tests/scene/test_option_button.h +++ b/tests/scene/test_option_button.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_option_button.h */ +/* test_option_button.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_option_button) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/option_button.h" -#include "tests/test_macros.h" - namespace TestOptionButton { TEST_CASE("[SceneTree][OptionButton] Initialization") { @@ -156,3 +158,5 @@ TEST_CASE("[SceneTree][OptionButton] Many items") { } } // namespace TestOptionButton + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_packed_scene.h b/tests/scene/test_packed_scene.cpp similarity index 98% rename from tests/scene/test_packed_scene.h rename to tests/scene/test_packed_scene.cpp index b3cea7b72a..1489ee2aef 100644 --- a/tests/scene/test_packed_scene.h +++ b/tests/scene/test_packed_scene.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_packed_scene.h */ +/* test_packed_scene.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_packed_scene) #include "scene/resources/packed_scene.h" -#include "tests/test_macros.h" - namespace TestPackedScene { TEST_CASE("[PackedScene] Pack Scene and Retrieve State") { diff --git a/tests/scene/test_parallax_2d.h b/tests/scene/test_parallax_2d.cpp similarity index 98% rename from tests/scene/test_parallax_2d.h rename to tests/scene/test_parallax_2d.cpp index 0396db4cd3..f2e4b4d88a 100644 --- a/tests/scene/test_parallax_2d.h +++ b/tests/scene/test_parallax_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_parallax_2d.h */ +/* test_parallax_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "scene/2d/parallax_2d.h" #include "tests/test_macros.h" -namespace TestParallax2D { +TEST_FORCE_LINK(test_parallax_2d) + +#include "scene/2d/parallax_2d.h" // Test cases for the Parallax2D class to ensure its properties are set and retrieved correctly. +namespace TestParallax2D { + TEST_CASE("[SceneTree][Parallax2D] Scroll Scale") { // Test setting and getting the scroll scale. Parallax2D *parallax = memnew(Parallax2D); diff --git a/tests/scene/test_path_2d.h b/tests/scene/test_path_2d.cpp similarity index 97% rename from tests/scene/test_path_2d.h rename to tests/scene/test_path_2d.cpp index 0095d44a6d..3cc6d8f995 100644 --- a/tests/scene/test_path_2d.h +++ b/tests/scene/test_path_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_path_2d.h */ +/* test_path_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_path_2d) #include "scene/2d/path_2d.h" -#include "tests/test_macros.h" - namespace TestPath2D { TEST_CASE("[SceneTree][Path2D] Initialization") { diff --git a/tests/scene/test_path_3d.h b/tests/scene/test_path_3d.cpp similarity index 96% rename from tests/scene/test_path_3d.h rename to tests/scene/test_path_3d.cpp index 835a2ca416..d7fda0fc03 100644 --- a/tests/scene/test_path_3d.h +++ b/tests/scene/test_path_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_path_3d.h */ +/* test_path_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_path_3d) + +#ifndef _3D_DISABLED #include "scene/3d/path_3d.h" -#include "tests/test_macros.h" - namespace TestPath3D { TEST_CASE("[Path3D] Initialization") { @@ -79,3 +81,5 @@ TEST_CASE("[Path3D] Curve setter and getter") { } } // namespace TestPath3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_path_follow_2d.h b/tests/scene/test_path_follow_2d.cpp similarity index 98% rename from tests/scene/test_path_follow_2d.h rename to tests/scene/test_path_follow_2d.cpp index 56cc24a44c..d74a3e6f02 100644 --- a/tests/scene/test_path_follow_2d.h +++ b/tests/scene/test_path_follow_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_path_follow_2d.h */ +/* test_path_follow_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_path_follow_2d) #include "scene/2d/path_2d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestPathFollow2D { bool is_equal_approx(const Vector2 &p_a, const Vector2 &p_b) { @@ -252,4 +252,5 @@ TEST_CASE("[SceneTree][PathFollow2D] Progress out of range") { memdelete(path); } + } // namespace TestPathFollow2D diff --git a/tests/scene/test_path_follow_3d.h b/tests/scene/test_path_follow_3d.cpp similarity index 98% rename from tests/scene/test_path_follow_3d.h rename to tests/scene/test_path_follow_3d.cpp index 8c39f9367b..2001f0f816 100644 --- a/tests/scene/test_path_follow_3d.h +++ b/tests/scene/test_path_follow_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_path_follow_3d.h */ +/* test_path_follow_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_path_follow_3d) + +#ifndef _3D_DISABLED #include "scene/3d/path_3d.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestPathFollow3D { bool is_equal_approx(const Vector3 &p_a, const Vector3 &p_b) { @@ -338,3 +340,5 @@ TEST_CASE("[SceneTree][PathFollow3D] Calculate forward vector with degenerate cu } } // namespace TestPathFollow3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_physics_material.h b/tests/scene/test_physics_material.cpp similarity index 94% rename from tests/scene/test_physics_material.h rename to tests/scene/test_physics_material.cpp index a7a1a5c95b..a56fde819a 100644 --- a/tests/scene/test_physics_material.h +++ b/tests/scene/test_physics_material.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_physics_material.h */ +/* test_physics_material.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - -#include "scene/resources/physics_material.h" #include "tests/test_macros.h" -namespace TestPhysics_material { +TEST_FORCE_LINK(test_physics_material) + +#ifndef PHYSICS_3D_DISABLED + +#include "scene/resources/physics_material.h" + +namespace TestPhysicsMaterial { TEST_CASE("[Physics_material] Defaults") { Ref physics_material; @@ -101,4 +104,6 @@ TEST_CASE("[Physics_material] Absorbent") { CHECK(physics_material->computed_bounce() == bounce); } -} // namespace TestPhysics_material +} // namespace TestPhysicsMaterial + +#endif // PHYSICS_3D_DISABLED diff --git a/tests/scene/test_primitives.h b/tests/scene/test_primitives.cpp similarity index 99% rename from tests/scene/test_primitives.h rename to tests/scene/test_primitives.cpp index ecc4931764..7e1376d67b 100644 --- a/tests/scene/test_primitives.h +++ b/tests/scene/test_primitives.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_primitives.h */ +/* test_primitives.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_primitives) + +#ifndef _3D_DISABLED #include "scene/resources/3d/primitive_meshes.h" -#include "tests/test_macros.h" - namespace TestPrimitives { TEST_CASE("[SceneTree][Primitive][Capsule] Capsule Primitive") { @@ -863,3 +865,5 @@ TEST_CASE("[SceneTree][Primitive][Text] Text Primitive") { } } // namespace TestPrimitives + +#endif // _3D_DISABLED diff --git a/tests/scene/test_skeleton_3d.h b/tests/scene/test_skeleton_3d.cpp similarity index 96% rename from tests/scene/test_skeleton_3d.h rename to tests/scene/test_skeleton_3d.cpp index 047a9ce82b..7f7c3660c6 100644 --- a/tests/scene/test_skeleton_3d.h +++ b/tests/scene/test_skeleton_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_skeleton_3d.h */ +/* test_skeleton_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once - #include "tests/test_macros.h" +TEST_FORCE_LINK(test_skeleton_3d) + +#ifndef _3D_DISABLED + #include "scene/3d/skeleton_3d.h" namespace TestSkeleton3D { @@ -72,4 +74,7 @@ TEST_CASE("[Skeleton3D] Test per-bone meta") { skeleton->set_bone_meta(0, "non-existing-key", Variant()); memdelete(skeleton); } + } // namespace TestSkeleton3D + +#endif // _3D_DISABLED diff --git a/tests/scene/test_sky.h b/tests/scene/test_sky.cpp similarity index 98% rename from tests/scene/test_sky.h rename to tests/scene/test_sky.cpp index b2965c839b..f7cb35c5ff 100644 --- a/tests/scene/test_sky.h +++ b/tests/scene/test_sky.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_sky.h */ +/* test_sky.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_sky) + +#ifndef _3D_DISABLED #include "scene/resources/sky.h" -#include "tests/test_macros.h" - namespace TestSky { TEST_CASE("[SceneTree][Sky] Constructor") { @@ -217,3 +219,5 @@ TEST_CASE("[SceneTree][Sky] RID generation") { } } // namespace TestSky + +#endif // _3D_DISABLED diff --git a/tests/scene/test_split_container.h b/tests/scene/test_split_container.cpp similarity index 99% rename from tests/scene/test_split_container.h rename to tests/scene/test_split_container.cpp index 6c2a5a0c0d..cd4b3195d8 100644 --- a/tests/scene/test_split_container.h +++ b/tests/scene/test_split_container.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_split_container.h */ +/* test_split_container.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_split_container) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/split_container.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestSplitContainer { #define CHECK_RECTS(m_rects, m_child_rects) \ @@ -2356,3 +2358,5 @@ TEST_CASE("[SceneTree][SplitContainer] More children") { } } // namespace TestSplitContainer + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_sprite_2d.h b/tests/scene/test_sprite_2d.cpp similarity index 98% rename from tests/scene/test_sprite_2d.h rename to tests/scene/test_sprite_2d.cpp index e821896339..89c097d27b 100644 --- a/tests/scene/test_sprite_2d.h +++ b/tests/scene/test_sprite_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_sprite_2d.h */ +/* test_sprite_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_sprite_2d) #include "scene/2d/sprite_2d.h" - -#include "tests/test_macros.h" #include "tests/test_utils.h" namespace TestSprite2D { diff --git a/tests/scene/test_sprite_frames.h b/tests/scene/test_sprite_frames.cpp similarity index 98% rename from tests/scene/test_sprite_frames.h rename to tests/scene/test_sprite_frames.cpp index db7a44eb0f..ccdeee4dc3 100644 --- a/tests/scene/test_sprite_frames.h +++ b/tests/scene/test_sprite_frames.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_sprite_frames.h */ +/* test_sprite_frames.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_sprite_frames) #include "scene/resources/sprite_frames.h" -#include "tests/test_macros.h" - namespace TestSpriteFrames { + const String test_animation_name = "GodotTest"; TEST_CASE("[SpriteFrames] Constructor methods") { @@ -242,4 +243,5 @@ TEST_CASE("[SpriteFrames] Frame addition, removal, and retrieval") { frames.get_frame_count(test_animation_name) == 0, "Clears frames."); } + } // namespace TestSpriteFrames diff --git a/tests/scene/test_style_box_texture.h b/tests/scene/test_style_box_texture.cpp similarity index 98% rename from tests/scene/test_style_box_texture.h rename to tests/scene/test_style_box_texture.cpp index 7dd0bcc4f0..d0946f80e8 100644 --- a/tests/scene/test_style_box_texture.h +++ b/tests/scene/test_style_box_texture.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_style_box_texture.h */ +/* test_style_box_texture.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_style_box_texture) #include "scene/resources/style_box_texture.h" -#include "tests/test_macros.h" - namespace TestStyleBoxTexture { TEST_CASE("[StyleBoxTexture] Constructor") { diff --git a/tests/scene/test_tab_bar.h b/tests/scene/test_tab_bar.cpp similarity index 99% rename from tests/scene/test_tab_bar.h rename to tests/scene/test_tab_bar.cpp index 058641ce30..85bf82834e 100644 --- a/tests/scene/test_tab_bar.h +++ b/tests/scene/test_tab_bar.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_tab_bar.h */ +/* test_tab_bar.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_tab_bar) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/tab_bar.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestTabBar { + TEST_CASE("[SceneTree][TabBar] tab operations") { TabBar *tab_bar = memnew(TabBar); SceneTree::get_singleton()->get_root()->add_child(tab_bar); @@ -1159,3 +1162,5 @@ TEST_CASE("[SceneTree][TabBar] Mouse interaction") { // FIXME: Add tests for keyboard navigation and other methods. } // namespace TestTabBar + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_tab_container.h b/tests/scene/test_tab_container.cpp similarity index 99% rename from tests/scene/test_tab_container.h rename to tests/scene/test_tab_container.cpp index ee1c4b646f..464d92db1a 100644 --- a/tests/scene/test_tab_container.h +++ b/tests/scene/test_tab_container.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_tab_container.h */ +/* test_tab_container.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_tab_container) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/box_container.h" #include "scene/gui/tab_container.h" - -#include "tests/test_macros.h" +#include "scene/main/window.h" namespace TestTabContainer { + TEST_CASE("[SceneTree][TabContainer] tab operations") { TabContainer *tab_container = memnew(TabContainer); SceneTree::get_singleton()->get_root()->add_child(tab_container); @@ -919,3 +923,5 @@ TEST_CASE("[SceneTree][TabContainer] Mouse interaction") { // FIXME: Add tests for keyboard navigation and other methods. } // namespace TestTabContainer + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.cpp similarity index 99% rename from tests/scene/test_text_edit.h rename to tests/scene/test_text_edit.cpp index 85ecceeaeb..87ead54569 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_text_edit.h */ +/* test_text_edit.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_text_edit) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/text_edit.h" -#include "tests/test_macros.h" - namespace TestTextEdit { + static inline Array reverse_nested(Array array) { Array reversed_array = array.duplicate(true); reversed_array.reverse(); @@ -8362,3 +8365,5 @@ TEST_CASE("[SceneTree][TextEdit] gutters") { } } // namespace TestTextEdit + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_texture_progress_bar.h b/tests/scene/test_texture_progress_bar.cpp similarity index 97% rename from tests/scene/test_texture_progress_bar.h rename to tests/scene/test_texture_progress_bar.cpp index 68ac88f38e..8b8a616d30 100644 --- a/tests/scene/test_texture_progress_bar.h +++ b/tests/scene/test_texture_progress_bar.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_texture_progress_bar.h */ +/* test_texture_progress_bar.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_texture_progress_bar) #include "scene/gui/texture_progress_bar.h" -#include "tests/test_macros.h" - namespace TestTextureProgressBar { TEST_CASE("[SceneTree][TextureProgressBar]") { diff --git a/tests/scene/test_theme.h b/tests/scene/test_theme.cpp similarity index 98% rename from tests/scene/test_theme.h rename to tests/scene/test_theme.cpp index 3296e54ee2..009ac1699d 100644 --- a/tests/scene/test_theme.h +++ b/tests/scene/test_theme.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_theme.h */ +/* test_theme.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_theme) #include "scene/resources/image_texture.h" #include "scene/resources/style_box_flat.h" #include "scene/resources/theme.h" #include "tests/test_tools.h" -#include "thirdparty/doctest/doctest.h" - namespace TestTheme { class Fixture { diff --git a/tests/scene/test_timer.h b/tests/scene/test_timer.cpp similarity index 98% rename from tests/scene/test_timer.h rename to tests/scene/test_timer.cpp index c47a1a2eff..b7a13ee1a9 100644 --- a/tests/scene/test_timer.h +++ b/tests/scene/test_timer.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_timer.h */ +/* test_timer.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_timer) #include "scene/main/timer.h" - -#include "tests/test_macros.h" +#include "scene/main/window.h" namespace TestTimer { diff --git a/tests/scene/test_tree.h b/tests/scene/test_tree.cpp similarity index 98% rename from tests/scene/test_tree.h rename to tests/scene/test_tree.cpp index 2db6e8f45a..3d550e64a5 100644 --- a/tests/scene/test_tree.h +++ b/tests/scene/test_tree.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_tree.h */ +/* test_tree.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_tree) + +#ifndef ADVANCED_GUI_DISABLED #include "scene/gui/tree.h" -#include "tests/test_macros.h" - namespace TestTree { TEST_CASE("[SceneTree][Tree]") { @@ -296,3 +298,5 @@ TEST_CASE("[SceneTree][Tree]") { } } // namespace TestTree + +#endif // ADVANCED_GUI_DISABLED diff --git a/tests/scene/test_viewport.h b/tests/scene/test_viewport.cpp similarity index 99% rename from tests/scene/test_viewport.h rename to tests/scene/test_viewport.cpp index 47905d1402..5c06914df3 100644 --- a/tests/scene/test_viewport.h +++ b/tests/scene/test_viewport.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_viewport.h */ +/* test_viewport.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_viewport) #include "scene/2d/node_2d.h" #include "scene/gui/control.h" @@ -43,8 +45,6 @@ #include "servers/physics_2d/physics_server_2d_dummy.h" #endif // PHYSICS_2D_DISABLED -#include "tests/test_macros.h" - namespace TestViewport { class NotificationControlViewport : public Control { diff --git a/tests/scene/test_visual_shader.h b/tests/scene/test_visual_shader.cpp similarity index 97% rename from tests/scene/test_visual_shader.h rename to tests/scene/test_visual_shader.cpp index 8ec171689d..98816e5ddc 100644 --- a/tests/scene/test_visual_shader.h +++ b/tests/scene/test_visual_shader.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_visual_shader.h */ +/* test_visual_shader.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_visual_shader) #include "scene/resources/visual_shader.h" -#include "tests/test_macros.h" - -namespace TestVisualArray { +namespace TestVisualShader { TEST_CASE("[SceneTree][VisualShader] Object creation and parameter") { Ref vs = memnew(VisualShader); @@ -145,4 +145,4 @@ TEST_CASE("[SceneTree][VisualShader] Testing Varyings") { ERR_PRINT_ON; } -} //namespace TestVisualArray +} // namespace TestVisualShader diff --git a/tests/scene/test_window.h b/tests/scene/test_window.cpp similarity index 97% rename from tests/scene/test_window.h rename to tests/scene/test_window.cpp index 5eaea3141b..c20622d876 100644 --- a/tests/scene/test_window.h +++ b/tests/scene/test_window.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_window.h */ +/* test_window.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_window) #include "scene/gui/control.h" #include "scene/main/window.h" -#include "tests/test_macros.h" - namespace TestWindow { class NotificationControlWindow : public Control { diff --git a/tests/servers/rendering/test_shader_preprocessor.h b/tests/servers/rendering/test_shader_preprocessor.cpp similarity index 99% rename from tests/servers/rendering/test_shader_preprocessor.h rename to tests/servers/rendering/test_shader_preprocessor.cpp index 8e9f71d7de..16286fc3fd 100644 --- a/tests/servers/rendering/test_shader_preprocessor.h +++ b/tests/servers/rendering/test_shader_preprocessor.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_shader_preprocessor.h */ +/* test_shader_preprocessor.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_shader_preprocessor) #include "servers/rendering/shader_preprocessor.h" -#include "tests/test_macros.h" - #include namespace TestShaderPreprocessor { diff --git a/tests/servers/test_nav_heap.h b/tests/servers/test_nav_heap.cpp similarity index 97% rename from tests/servers/test_nav_heap.h rename to tests/servers/test_nav_heap.cpp index 919049e7ad..ff14ca893a 100644 --- a/tests/servers/test_nav_heap.h +++ b/tests/servers/test_nav_heap.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_nav_heap.h */ +/* test_nav_heap.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_nav_heap) #include "servers/nav_heap.h" -#include "tests/test_macros.h" +namespace TestNavHeap { -namespace TestHeap { struct GreaterThan { bool operator()(int p_a, int p_b) const { return p_a > p_b; } }; @@ -193,4 +194,5 @@ TEST_CASE("[Heap] clear") { CHECK(heap_indexes[2] == Heap, RegisterHeapIndexes>::INVALID_INDEX); CHECK(heap_indexes[3] == Heap, RegisterHeapIndexes>::INVALID_INDEX); } -} //namespace TestHeap + +} // namespace TestNavHeap diff --git a/tests/servers/test_navigation_server_2d.h b/tests/servers/test_navigation_server_2d.cpp similarity index 99% rename from tests/servers/test_navigation_server_2d.h rename to tests/servers/test_navigation_server_2d.cpp index f8b0587b28..ef952e09a0 100644 --- a/tests/servers/test_navigation_server_2d.h +++ b/tests/servers/test_navigation_server_2d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_server_2d.h */ +/* test_navigation_server_2d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_server_2d) + +#include "modules/modules_enabled.gen.h" // For navigation 2D. + +#ifdef MODULE_NAVIGATION_2D_ENABLED #include "modules/navigation_2d/nav_utils_2d.h" -#include "servers/navigation_2d/navigation_server_2d.h" - #include "scene/2d/polygon_2d.h" - -#include "tests/test_macros.h" +#include "scene/main/window.h" +#include "servers/navigation_2d/navigation_server_2d.h" namespace TestNavigationServer2D { @@ -756,4 +760,7 @@ TEST_SUITE("[Navigation2D]") { CHECK_EQ(simplified_path.size(), 4); } } -} //namespace TestNavigationServer2D + +} // namespace TestNavigationServer2D + +#endif // MODULE_NAVIGATION_2D_ENABLED diff --git a/tests/servers/test_navigation_server_3d.h b/tests/servers/test_navigation_server_3d.cpp similarity index 99% rename from tests/servers/test_navigation_server_3d.h rename to tests/servers/test_navigation_server_3d.cpp index f16ed014dd..d5c20508d8 100644 --- a/tests/servers/test_navigation_server_3d.h +++ b/tests/servers/test_navigation_server_3d.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_navigation_server_3d.h */ +/* test_navigation_server_3d.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,9 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_navigation_server_3d) + +#include "modules/modules_enabled.gen.h" // For navigation 3D. + +#ifdef MODULE_NAVIGATION_3D_ENABLED #include "scene/3d/mesh_instance_3d.h" +#include "scene/main/window.h" #include "scene/resources/3d/primitive_meshes.h" #include "servers/navigation_3d/navigation_server_3d.h" @@ -839,4 +846,7 @@ TEST_SUITE("[Navigation3D]") { CHECK_EQ(simplified_path.size(), 4); } } -} //namespace TestNavigationServer3D + +} // namespace TestNavigationServer3D + +#endif // MODULE_NAVIGATION_3D_ENABLED diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.cpp similarity index 99% rename from tests/servers/test_text_server.h rename to tests/servers/test_text_server.cpp index 01e53f6894..a3f8a6ebb0 100644 --- a/tests/servers/test_text_server.h +++ b/tests/servers/test_text_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_text_server.h */ +/* test_text_server.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_text_server) #ifdef TOOLS_ENABLED #include "editor/themes/builtin_fonts.gen.h" #include "servers/text/text_server.h" -#include "tests/test_macros.h" namespace TestTextServer { @@ -1014,6 +1015,7 @@ TEST_SUITE("[TextServer]") { } } } -}; // namespace TestTextServer + +} // namespace TestTextServer #endif // TOOLS_ENABLED diff --git a/tests/servers/test_triangle2.h b/tests/servers/test_triangle2.cpp similarity index 93% rename from tests/servers/test_triangle2.h rename to tests/servers/test_triangle2.cpp index ca3593e2d0..b422913dbf 100644 --- a/tests/servers/test_triangle2.h +++ b/tests/servers/test_triangle2.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* test_triangle2.h */ +/* test_triangle2.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#pragma once +#include "tests/test_macros.h" + +TEST_FORCE_LINK(test_triangle2) + +#include "modules/modules_enabled.gen.h" // For navigation 2D. + +#ifdef MODULE_NAVIGATION_2D_ENABLED #include "modules/navigation_2d/triangle2.h" -#include "tests/test_macros.h" - namespace TestTriangle2 { + TEST_SUITE("[Triangle2]") { TEST_CASE("[Triangle2] Test get_area") { const Vector2 p0(5.0, 5.0); @@ -67,4 +72,7 @@ TEST_SUITE("[Triangle2]") { CHECK(t.get_closest_point_to(p4).is_equal_approx(p4)); } } + } // namespace TestTriangle2 + +#endif // MODULE_NAVIGATION_2D_ENABLED diff --git a/tests/test_builders.py b/tests/test_builders.py new file mode 100644 index 0000000000..91f996918c --- /dev/null +++ b/tests/test_builders.py @@ -0,0 +1,38 @@ +"""Functions used to generate source files during build time""" + +import re + +import methods + +RE_PATH_SPLIT = re.compile(r"[^/\\]+?(?=\.)") + +TEMPLATE = """\ +#ifndef _WIN32 +#define TEST_DLL_PRIVATE __attribute__((visibility("hidden"))) +#else +#define TEST_DLL_PRIVATE +#endif // _WIN32 + +namespace ForceLink {{ + TEST_DLL_PRIVATE void force_link_tests(); + {TESTS_DECLARE} +}} // namespace ForceLink + +void ForceLink::force_link_tests() {{ + {TESTS_CALL} +}} +""" + + +def force_link_builder(target, source, env): + names = [RE_PATH_SPLIT.search(str(path)).group() for path in source[0].read()] + declares = [f"TEST_DLL_PRIVATE void force_link_{name}();" for name in names] + calls = [f"force_link_{name}();" for name in names] + + with methods.generated_wrapper(str(target[0])) as file: + file.write( + TEMPLATE.format( + TESTS_DECLARE="\n\t".join(declares), + TESTS_CALL="\n\t".join(calls), + ) + ) diff --git a/tests/test_macros.h b/tests/test_macros.h index 8bd6c995ab..c7ea02cbf0 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -41,6 +41,12 @@ // https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference #include "thirdparty/doctest/doctest.h" +// Forces a test file to be linked. +#define TEST_FORCE_LINK(m_name) \ + namespace ForceLink { \ + void force_link_##m_name() {} \ + } + // The test is skipped with this, run pending tests with `--test --no-skip`. #define TEST_CASE_PENDING(name) TEST_CASE(name *doctest::skip()) diff --git a/tests/test_main.cpp b/tests/test_main.cpp index ab710557fb..ae57c3a2a7 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -30,191 +30,23 @@ #include "test_main.h" -#include "core/error/error_macros.h" #include "core/input/input.h" #include "core/io/dir_access.h" -#include "modules/modules_enabled.gen.h" +#include "core/string/translation_server.h" +#include "scene/main/window.h" +#include "scene/theme/theme_db.h" +#include "servers/audio/audio_server.h" +#include "servers/rendering/rendering_server_default.h" +#include "tests/display_server_mock.h" +#include "tests/force_link.gen.h" +#include "tests/test_macros.h" +#include "tests/test_utils.h" #ifdef TOOLS_ENABLED #include "editor/file_system/editor_paths.h" #include "editor/settings/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" -#include "tests/core/input/test_input_event_mouse.h" -#include "tests/core/input/test_shortcut.h" -#include "tests/core/io/test_config_file.h" -#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_ip_address.h" -#include "tests/core/io/test_json.h" -#include "tests/core/io/test_json_native.h" -#include "tests/core/io/test_logger.h" -#include "tests/core/io/test_marshalls.h" -#include "tests/core/io/test_packet_peer.h" -#include "tests/core/io/test_pck_packer.h" -#include "tests/core/io/test_resource.h" -#include "tests/core/io/test_resource_uid.h" -#include "tests/core/io/test_stream_peer.h" -#include "tests/core/io/test_stream_peer_buffer.h" -#include "tests/core/io/test_stream_peer_gzip.h" -#include "tests/core/io/test_stream_peer_tcp.h" -#include "tests/core/io/test_tcp_server.h" -#include "tests/core/io/test_udp_server.h" -#include "tests/core/io/test_uds_server.h" -#include "tests/core/io/test_xml_parser.h" -#include "tests/core/math/test_aabb.h" -#include "tests/core/math/test_astar.h" -#include "tests/core/math/test_basis.h" -#include "tests/core/math/test_color.h" -#include "tests/core/math/test_expression.h" -#include "tests/core/math/test_geometry_2d.h" -#include "tests/core/math/test_geometry_3d.h" -#include "tests/core/math/test_math_funcs.h" -#include "tests/core/math/test_plane.h" -#include "tests/core/math/test_projection.h" -#include "tests/core/math/test_quaternion.h" -#include "tests/core/math/test_random_number_generator.h" -#include "tests/core/math/test_rect2.h" -#include "tests/core/math/test_rect2i.h" -#include "tests/core/math/test_transform_2d.h" -#include "tests/core/math/test_transform_3d.h" -#include "tests/core/math/test_vector2.h" -#include "tests/core/math/test_vector2i.h" -#include "tests/core/math/test_vector3.h" -#include "tests/core/math/test_vector3i.h" -#include "tests/core/math/test_vector4.h" -#include "tests/core/math/test_vector4i.h" -#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_fuzzy_search.h" -#include "tests/core/string/test_node_path.h" -#include "tests/core/string/test_string.h" -#include "tests/core/string/test_translation.h" -#include "tests/core/string/test_translation_server.h" -#include "tests/core/templates/test_a_hash_map.h" -#include "tests/core/templates/test_command_queue.h" -#include "tests/core/templates/test_fixed_vector.h" -#include "tests/core/templates/test_hash_map.h" -#include "tests/core/templates/test_hash_set.h" -#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_paged_array.h" -#include "tests/core/templates/test_rid.h" -#include "tests/core/templates/test_self_list.h" -#include "tests/core/templates/test_span.h" -#include "tests/core/templates/test_vector.h" -#include "tests/core/templates/test_vset.h" -#include "tests/core/test_crypto.h" -#include "tests/core/test_hashing_context.h" -#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_animation_blend_tree.h" -#include "tests/scene/test_animation_player.h" -#include "tests/scene/test_audio_stream_wav.h" -#include "tests/scene/test_bit_map.h" -#include "tests/scene/test_button.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_fontfile.h" -#include "tests/scene/test_gradient.h" -#include "tests/scene/test_gradient_texture.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_parallax_2d.h" -#include "tests/scene/test_path_2d.h" -#include "tests/scene/test_path_follow_2d.h" -#include "tests/scene/test_sprite_2d.h" -#include "tests/scene/test_sprite_frames.h" -#include "tests/scene/test_style_box_texture.h" -#include "tests/scene/test_texture_progress_bar.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_nav_heap.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_option_button.h" -#include "tests/scene/test_split_container.h" -#include "tests/scene/test_tab_bar.h" -#include "tests/scene/test_tab_container.h" -#include "tests/scene/test_text_edit.h" -#include "tests/scene/test_tree.h" -#endif // ADVANCED_GUI_DISABLED - -#ifndef _3D_DISABLED -#include "tests/core/math/test_triangle_mesh.h" -#include "tests/scene/test_arraymesh.h" -#include "tests/scene/test_camera_3d.h" -#include "tests/scene/test_convert_transform_modifier_3d.h" -#include "tests/scene/test_copy_transform_modifier_3d.h" -#include "tests/scene/test_decal.h" -#ifdef MODULE_GLTF_ENABLED -#include "tests/scene/test_gltf_document.h" -#endif -#include "tests/scene/test_path_3d.h" -#include "tests/scene/test_path_follow_3d.h" -#include "tests/scene/test_primitives.h" -#include "tests/scene/test_skeleton_3d.h" -#include "tests/scene/test_sky.h" -#endif // _3D_DISABLED - -#ifndef PHYSICS_3D_DISABLED -#include "tests/scene/test_height_map_shape_3d.h" -#include "tests/scene/test_physics_material.h" -#endif // PHYSICS_3D_DISABLED - -#ifdef MODULE_NAVIGATION_2D_ENABLED -#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/servers/test_navigation_server_2d.h" -#include "tests/servers/test_triangle2.h" -#endif // MODULE_NAVIGATION_2D_ENABLED - -#ifdef MODULE_NAVIGATION_3D_ENABLED -#include "tests/scene/test_navigation_agent_3d.h" -#include "tests/scene/test_navigation_obstacle_3d.h" -#include "tests/scene/test_navigation_region_3d.h" -#include "tests/servers/test_navigation_server_3d.h" -#endif // MODULE_NAVIGATION_3D_ENABLED - -#include "modules/modules_tests.gen.h" - -#include "tests/display_server_mock.h" -#include "tests/test_macros.h" - -#include "scene/theme/theme_db.h" - #ifndef NAVIGATION_2D_DISABLED #include "servers/navigation_2d/navigation_server_2d.h" #endif // NAVIGATION_2D_DISABLED @@ -231,9 +63,11 @@ #include "servers/physics_3d/physics_server_3d_dummy.h" #endif // PHYSICS_3D_DISABLED -#include "servers/rendering/rendering_server_default.h" +#include "modules/modules_tests.gen.h" // TODO: Migrate module tests to compilation files. int test_main(int argc, char *argv[]) { + ForceLink::force_link_tests(); + bool run_tests = true; // Convert arguments to Godot's command-line. diff --git a/tests/test_tools.h b/tests/test_tools.h index ff0191d436..49b51c7915 100644 --- a/tests/test_tools.h +++ b/tests/test_tools.h @@ -30,6 +30,8 @@ #pragma once +#include "core/error/error_macros.h" + struct ErrorDetector { ErrorDetector() { eh.errfunc = _detect_error; diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp index 9d41e74020..cbf1587532 100644 --- a/tests/test_utils.cpp +++ b/tests/test_utils.cpp @@ -30,6 +30,7 @@ #include "tests/test_utils.h" +#include "core/config/project_settings.h" #include "core/io/dir_access.h" #include "core/os/os.h" @@ -47,3 +48,7 @@ String TestUtils::get_temp_path(const String &p_suffix) { DirAccess::make_dir_absolute(temp_base); // Ensure the directory exists. return temp_base.path_join(p_suffix); } + +String &TestProjectSettingsInternalsAccessor::resource_path() { + return ProjectSettings::get_singleton()->resource_path; +} diff --git a/tests/test_utils.h b/tests/test_utils.h index 5b3be37112..169a16ca02 100644 --- a/tests/test_utils.h +++ b/tests/test_utils.h @@ -38,3 +38,11 @@ String get_data_path(const String &p_file); String get_executable_dir(); String get_temp_path(const String &p_suffix); } // namespace TestUtils + +// FIXME: This was originally constrained to `tests/core/config/test_project_settings.h`, but that +// file is no longer a header. Some other tests relied on the ability to override the resource +// path, so relocating the accessor is the least-intrusive workaround. +class TestProjectSettingsInternalsAccessor { +public: + static String &resource_path(); +};