diff options
Diffstat (limited to 'tests/scene')
-rw-r--r-- | tests/scene/test_sprite_frames.h | 9 | ||||
-rw-r--r-- | tests/scene/test_theme.h | 18 |
2 files changed, 21 insertions, 6 deletions
diff --git a/tests/scene/test_sprite_frames.h b/tests/scene/test_sprite_frames.h index b252ea8aae..61bbd16493 100644 --- a/tests/scene/test_sprite_frames.h +++ b/tests/scene/test_sprite_frames.h @@ -144,7 +144,7 @@ TEST_CASE("[SpriteFrames] Animation Speed getter and setter") { frames.get_animation_speed(test_animation_name) == 5.0, "Sets new animation to default speed"); - frames.set_animation_speed("GodotTest", 123.0004); + frames.set_animation_speed(test_animation_name, 123.0004); CHECK_MESSAGE( frames.get_animation_speed(test_animation_name) == 123.0004, @@ -197,7 +197,7 @@ TEST_CASE("[SpriteFrames] Animation Loop getter and setter") { } // TODO -TEST_CASE("[SpriteFrames] Frame addition, removal, and retrival") { +TEST_CASE("[SpriteFrames] Frame addition, removal, and retrieval") { Ref<Texture2D> dummy_frame1; dummy_frame1.instantiate(); @@ -212,13 +212,14 @@ TEST_CASE("[SpriteFrames] Frame addition, removal, and retrival") { frames.add_frame(test_animation_name, dummy_frame1, 0); frames.add_frame(test_animation_name, dummy_frame1, 1); + frames.add_frame(test_animation_name, dummy_frame1, 2); CHECK_MESSAGE( - frames.get_frame_count(test_animation_name) == 2, + frames.get_frame_count(test_animation_name) == 3, "Adds multiple frames"); - frames.remove_frame(test_animation_name, 0); frames.remove_frame(test_animation_name, 1); + frames.remove_frame(test_animation_name, 0); CHECK_MESSAGE( frames.get_frame_count(test_animation_name) == 1, diff --git a/tests/scene/test_theme.h b/tests/scene/test_theme.h index f7cfa0fd5b..f5b21eec32 100644 --- a/tests/scene/test_theme.h +++ b/tests/scene/test_theme.h @@ -101,18 +101,24 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Good theme type names") { SUBCASE("set_type_variation") { for (const StringName &name : names) { + if (name == StringName()) { // Skip empty here, not allowed. + continue; + } Ref<Theme> theme = memnew(Theme); ErrorDetector ed; theme->set_type_variation(valid_type_name, name); - CHECK(ed.has_error == (name == StringName())); + CHECK_FALSE(ed.has_error); } for (const StringName &name : names) { + if (name == StringName()) { // Skip empty here, not allowed. + continue; + } Ref<Theme> theme = memnew(Theme); ErrorDetector ed; theme->set_type_variation(name, valid_type_name); - CHECK(ed.has_error == (name == StringName())); + CHECK_FALSE(ed.has_error); } } } @@ -125,6 +131,8 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme type names") { String::utf8("contains_汉字"), }; + ERR_PRINT_OFF; // All these rightfully print errors. + SUBCASE("add_type") { for (const StringName &name : names) { Ref<Theme> theme = memnew(Theme); @@ -175,6 +183,8 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme type names") { CHECK(ed.has_error); } } + + ERR_PRINT_ON; } TEST_CASE_FIXTURE(Fixture, "[Theme] Good theme item names") { @@ -223,6 +233,8 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme item names") { String::utf8("contains_汉字"), }; + ERR_PRINT_OFF; // All these rightfully print errors. + SUBCASE("set_theme_item") { for (const StringName &name : names) { for (const DataEntry &entry : valid_data) { @@ -250,6 +262,8 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme item names") { } } } + + ERR_PRINT_ON; } } // namespace TestTheme |