Merge pull request #88452 from AThousandShips/template_test
Fix running tests in template builds
This commit is contained in:
commit
8a9c9ef94f
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
namespace GDScriptTests {
|
namespace GDScriptTests {
|
||||||
|
|
||||||
|
// TODO: Handle some cases failing on release builds. See: https://github.com/godotengine/godot/pull/88452
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
TEST_SUITE("[Modules][GDScript]") {
|
TEST_SUITE("[Modules][GDScript]") {
|
||||||
TEST_CASE("Script compilation and runtime") {
|
TEST_CASE("Script compilation and runtime") {
|
||||||
bool print_filenames = OS::get_singleton()->get_cmdline_args().find("--print-filenames") != nullptr;
|
bool print_filenames = OS::get_singleton()->get_cmdline_args().find("--print-filenames") != nullptr;
|
||||||
|
@ -68,6 +70,7 @@ func _init():
|
||||||
ref_counted->set_script(gdscript);
|
ref_counted->set_script(gdscript);
|
||||||
CHECK_MESSAGE(int(ref_counted->get_meta("result")) == 42, "The script should assign object metadata successfully.");
|
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") {
|
TEST_CASE("[Modules][GDScript] Validate built-in API") {
|
||||||
GDScriptLanguage *lang = GDScriptLanguage::get_singleton();
|
GDScriptLanguage *lang = GDScriptLanguage::get_singleton();
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
|
|
||||||
namespace TestProjectSettings {
|
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") {
|
TEST_CASE("[ProjectSettings] Get existing setting") {
|
||||||
CHECK(ProjectSettings::get_singleton()->has_setting("application/config/name"));
|
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;
|
String name = variant;
|
||||||
CHECK_EQ(name, "GDScript Integration Test Suite");
|
CHECK_EQ(name, "GDScript Integration Test Suite");
|
||||||
}
|
}
|
||||||
|
#endif // TOOLS_ENABLED
|
||||||
|
|
||||||
TEST_CASE("[ProjectSettings] Non existing setting is null") {
|
TEST_CASE("[ProjectSettings] Non existing setting is null") {
|
||||||
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
|
CHECK_FALSE(ProjectSettings::get_singleton()->has_setting("not_existing_setting"));
|
||||||
|
|
|
@ -88,11 +88,14 @@ TEST_CASE("[Image] Saving and loading") {
|
||||||
err == OK,
|
err == OK,
|
||||||
"The image should be saved successfully as a .png file.");
|
"The image should be saved successfully as a .png file.");
|
||||||
|
|
||||||
|
// Only available on editor builds.
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
// Save EXR
|
// Save EXR
|
||||||
err = image->save_exr(save_path_exr, false);
|
err = image->save_exr(save_path_exr, false);
|
||||||
CHECK_MESSAGE(
|
CHECK_MESSAGE(
|
||||||
err == OK,
|
err == OK,
|
||||||
"The image should be saved successfully as an .exr file.");
|
"The image should be saved successfully as an .exr file.");
|
||||||
|
#endif // TOOLS_ENABLED
|
||||||
|
|
||||||
// Load using load()
|
// Load using load()
|
||||||
Ref<Image> image_load = memnew(Image());
|
Ref<Image> image_load = memnew(Image());
|
||||||
|
|
|
@ -93,6 +93,7 @@ TEST_CASE("[OS] Ticks") {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[OS] Feature tags") {
|
TEST_CASE("[OS] Feature tags") {
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
CHECK_MESSAGE(
|
CHECK_MESSAGE(
|
||||||
OS::get_singleton()->has_feature("editor"),
|
OS::get_singleton()->has_feature("editor"),
|
||||||
"The binary has the \"editor\" feature tag.");
|
"The binary has the \"editor\" feature tag.");
|
||||||
|
@ -105,6 +106,29 @@ TEST_CASE("[OS] Feature tags") {
|
||||||
CHECK_MESSAGE(
|
CHECK_MESSAGE(
|
||||||
!OS::get_singleton()->has_feature("template_release"),
|
!OS::get_singleton()->has_feature("template_release"),
|
||||||
"The binary does not have the \"template_release\" feature tag.");
|
"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") {
|
TEST_CASE("[OS] Process ID") {
|
||||||
|
|
|
@ -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");
|
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") {
|
TEST_CASE("[OptimizedTranslation] Generate from Translation and read messages") {
|
||||||
Ref<Translation> translation = memnew(Translation);
|
Ref<Translation> translation = memnew(Translation);
|
||||||
translation->set_locale("fr");
|
translation->set_locale("fr");
|
||||||
|
@ -150,7 +151,6 @@ TEST_CASE("[OptimizedTranslation] Generate from Translation and read messages")
|
||||||
CHECK(messages.size() == 0);
|
CHECK(messages.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
TEST_CASE("[TranslationCSV] CSV import") {
|
TEST_CASE("[TranslationCSV] CSV import") {
|
||||||
Ref<ResourceImporterCSVTranslation> import_csv_translation = memnew(ResourceImporterCSVTranslation);
|
Ref<ResourceImporterCSVTranslation> import_csv_translation = memnew(ResourceImporterCSVTranslation);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue