55 const std::vector<double> expected_values = {1.0, 2.0, 3.0};
56 const std::vector<double> expected_centers = {0.5, 1.5, 2.5};
58 data_item->setValues(expected_values);
60 graph_item->setDataItem(data_item);
61 EXPECT_EQ(viewport_item->graphItems().size(), 1);
64 viewport_item->setViewportToContent();
67 auto xaxis = viewport_item->xAxis();
72 auto yaxis = viewport_item->yAxis();
73 auto [expected_amin, expected_amax] =
74 std::minmax_element(std::begin(expected_values), std::end(expected_values));
89 EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
90 EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
91 EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
92 EXPECT_CALL(widget, onItemInserted(viewport_item, expected_tagrow)).Times(1);
93 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
108 const std::vector<double> expected_values = {1.0, 2.0, 3.0};
109 const std::vector<double> expected_centers = {0.5, 1.5, 2.5};
111 data_item->setValues(expected_values);
118 EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
119 EXPECT_CALL(widget, onPropertyChange(_, _)).Times(0);
120 EXPECT_CALL(widget, onChildPropertyChange(graph_item,
GraphItem::P_LINK)).Times(1);
121 EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
122 EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
125 graph_item->setDataItem(data_item);
138 const std::vector<double> expected_values = {1.0, 2.0, 3.0};
139 const std::vector<double> expected_centers = {0.5, 1.5, 2.5};
141 data_item->setValues(expected_values);
143 graph_item->setDataItem(data_item);
144 EXPECT_EQ(viewport_item->graphItems().size(), 1);
147 const double bottom{0.1}, top{0.1};
148 viewport_item->setViewportToContent(0.0, top, 0.0, bottom);
151 auto xaxis = viewport_item->xAxis();
156 auto yaxis = viewport_item->yAxis();
157 auto [expected_amin, expected_amax] =
158 std::minmax_element(std::begin(expected_values), std::end(expected_values));
160 double expected_ymin = *expected_amin - (*expected_amax - *expected_amin) * bottom;
161 double expected_ymax = *expected_amax + (*expected_amax - *expected_amin) * top;
static const std::string P_MAX
static const std::string P_MIN
Represents one-dimensional data (axis and values).
Item to represent fixed bin axis.
One-dimensional graph representation of Data1DItem.
static const std::string P_LINK
2D viewport specialized for showing multiple GraphItem's.
std::vector< GraphItem * > graphItems() const
Returns the selected graph items.
model_type modelType() const
Returns item's model 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.
ViewportAxisItem * xAxis() const
static const std::string T_ITEMS
ViewportAxisItem * yAxis() const
TEST_F(GraphViewportItemTest, initialState)
Initial state.
const model_type ViewportAxisItemType
materialitems.h Collection of materials to populate MaterialModel.