diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-02-17 18:58:06 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-02-22 18:05:42 +0100 |
commit | d7a72d72e6106f10992ec678a4799fee135ddf3d (patch) | |
tree | 917d197c618b40dd8d09837b08d814f48578a8cf /tests | |
parent | 4b543ddbf813ad77fc37f96c1a6d7359261ddc7c (diff) | |
download | redot-engine-d7a72d72e6106f10992ec678a4799fee135ddf3d.tar.gz |
Fix running tests in template builds
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/config/test_project_settings.h | 3 | ||||
-rw-r--r-- | tests/core/io/test_image.h | 3 | ||||
-rw-r--r-- | tests/core/os/test_os.h | 24 | ||||
-rw-r--r-- | tests/core/string/test_translation.h | 2 |
4 files changed, 31 insertions, 1 deletions
diff --git a/tests/core/config/test_project_settings.h b/tests/core/config/test_project_settings.h index 9bd072f511..8fc2489f8b 100644 --- a/tests/core/config/test_project_settings.h +++ b/tests/core/config/test_project_settings.h @@ -45,6 +45,8 @@ 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")); @@ -64,6 +66,7 @@ TEST_CASE("[ProjectSettings] Default value is ignored if setting exists") { String name = variant; CHECK_EQ(name, "GDScript Integration Test Suite"); } +#endif // TOOLS_ENABLED TEST_CASE("[ProjectSettings] Non existing setting is null") { CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting")); diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.h index 945a7e1ba3..35d182f50c 100644 --- a/tests/core/io/test_image.h +++ b/tests/core/io/test_image.h @@ -88,11 +88,14 @@ TEST_CASE("[Image] Saving and loading") { err == OK, "The image should be saved successfully as a .png file."); + // Only available on editor builds. +#ifdef TOOLS_ENABLED // Save EXR err = image->save_exr(save_path_exr, false); CHECK_MESSAGE( err == OK, "The image should be saved successfully as an .exr file."); +#endif // TOOLS_ENABLED // Load using load() Ref<Image> image_load = memnew(Image()); diff --git a/tests/core/os/test_os.h b/tests/core/os/test_os.h index ef8216685f..1a5d360f57 100644 --- a/tests/core/os/test_os.h +++ b/tests/core/os/test_os.h @@ -93,6 +93,7 @@ TEST_CASE("[OS] Ticks") { } TEST_CASE("[OS] Feature tags") { +#ifdef TOOLS_ENABLED CHECK_MESSAGE( OS::get_singleton()->has_feature("editor"), "The binary has the \"editor\" feature tag."); @@ -105,6 +106,29 @@ TEST_CASE("[OS] Feature tags") { CHECK_MESSAGE( !OS::get_singleton()->has_feature("template_release"), "The binary does not have the \"template_release\" feature tag."); +#else + CHECK_MESSAGE( + !OS::get_singleton()->has_feature("editor"), + "The binary does not have the \"editor\" feature tag."); + CHECK_MESSAGE( + OS::get_singleton()->has_feature("template"), + "The binary has the \"template\" feature tag."); +#ifdef DEBUG_ENABLED + CHECK_MESSAGE( + OS::get_singleton()->has_feature("template_debug"), + "The binary has the \"template_debug\" feature tag."); + CHECK_MESSAGE( + !OS::get_singleton()->has_feature("template_release"), + "The binary does not have the \"template_release\" feature tag."); +#else + CHECK_MESSAGE( + !OS::get_singleton()->has_feature("template_debug"), + "The binary does not have the \"template_debug\" feature tag."); + CHECK_MESSAGE( + OS::get_singleton()->has_feature("template_release"), + "The binary has the \"template_release\" feature tag."); +#endif // DEBUG_ENABLED +#endif // TOOLS_ENABLED } TEST_CASE("[OS] Process ID") { diff --git a/tests/core/string/test_translation.h b/tests/core/string/test_translation.h index bf9674d6b1..acdd851b29 100644 --- a/tests/core/string/test_translation.h +++ b/tests/core/string/test_translation.h @@ -129,6 +129,7 @@ TEST_CASE("[TranslationPO] Plural messages") { CHECK(vformat(translation->get_plural_message("There are %d apples", "", 2), 2) == "Il y a 2 pommes"); } +#ifdef TOOLS_ENABLED TEST_CASE("[OptimizedTranslation] Generate from Translation and read messages") { Ref<Translation> translation = memnew(Translation); translation->set_locale("fr"); @@ -150,7 +151,6 @@ TEST_CASE("[OptimizedTranslation] Generate from Translation and read messages") CHECK(messages.size() == 0); } -#ifdef TOOLS_ENABLED TEST_CASE("[TranslationCSV] CSV import") { Ref<ResourceImporterCSVTranslation> import_csv_translation = memnew(ResourceImporterCSVTranslation); |