From 6d56d2d05e3bb30081d701b41ef2284678612ed6 Mon Sep 17 00:00:00 2001 From: kit Date: Tue, 6 May 2025 13:48:16 -0400 Subject: [PATCH] Fix tests that fail when alone --- .../gdscript/tests/gdscript_test_runner_suite.h | 3 ++- tests/core/config/test_project_settings.h | 15 ++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h index 78a257a9444..ed9f24f6c5e 100644 --- a/modules/gdscript/tests/gdscript_test_runner_suite.h +++ b/modules/gdscript/tests/gdscript_test_runner_suite.h @@ -48,8 +48,10 @@ TEST_SUITE("[Modules][GDScript]") { REQUIRE_MESSAGE(fail_count == 0, "All GDScript tests should pass."); } } +#endif // TOOLS_ENABLED TEST_CASE("[Modules][GDScript] Load source code dynamically and run it") { + GDScriptLanguage::get_singleton()->init(); Ref gdscript = memnew(GDScript); gdscript->set_source_code(R"( extends RefCounted @@ -69,7 +71,6 @@ func _init(): ref_counted->set_script(gdscript); CHECK_MESSAGE(int(ref_counted->get_meta("result")) == 42, "The script should assign object metadata successfully."); } -#endif // TOOLS_ENABLED TEST_CASE("[Modules][GDScript] Validate built-in API") { GDScriptLanguage *lang = GDScriptLanguage::get_singleton(); diff --git a/tests/core/config/test_project_settings.h b/tests/core/config/test_project_settings.h index 4daaf367e29..758741b404d 100644 --- a/tests/core/config/test_project_settings.h +++ b/tests/core/config/test_project_settings.h @@ -44,28 +44,25 @@ public: namespace TestProjectSettings { -// TODO: Handle some cases failing on release builds. See: https://github.com/godotengine/godot/pull/88452 -#ifdef TOOLS_ENABLED TEST_CASE("[ProjectSettings] Get existing setting") { - CHECK(ProjectSettings::get_singleton()->has_setting("application/config/name")); + CHECK(ProjectSettings::get_singleton()->has_setting("application/run/main_scene")); - Variant variant = ProjectSettings::get_singleton()->get_setting("application/config/name"); + Variant variant = ProjectSettings::get_singleton()->get_setting("application/run/main_scene"); CHECK_EQ(variant.get_type(), Variant::STRING); String name = variant; - CHECK_EQ(name, "GDScript Integration Test Suite"); + CHECK_EQ(name, String()); } TEST_CASE("[ProjectSettings] Default value is ignored if setting exists") { - CHECK(ProjectSettings::get_singleton()->has_setting("application/config/name")); + CHECK(ProjectSettings::get_singleton()->has_setting("application/run/main_scene")); - Variant variant = ProjectSettings::get_singleton()->get_setting("application/config/name", "SomeDefaultValue"); + Variant variant = ProjectSettings::get_singleton()->get_setting("application/run/main_scene", "SomeDefaultValue"); CHECK_EQ(variant.get_type(), Variant::STRING); String name = variant; - CHECK_EQ(name, "GDScript Integration Test Suite"); + CHECK_EQ(name, String()); } -#endif // TOOLS_ENABLED TEST_CASE("[ProjectSettings] Non existing setting is null") { CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));