38     auto item = std::make_unique<SessionItem>();
 
   39     EXPECT_THROW(item->mapper(), std::runtime_error);
 
   44     EXPECT_NO_THROW(item2->mapper());
 
   56     auto expected_item = item;
 
   57     EXPECT_CALL(widget, onItemDestroy(expected_item)).Times(1);
 
   58     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
   59     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
   60     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
   61     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
   62     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
   63     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
   79     auto expected_item = item;
 
   80     EXPECT_CALL(widget, onDataChange(expected_item, expected_role)).Times(1);
 
   81     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
   82     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
   83     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
   84     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
   85     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  100     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  101     EXPECT_CALL(widget, onDataChange(_, _)).Times(1);
 
  102     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
  103     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
  104     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
  105     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
  106     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  122     item->mapper()->setActive(
false);
 
  124     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  125     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
  126     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
  127     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
  128     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
  129     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
  130     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  146     item->mapper()->unsubscribe(&widget1);
 
  148     EXPECT_CALL(widget1, onDataChange(_, _)).Times(0);
 
  149     EXPECT_CALL(widget2, onDataChange(_, _)).Times(1);
 
  161     EXPECT_TRUE(item != 
nullptr);
 
  163     auto property = item->addProperty(
"height", 42.0);
 
  167     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  168     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
  169     EXPECT_CALL(widget, onPropertyChange(item, 
"height")).Times(1);
 
  170     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
  171     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
  172     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
  173     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  176     item->setProperty(
"height", 43.0);
 
  177     EXPECT_EQ(item->property<
double>(
"height"), 43.0);
 
  178     EXPECT_EQ(property->data<
double>(), 43.0);
 
  190     auto property = compound2->
addProperty(
"height", 42.0);
 
  194     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  195     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
  196     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
  197     EXPECT_CALL(widget, onChildPropertyChange(compound2, 
"height")).Times(1);
 
  198     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
  199     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
  200     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  203     compound2->setProperty(
"height", 43.0);
 
  204     EXPECT_EQ(compound2->property<
double>(
"height"), 43.0);
 
  205     EXPECT_EQ(property->data<
double>(), 43.0);
 
  218     const TagRow expected_tagrow{
"tag1", 0};
 
  219     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  220     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
  221     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
  222     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
  223     EXPECT_CALL(widget, onItemInserted(compound1, expected_tagrow)).Times(1);
 
  224     EXPECT_CALL(widget, onItemRemoved(_, _)).Times(0);
 
  225     EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
 
  235     const TagRow expected_tagrow = {
"tag1", 0};
 
  244     EXPECT_CALL(widget, onItemDestroy(_)).Times(0);
 
  245     EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
 
  246     EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
 
  247     EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
 
  248     EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
 
  249     EXPECT_CALL(widget, onItemRemoved(compound1, expected_tagrow)).Times(1);
 
  250     EXPECT_CALL(widget, onAboutToRemoveItem(compound1, expected_tagrow)).Times(1);
 
Complex item holding mixed SessionItem types (single properties and other CompountItems).
 
T * addProperty(const std::string &name)
Adds property item of given type.
 
The main object representing an editable/displayable/serializable entity.
 
void registerTag(const TagInfo &tagInfo, bool set_as_default=false)
Registers tag to hold items under given name.
 
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 removeItem(SessionItem *parent, const TagRow &tagrow)
Removes given row from parent.
 
static TagInfo universalTag(std::string name, std::vector< std::string > modelTypes={})
Constructs universal tag intended for unlimited amount of various items.
 
Aggregate to hold (tag, row) information for SessionModel.
 
TEST(ItemMapperTest, initialState)
Check that mapper works only in model context.
 
const int DATA
main data role
 
materialitems.h Collection of materials to populate MaterialModel.