diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/os/test_os.h | 12 | ||||
-rw-r--r-- | tests/core/variant/test_dictionary.h | 13 | ||||
-rw-r--r-- | tests/scene/test_curve.h | 5 | ||||
-rw-r--r-- | tests/servers/test_text_server.h | 2 |
4 files changed, 24 insertions, 8 deletions
diff --git a/tests/core/os/test_os.h b/tests/core/os/test_os.h index c46da5e156..086f0b9b0c 100644 --- a/tests/core/os/test_os.h +++ b/tests/core/os/test_os.h @@ -97,14 +97,14 @@ TEST_CASE("[OS] Feature tags") { OS::get_singleton()->has_feature("editor"), "The binary has the \"editor\" feature tag."); CHECK_MESSAGE( - !OS::get_singleton()->has_feature("standalone"), - "The binary does not have the \"standalone\" feature tag."); + !OS::get_singleton()->has_feature("template"), + "The binary does not have the \"template\" feature tag."); CHECK_MESSAGE( - OS::get_singleton()->has_feature("debug"), - "The binary has the \"debug\" feature tag."); + !OS::get_singleton()->has_feature("template_debug"), + "The binary does not have the \"template_debug\" feature tag."); CHECK_MESSAGE( - !OS::get_singleton()->has_feature("release"), - "The binary does not have the \"release\" feature tag."); + !OS::get_singleton()->has_feature("template_release"), + "The binary does not have the \"template_release\" feature tag."); } TEST_CASE("[OS] Process ID") { diff --git a/tests/core/variant/test_dictionary.h b/tests/core/variant/test_dictionary.h index c98434d42c..0c87f11ed7 100644 --- a/tests/core/variant/test_dictionary.h +++ b/tests/core/variant/test_dictionary.h @@ -64,6 +64,19 @@ TEST_CASE("[Dictionary] Assignment using bracket notation ([])") { map["World!"] = 4; CHECK(int(map["World!"]) == 4); + map[StringName("HelloName")] = 6; + CHECK(int(map[StringName("HelloName")]) == 6); + // Check that StringName key is converted to String. + CHECK(int(map.find_key(6).get_type()) == Variant::STRING); + map[StringName("HelloName")] = 7; + CHECK(int(map[StringName("HelloName")]) == 7); + + // Test String and StringName are equivalent. + map[StringName("Hello")] = 8; + CHECK(int(map["Hello"]) == 8); + map["Hello"] = 9; + CHECK(int(map[StringName("Hello")]) == 9); + // Test non-string keys, since keys can be of any Variant type. map[12345] = -5; CHECK(int(map[12345]) == -5); diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.h index 36ec0c0a4d..4afd5b293f 100644 --- a/tests/scene/test_curve.h +++ b/tests/scene/test_curve.h @@ -31,6 +31,7 @@ #ifndef TEST_CURVE_H #define TEST_CURVE_H +#include "core/math/math_funcs.h" #include "scene/resources/curve.h" #include "tests/test_macros.h" @@ -229,7 +230,7 @@ TEST_CASE("[Curve2D] Linear sampling should return exact value") { for (int i = 0; i < len; i++) { Vector2 pos = curve->sample_baked(i); - CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); + CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value"); } } @@ -245,7 +246,7 @@ TEST_CASE("[Curve3D] Linear sampling should return exact value") { for (int i = 0; i < len; i++) { Vector3 pos = curve->sample_baked(i); - CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); + CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value"); } } diff --git a/tests/servers/test_text_server.h b/tests/servers/test_text_server.h index 9ebd0f34b4..297f7d2068 100644 --- a/tests/servers/test_text_server.h +++ b/tests/servers/test_text_server.h @@ -68,8 +68,10 @@ TEST_SUITE("[TextServer]") { RID font1 = ts->create_font(); ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size); + ts->font_set_allow_system_fallback(font1, false); RID font2 = ts->create_font(); ts->font_set_data_ptr(font2, _font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size); + ts->font_set_allow_system_fallback(font2, false); Array font; font.push_back(font1); |