53     EXPECT_FALSE(layer->data<QVariant>().isValid());
 
   66     EXPECT_EQ(viewModel.rowCount(), 1);
 
   67     EXPECT_EQ(viewModel.columnCount(), 2);
 
   70     QModelIndex layerIndex = viewModel.index(0, 0);
 
   71     auto viewItem = 
dynamic_cast<ViewLabelItem*
>(viewModel.itemFromIndex(layerIndex));
 
   72     EXPECT_TRUE(viewItem != 
nullptr);
 
   73     EXPECT_EQ(viewItem->item(), layerItem);
 
   76     EXPECT_EQ(viewModel.rowCount(layerIndex), 2);
 
   77     EXPECT_EQ(viewModel.columnCount(layerIndex), 2);
 
   80     QModelIndex thicknessLabelIndex = viewModel.index(0, 0, layerIndex);
 
   81     auto thicknessLabelView =
 
   82         dynamic_cast<ViewLabelItem*
>(viewModel.itemFromIndex(thicknessLabelIndex));
 
   83     EXPECT_TRUE(thicknessLabelView != 
nullptr);
 
   85     QModelIndex thicknessValueIndex = viewModel.index(0, 1, layerIndex);
 
   86     auto thicknessValueView =
 
   87         dynamic_cast<ViewDataItem*
>(viewModel.itemFromIndex(thicknessValueIndex));
 
   88     EXPECT_TRUE(thicknessValueView != 
nullptr);
 
  107     QModelIndex layerIndex = viewModel.index(0, 0);
 
  108     QModelIndex thicknessIndex = viewModel.index(0, 1, layerIndex);
 
  110     QSignalSpy spyDataChanged(&viewModel, &DefaultViewModel::dataChanged);
 
  113     EXPECT_EQ(spyDataChanged.count(), 1);
 
  116     QList<QVariant> arguments = spyDataChanged.takeFirst();
 
  117     EXPECT_EQ(arguments.size(), 3); 
 
  118     EXPECT_EQ(arguments.at(0).value<QModelIndex>(), thicknessIndex);
 
  119     EXPECT_EQ(arguments.at(1).value<QModelIndex>(), thicknessIndex);
 
  120     QVector<int> expectedRoles = {Qt::DisplayRole, Qt::EditRole};
 
  121     EXPECT_EQ(arguments.at(2).value<QVector<int>>(), expectedRoles);
 
  136     EXPECT_EQ(layer1->displayName(), 
"Layer1");
 
  146     viewModel.setRootSessionItem(layer);
 
  148     EXPECT_EQ(viewModel.rowCount(QModelIndex()), 2);
 
  149     EXPECT_EQ(viewModel.columnCount(QModelIndex()), 2);
 
  152     QModelIndex thicknessIndex = viewModel.index(0, 0, QModelIndex());
 
  153     EXPECT_EQ(viewModel.sessionItemFromIndex(thicknessIndex),
 
TEST_F(ToyLayerItemTest, initialState)
Initial state.
std::string displayName() const override
Returns display name.
View model to show content of SessionModel in Qt widgets: two column tree with label/data.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
Represents data role of SessionItem in any cell of Qt's trees and tables.
Represents display name of SessionItem in any cell of Qt's trees and tables.
Represents a layer, with thickness and color, and possibly populated with particles.
static const std::string T_PARTICLES
static const std::string P_COLOR
static const std::string P_THICKNESS
Represents multilayer with collection of layers.
Tests for toy Layer in the context of model and view model.
MVVM_MODEL_EXPORT bool IsSinglePropertyTag(const SessionItem &item, const std::string &tag)
Returns true if given item has registered tag, and it belongs to single property.
materialitems.h Collection of materials to populate MaterialModel.
const ModelView::model_type LayerItemType