39 EXPECT_FALSE(model.
data(item, role).isValid());
41 QVariant expected(42.0);
42 auto command = std::make_unique<SetValueCommand>(item, expected, role);
46 EXPECT_TRUE(std::get<bool>(command->result()));
47 EXPECT_EQ(command->isObsolete(),
false);
48 EXPECT_EQ(model.
data(item, role), expected);
52 EXPECT_TRUE(std::get<bool>(command->result()));
53 EXPECT_FALSE(model.
data(item, role).isValid());
54 EXPECT_EQ(command->isObsolete(),
false);
66 QVariant expected(42.0);
67 item->setData(expected, role);
70 auto command = std::make_unique<SetValueCommand>(item, expected, role);
74 EXPECT_FALSE(std::get<bool>(command->result()));
75 EXPECT_EQ(model.
data(item, role), expected);
76 EXPECT_EQ(command->isObsolete(),
true);
79 EXPECT_THROW(command->undo(), std::runtime_error);
The main object representing an editable/displayable/serializable entity.
Main class to hold hierarchy of SessionItem objects.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
Variant data(SessionItem *item, int role) const
Returns the data for given item and role.
const int DATA
main data role
materialitems.h Collection of materials to populate MaterialModel.
TEST_F(SetValueCommandTest, setValueCommand)
Set item value through SetValueCommand command.