37 EXPECT_EQ(catalogue.
modelTypes(), std::vector<std::string>({}));
38 EXPECT_EQ(catalogue.
labels(), std::vector<std::string>({}));
50 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
56 EXPECT_THROW(catalogue.
create(
"non-registered"), std::runtime_error);
59 EXPECT_EQ(catalogue.
modelTypes(), std::vector<std::string>({
"Property"}));
60 EXPECT_EQ(catalogue.
labels(), std::vector<std::string>({
""}));
72 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
76 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
79 EXPECT_EQ(
copy.modelTypes(), std::vector<std::string>({
"Property"}));
80 EXPECT_EQ(
copy.labels(), std::vector<std::string>({
""}));
85 EXPECT_TRUE(
dynamic_cast<VectorItem*
>(item.get()) !=
nullptr);
101 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
105 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
122 EXPECT_TRUE(
dynamic_cast<SessionItem*
>(item.get()) !=
nullptr);
125 EXPECT_TRUE(
dynamic_cast<PropertyItem*
>(item.get()) !=
nullptr);
128 EXPECT_TRUE(
dynamic_cast<VectorItem*
>(item.get()) !=
nullptr);
131 EXPECT_TRUE(
dynamic_cast<CompoundItem*
>(item.get()) !=
nullptr);
141 EXPECT_EQ(catalogue.
modelTypes(), std::vector<std::string>({
"Property",
"Vector"}));
142 EXPECT_EQ(catalogue.
labels(), std::vector<std::string>({
"property",
"vector item"}));
155 catalogue1.
merge(catalogue2);
159 std::vector<std::string> expected_labels = {
"property",
"vector",
"compound"};
161 EXPECT_EQ(catalogue1.
modelTypes(), expected_models);
162 EXPECT_EQ(catalogue1.
labels(), expected_labels);
165 EXPECT_TRUE(
dynamic_cast<VectorItem*
>(item.get()) !=
nullptr);
168 EXPECT_THROW(catalogue1.
merge(catalogue2), std::runtime_error);
Testing ItemCatalogue construction.
Complex item holding mixed SessionItem types (single properties and other CompountItems).
Catalogue for item constructions.
std::vector< std::string > modelTypes() const
void registerItem(const std::string &label={})
std::vector< std::string > labels() const
void merge(const ItemCatalogue &other)
Adds content of other catalogue to this.
std::unique_ptr< SessionItem > create(const std::string &modelType) const
bool contains(const std::string &modelType) const
Item to carry concrete editable entity (e.g.
The main object representing an editable/displayable/serializable entity.
Vector item with three x,y,z property items.
TEST_F(ItemCatalogueTest, initialState)
const model_type PropertyType
const model_type BaseType
const model_type CompoundItemType
const model_type VectorItemType
materialitems.h Collection of materials to populate MaterialModel.
@ copy
full deep copying with item identifiers regenerated
MVVM_MODEL_EXPORT std::unique_ptr< ItemCatalogue > CreateStandardItemCatalogue()
Creates a catalog of items supported by SessionModel out-of-the-box.