40 EXPECT_EQ(item.
xAxis(),
nullptr);
41 EXPECT_EQ(item.
yAxis(),
nullptr);
42 EXPECT_EQ(item.
content(), std::vector<double>());
44 EXPECT_TRUE(item.
data<std::vector<double>>().empty());
53 const int nx = 5, ny = 3;
62 EXPECT_EQ(values.size(), nx * ny);
63 EXPECT_EQ(std::accumulate(values.begin(), values.end(), 0), 0.0);
73 std::vector<double> expected_content = {1.0, 2.0};
74 EXPECT_THROW(item.
setContent(expected_content), std::runtime_error);
76 const int nx = 1, ny = 2;
80 EXPECT_EQ(item.
content(), expected_content);
95 EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
96 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
97 EXPECT_CALL(widget, onItemInserted(item, _)).Times(2);
98 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
115 EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
116 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
117 EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
118 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
121 item->setContent(std::vector<double>{1.0, 2.0, 3.0});
Represents two-dimensional data (axes definition and 2d array of values).
static const std::string T_XAXIS
BinnedAxisItem * xAxis() const
Returns x-axis (nullptr if it doesn't exist).
BinnedAxisItem * yAxis() const
Returns y-axis (nullptr if it doesn't exist).
static const std::string T_YAXIS
void setAxes(std::unique_ptr< BinnedAxisItem > x_axis, std::unique_ptr< BinnedAxisItem > y_axis)
Sets axes and put data points to zero.
std::vector< double > content() const
Returns 2d vector representing 2d data.
void setContent(const std::vector< double > &data)
Item to represent fixed bin axis.
static std::unique_ptr< FixedBinAxisItem > create(int nbins, double xmin, double xmax)
bool hasData(int role=ItemDataRole::DATA) const
Returns true if item has data on board with given role.
T data(int role=ItemDataRole::DATA) const
Returns data of given type T for 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.
TEST_F(Data2DItemTest, initialState)
Initial state.
const int DATA
main data role
materialitems.h Collection of materials to populate MaterialModel.