You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Fix tests that fail when alone
This commit is contained in:
@@ -48,8 +48,10 @@ TEST_SUITE("[Modules][GDScript]") {
|
|||||||
REQUIRE_MESSAGE(fail_count == 0, "All GDScript tests should pass.");
|
REQUIRE_MESSAGE(fail_count == 0, "All GDScript tests should pass.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // TOOLS_ENABLED
|
||||||
|
|
||||||
TEST_CASE("[Modules][GDScript] Load source code dynamically and run it") {
|
TEST_CASE("[Modules][GDScript] Load source code dynamically and run it") {
|
||||||
|
GDScriptLanguage::get_singleton()->init();
|
||||||
Ref<GDScript> gdscript = memnew(GDScript);
|
Ref<GDScript> gdscript = memnew(GDScript);
|
||||||
gdscript->set_source_code(R"(
|
gdscript->set_source_code(R"(
|
||||||
extends RefCounted
|
extends RefCounted
|
||||||
@@ -69,7 +71,6 @@ 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();
|
||||||
|
|||||||
@@ -44,28 +44,25 @@ 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/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);
|
CHECK_EQ(variant.get_type(), Variant::STRING);
|
||||||
|
|
||||||
String name = variant;
|
String name = variant;
|
||||||
CHECK_EQ(name, "GDScript Integration Test Suite");
|
CHECK_EQ(name, String());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[ProjectSettings] Default value is ignored if setting exists") {
|
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);
|
CHECK_EQ(variant.get_type(), Variant::STRING);
|
||||||
|
|
||||||
String name = variant;
|
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") {
|
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"));
|
||||||
|
|||||||
Reference in New Issue
Block a user