C++: Added ComponentInstance::definition() getter to retrieve the ComponentDefinition for an instance

Fixes #4087
This commit is contained in:
Simon Hausmann 2023-12-14 00:46:47 +01:00 committed by Simon Hausmann
parent d104238cac
commit 75f24163ed
4 changed files with 34 additions and 0 deletions

View file

@ -331,6 +331,13 @@ SCENARIO("Component Definition Properties")
auto callback_names = comp_def.callbacks();
REQUIRE(callback_names.size() == 1);
REQUIRE(callback_names[0] == "dummy");
auto instance = comp_def.create();
ComponentDefinition new_comp_def = instance->definition();
auto new_props = new_comp_def.properties();
REQUIRE(new_props.size() == 1);
REQUIRE(new_props[0].property_name == "test");
REQUIRE(new_props[0].property_type == Value::Type::String);
}
SCENARIO("Component Definition Properties / Two-way bindings")