diff --git a/tests/scene/test_option_button.h b/tests/scene/test_option_button.h index ac20100daa8..59966b7d5e2 100644 --- a/tests/scene/test_option_button.h +++ b/tests/scene/test_option_button.h @@ -82,7 +82,7 @@ TEST_CASE("[SceneTree][OptionButton] Single item") { memdelete(test_opt); } -TEST_CASE("[SceneTree][OptionButton] Complex structure") { +TEST_CASE("[SceneTree][OptionButton] Many items") { OptionButton *test_opt = memnew(OptionButton); SUBCASE("Creating a complex structure and checking getters") { @@ -127,6 +127,31 @@ TEST_CASE("[SceneTree][OptionButton] Complex structure") { CHECK(test_opt->get_item_count() == 1); } + SUBCASE("Getters and setters not related to structure") { + test_opt->add_item("regular", 2019); + + Ref test_icon = memnew(Texture2D); + test_opt->add_icon_item(test_icon, "icon", 3092); + + // item_text. + test_opt->set_item_text(0, "example text"); + CHECK(test_opt->get_item_text(0) == "example text"); + + // item_metadata. + Dictionary m; + m["bool"] = true; + m["String"] = "yes"; + test_opt->set_item_metadata(1, m); + CHECK(test_opt->get_item_metadata(1) == m); + + // item_tooltip. + test_opt->set_item_tooltip(0, "tooltip guide"); + CHECK(test_opt->get_item_tooltip(0) == "tooltip guide"); + + test_opt->remove_item(1); + test_opt->remove_item(0); + } + memdelete(test_opt); }