41 EXPECT_EQ(item.
binCenters(), std::vector<double>());
42 EXPECT_EQ(item.
binValues(), std::vector<double>());
43 EXPECT_EQ(item.
binErrors(), std::vector<double>());
59 std::vector<double> expected_centers = {0.5, 1.5, 2.5, 3.5, 4.5};
60 EXPECT_EQ(item.
binCenters(), expected_centers);
61 std::vector<double> expected_values = std::vector<double>(expected_centers.size(), 0.0);
62 EXPECT_EQ(item.
binValues(), expected_values);
85 std::vector<double> expected_centers = {0.5, 1.5, 2.5, 3.5, 4.5};
86 EXPECT_EQ(item.
binCenters(), expected_centers);
87 std::vector<double> expected_values = std::vector<double>(expected_centers.size(), 0.0);
88 EXPECT_EQ(item.
binValues(), expected_values);
104 std::vector<double> expected_centers = {0.5, 1.5, 2.5, 3.5, 4.5};
105 EXPECT_EQ(dataItem->binCenters(), expected_centers);
106 std::vector<double> expected_values = std::vector<double>(expected_centers.size(), 0.0);
107 EXPECT_EQ(dataItem->binValues(), expected_values);
124 std::vector<double> expected_centers = {0.5, 1.5, 2.5, 3.5, 4.5};
125 EXPECT_EQ(dataItem->binCenters(), expected_centers);
126 std::vector<double> expected_values = std::vector<double>(expected_centers.size(), 0.0);
127 EXPECT_TRUE(dataItem->binValues().empty());
137 std::vector<double> expected_content = {1.0, 2.0, 3.0};
138 EXPECT_THROW(item.
setValues(expected_content), std::runtime_error);
142 EXPECT_EQ(item.
binValues(), expected_content);
152 std::vector<double> expected_errors = {10.0, 20.0, 30.0};
154 EXPECT_THROW(item.
setErrors(expected_errors), std::runtime_error);
159 EXPECT_EQ(item.
binErrors(), expected_errors);
174 EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
175 EXPECT_CALL(widget, onPropertyChange(item, expected_value_tag)).Times(1);
176 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(2);
177 EXPECT_CALL(widget, onItemInserted(item, expected_axis_tagrow)).Times(1);
178 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
194 EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
196 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
197 EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
198 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
201 item->setValues(std::vector<double>{1.0, 2.0, 3.0});
Represents one-dimensional data (axis and values).
static const std::string T_AXIS
std::vector< double > binValues() const
Returns values stored in bins.
void setValues(const std::vector< double > &data)
Sets internal data buffer to given data.
std::vector< double > binCenters() const
Sets axis. Bin content will be set to zero.
T * setAxis(Args &&... args)
Inserts axis of given type.
static const std::string P_VALUES
void setErrors(const std::vector< double > &errors)
Sets errors on values in bins.
std::vector< double > binErrors() const
Returns value errors stored in bins.
Item to represent fixed bin axis.
SessionItem * getItem(const std::string &tag, int row=0) const
Returns item at given row of given tag.
bool hasData(int role=ItemDataRole::DATA) const
Returns true if item has data on board with given role.
T * item(const std::string &tag) const
Returns first item under given tag casted to a specified type.
Main class to hold hierarchy of SessionItem objects.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
Aggregate to hold (tag, row) information for SessionModel.
TEST_F(Data1DItemTest, initialState)
Initial state.
materialitems.h Collection of materials to populate MaterialModel.