20 #include <QJsonObject>
68 const std::vector<double> expected_values = {1.0, 2.0, 3.0};
69 const std::vector<double> expected_centers = {0.5, 1.5, 2.5};
71 data_item->setValues(expected_values);
78 auto graphClone = modelClone->topItem<
GraphItem>();
79 auto dataClone = modelClone->topItem<
Data1DItem>();
82 EXPECT_EQ(graphClone->dataItem(), dataClone);
83 EXPECT_EQ(dataClone->
binCenters(), expected_centers);
84 EXPECT_EQ(dataClone->
binValues(), expected_values);
96 const std::vector<double> expected_values = {1.0, 2.0, 3.0};
97 const std::vector<double> expected_centers = {0.5, 1.5, 2.5};
99 data_item->setValues(expected_values);
101 graph_item->setDataItem(data_item);
102 EXPECT_EQ(viewport_item->graphItems().size(), 1);
105 viewport_item->setViewportToContent();
111 ASSERT_EQ(viewportCopy->graphItems().size(), 1);
112 auto graphClone = viewportCopy->graphItems().at(0);
113 auto dataClone = modelClone->topItem<
Data1DItem>();
116 EXPECT_EQ(graphClone->dataItem(), dataClone);
117 EXPECT_EQ(graphClone->dataItem(), dataClone);
118 EXPECT_EQ(dataClone->binCenters(), expected_centers);
119 EXPECT_EQ(dataClone->binValues(), expected_values);
122 expected_centers[0]);
124 expected_centers[2]);
static const std::string P_MAX
static const std::string P_MIN
Two-dimensional color map representation of Data2DItem.
Container with viewport and collection of ColorMapItem's to plot.
Complex item holding mixed SessionItem types (single properties and other CompountItems).
Simple container to store any type of children.
Represents one-dimensional data (axis and values).
Represents two-dimensional data (axes definition and 2d array of values).
Item to represent fixed bin axis.
One-dimensional graph representation of Data1DItem.
std::vector< double > binValues() const
void setDataItem(const Data1DItem *item)
Sets link to the data item.
std::vector< double > binCenters() const
2D viewport specialized for showing multiple GraphItem's.
Item to store a persistent link to other arbitrary items.
Represents basics settings of QPen.
Item to represent pointwise axis.
Item to carry concrete editable entity (e.g.
The main object representing an editable/displayable/serializable entity.
int childrenCount() const
Returns total number of children in all tags.
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.
Represent text item on plot.
Vector item with three x,y,z property items.
Item to represent viewport axis.
Testing serialization of ToyItems using json converters.
~StandardItemsSerializationTest()
std::unique_ptr< T > CreateCopy(const T &model)
Creates full deep copy of given model. All item's ID will be generated.
std::unique_ptr< T > CreateClone(const T &model)
Creates exact clone of given model. All item's ID will be preserved.
materialitems.h Collection of materials to populate MaterialModel.
TEST_F(StandardItemsSerializationTest, allItems)
Checking that serialization works (not crashing) for all defined standard items.