62 EXPECT_FALSE(controller.hasChanged());
66 EXPECT_TRUE(controller.hasChanged());
77 EXPECT_FALSE(controller.hasChanged());
80 EXPECT_TRUE(controller.hasChanged());
91 EXPECT_FALSE(controller.hasChanged());
94 EXPECT_TRUE(controller.hasChanged());
102 auto on_change = [&change_count]() { change_count++; };
109 EXPECT_EQ(change_count, 1);
113 EXPECT_EQ(change_count, 1);
121 auto on_change = [&change_count]() { change_count++; };
124 auto controller = std::make_unique<ModelHasChangedController>(&model, on_change);
128 EXPECT_TRUE(controller->hasChanged());
129 EXPECT_EQ(change_count, 1);
134 EXPECT_EQ(change_count, 1);
Tests for ModelHasChangedController class.
~ModelHasChangedControllerTest()
Tracks changes in the model.
bool hasChanged() const
Returns true if the model was changed since last call of resetChanged.
void resetChanged()
Reset has_changed flag.
Item to carry concrete editable entity (e.g.
Main class to hold hierarchy of SessionItem objects.
SessionItem * rootItem() const
Returns root item of the model.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
void clear(std::function< void(SessionItem *)> callback={})
Removes all items from the model.
void removeItem(SessionItem *parent, const TagRow &tagrow)
Removes given row from parent.
TEST_F(ModelHasChangedControllerTest, initialState)
Tests initial state of the controller.
materialitems.h Collection of materials to populate MaterialModel.