35 const std::string
name(
"tag");
39 EXPECT_TRUE(tag.
empty());
41 EXPECT_EQ(tag.
items(), std::vector<SessionItem*>());
48 const std::string tag_name(
"tag");
61 EXPECT_FALSE(tag.
empty());
62 std::vector<SessionItem*> expected = {child1, child2};
63 EXPECT_EQ(tag.
items(), expected);
68 expected = {child3, child1, child2};
69 EXPECT_EQ(tag.
items(), expected);
74 expected = {child3, child4, child1, child2};
75 EXPECT_EQ(tag.
items(), expected);
80 expected = {child3, child4, child1, child2, child5};
81 EXPECT_EQ(tag.
items(), expected);
86 EXPECT_EQ(tag.
items(), expected);
94 const std::string tag_name(
"tag");
95 const std::vector<std::string> model_types = {
"model_a"};
106 std::vector<SessionItem*> expected = {child1};
107 EXPECT_EQ(tag.
items(), expected);
114 const std::string
name(
"tag");
115 const std::string property_type(
"Property");
130 std::vector<SessionItem*> expected = {child1};
131 EXPECT_EQ(tag.
items(), expected);
138 const std::string tag_name(
"tag");
154 auto child3 = std::make_unique<SessionItem>(
model_type);
162 const std::string tag_name(
"tag");
172 EXPECT_EQ(tag.
itemAt(0), child1);
173 EXPECT_EQ(tag.
itemAt(1), child2);
176 EXPECT_EQ(tag.
itemAt(2),
nullptr);
177 EXPECT_EQ(tag.
itemAt(3),
nullptr);
178 EXPECT_EQ(tag.
itemAt(-1),
nullptr);
185 const std::string tag_name(
"tag");
191 EXPECT_EQ(tag.
takeItem(0),
nullptr);
203 EXPECT_EQ(child2, taken2);
207 std::vector<SessionItem*> expected = {child1, child3};
208 EXPECT_EQ(tag.
items(), expected);
211 EXPECT_EQ(tag.
takeItem(-1),
nullptr);
219 const std::string tag_name(
"tag");
241 const std::string tag_name(
"tag");
250 auto child1 = std::make_unique<SessionItem>(
model_type);
261 auto child2 = std::make_unique<SessionItem>(
model_type);
272 const std::string
name(
"tag");
273 const std::string property_type(
"Property");
278 auto child1 = std::make_unique<SessionItem>(property_type);
285 auto child2 = std::make_unique<SessionItem>(property_type);
293 const std::string
name(
"tag");
294 const std::string property_type(
"Property");
304 EXPECT_EQ(tag.
takeItem(0),
nullptr);
Holds collection of SessionItem objects related to the same tag.
bool canInsertItem(const SessionItem *item, int index) const
Returns true if given item can be inserted under given index.
bool insertItem(SessionItem *item, int index)
Inserts item in a vector of children at given index, returns true in the case of success.
std::vector< SessionItem * > items() const
Returns vector of items in this container.
int itemCount() const
Returns number of items in given tag.
int indexOfItem(const SessionItem *item) const
Returns index of item in vector of items.
SessionItem * itemAt(int index) const
Returns item at given index. Returns nullptr if index is invalid.
SessionItem * takeItem(int index)
Removes item at given index and returns it to the user.
bool canTakeItem(int index) const
Returns true if item can be taken.
std::string name() const
Returns the name of SessionItemTag.
The main object representing an editable/displayable/serializable entity.
static TagInfo universalTag(std::string name, std::vector< std::string > modelTypes={})
Constructs universal tag intended for unlimited amount of various items.
static TagInfo propertyTag(std::string name, std::string model_type)
Constructs tag intended for single property.
Tests for TestSessionItemContainer class.
~SessionItemContainerTest()
materialitems.h Collection of materials to populate MaterialModel.
QString const & name(EShape k)
TEST_F(SessionItemContainerTest, initialState)
Initial state of emty SessionItemTag.