42 EXPECT_TRUE(item.
dataItem() ==
nullptr);
43 EXPECT_EQ(item.
binCenters(), std::vector<double>{});
44 EXPECT_EQ(item.
binValues(), std::vector<double>{});
45 EXPECT_EQ(item.
binErrors(), std::vector<double>{});
46 EXPECT_EQ(item.
colorName(), std::string(
"#000000"));
57 graph_item->setDataItem(data_item);
59 EXPECT_EQ(graph_item->dataItem(), data_item);
70 std::vector<double> expected_values = {1.0, 2.0, 3.0};
71 std::vector<double> expected_centers = {0.5, 1.5, 2.5};
73 data_item->setValues(expected_values);
75 graph_item->setDataItem(data_item);
77 EXPECT_EQ(graph_item->
binValues(), expected_values);
78 EXPECT_EQ(graph_item->
binCenters(), expected_centers);
89 std::vector<double> expected_values = {1.0, 2.0, 3.0};
90 std::vector<double> expected_centers = {0.5, 1.5, 2.5};
91 std::vector<double> expected_errors = {0.1, 0.2, 0.3};
93 data_item->setValues(expected_values);
94 data_item->setErrors(expected_errors);
96 graph_item->setDataItem(data_item);
98 EXPECT_EQ(graph_item->
binValues(), expected_values);
99 EXPECT_EQ(graph_item->
binCenters(), expected_centers);
100 EXPECT_EQ(graph_item->
binErrors(), expected_errors);
112 std::vector<double> expected_values = {1.0, 2.0, 3.0};
113 std::vector<double> expected_centers = {0.5, 1.5, 2.5};
115 data_item->setValues(expected_values);
117 graph_item->setDataItem(data_item);
118 EXPECT_EQ(graph_item->dataItem(), data_item);
121 graph_item->setDataItem(
nullptr);
122 EXPECT_TRUE(graph_item->dataItem() ==
nullptr);
123 EXPECT_EQ(graph_item->
binCenters(), std::vector<double>{});
124 EXPECT_EQ(graph_item->
binValues(), std::vector<double>{});
125 EXPECT_EQ(graph_item->
binErrors(), std::vector<double>{});
138 EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
140 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
141 EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
142 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
145 graph_item->setDataItem(data_item);
157 std::vector<double> expected_values = {1.0, 2.0, 3.0};
158 std::vector<double> expected_centers = {0.5, 1.5, 2.5};
160 data_item->setValues(expected_values);
162 graph_item->setDataItem(data_item);
167 EXPECT_EQ(graph_item2->
binValues(), expected_values);
168 EXPECT_EQ(graph_item2->
binCenters(), expected_centers);
176 EXPECT_EQ(item.
colorName(), std::string(
"#66cdaa"));
Represents one-dimensional data (axis and values).
std::vector< double > binValues() const
Returns values stored in bins.
std::vector< double > binCenters() const
Sets axis. Bin content will be set to zero.
std::vector< double > binErrors() const
Returns value errors stored in bins.
Item to represent fixed bin axis.
One-dimensional graph representation of Data1DItem.
std::string colorName() const
Returns color name in #RRGGBB format.
std::vector< double > binValues() const
Data1DItem * dataItem() const
Returns data item linked to the given GraphItem.
PenItem * penItem() const
std::vector< double > binCenters() const
void setFromGraphItem(const GraphItem *graph_item)
Update item from the content of given graph.
void setNamedColor(const std::string &named_color)
Sets named color following schema from https://www.w3.org/TR/css-color-3/#svg-color.
static const std::string P_LINK
std::vector< double > binErrors() const
static const std::string P_COLOR
T property(const std::string &tag) const
Returns data stored in property item.
void setProperty(const std::string &tag, const T &value)
Sets value to property item.
Main class to hold hierarchy of SessionItem objects.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
TEST_F(GraphItemTest, initialState)
Initial state.
materialitems.h Collection of materials to populate MaterialModel.
std::vector< double > binValues(const QCPGraph *graph)
Returns vector representing y-values on QCPgraph.
std::vector< double > binErrors(const QCPGraph *graph)
Returns vector representing bin errors of QCPGraph.