MCPcopy Create free account
hub / github.com/KDE/labplot / mouseWheelTanCurveApplyToAllX

Method mouseWheelTanCurveApplyToAllX

tests/multirange/MultiRangeTest2.cpp:126–176  ·  view source on GitHub ↗

! * \brief MultiRangeTest2::mouseWheelXAxisApplyToAllX * If applied to all x is activated, using the mousewheel on a * selected axis should also execute the mousewheel on other plots * This time the second x axis is used. In the second plot no second x axis is used * so check that application does not crash */

Source from the content-addressed store, hash-verified

124 * so check that application does not crash
125 */
126void MultiRangeTest2::mouseWheelTanCurveApplyToAllX() {
127 LOAD_PROJECT
128
129 QCOMPARE(w->cartesianPlotActionMode(), Worksheet::CartesianPlotActionMode::ApplyActionToAllX);
130
131 CHECK_RANGE(p1, sinCurve, Dimension::X, 0., 1.);
132 CHECK_RANGE(p1, sinCurve, Dimension::Y, -1., 1.);
133 CHECK_RANGE(p1, tanCurve, Dimension::X, 0., 1.);
134 CHECK_RANGE(p1, tanCurve, Dimension::Y, -250., 250.); // zoom
135 CHECK_RANGE(p1, logCurve, Dimension::X, 0., 100.);
136 CHECK_RANGE(p1, logCurve, Dimension::Y, -10., 6.);
137 CHECK_RANGE(p2, horAxisP1, Dimension::X, 0., 1.);
138 CHECK_RANGE(p2, cosCurve, Dimension::X, 0., 1.);
139 CHECK_RANGE(p2, cosCurve, Dimension::Y, -1., 1.);
140
141 tanCurve->setSelected(true); // seems not to work
142 view->m_selectedElement = tanCurve;
143
144 int counter = 0;
145 connect(p1,
146 &CartesianPlot::wheelEventSignal,
147 [&counter](const QPointF& relScenePos, int delta, int xIndex, int yIndex, bool considerDimension, Dimension dim) {
148 Q_UNUSED(yIndex);
149 Q_UNUSED(dim);
150 QCOMPARE(relScenePos.x(), 0.5);
151 QCOMPARE(relScenePos.y(), 0.5);
152 QCOMPARE(delta, 10);
153 QCOMPARE(xIndex, 0); // tan curve has xIndex 0
154 QCOMPARE(considerDimension, false);
155 counter++;
156 });
157
158 QGraphicsSceneWheelEvent event;
159 event.setDelta(10);
160 event.setPos(QPointF(p1->dataRect().center().x(), p1->dataRect().center().y()));
161 p1->d_func()->wheelEvent(&event);
162
163 QCOMPARE(counter, 1);
164
165 // All x ranges are zoomed, for plot 1 and plot 2
166 CHECK_RANGE(p1, sinCurve, Dimension::X, 0.1, 0.9); // zoom
167 CHECK_RANGE(p1, sinCurve, Dimension::Y, -1., 1.);
168 CHECK_RANGE(p1, tanCurve, Dimension::X, 0.1, 0.9); // zoom
169 // zoomed in, because with scrolling both axes are scrolled
170 CHECK_RANGE(p1, tanCurve, Dimension::Y, -200., 200.);
171 CHECK_RANGE(p1, logCurve, Dimension::X, 10., 90.); // zoom
172 CHECK_RANGE(p1, logCurve, Dimension::Y, -10., 6.);
173 CHECK_RANGE(p2, horAxisP1, Dimension::X, 0.1, 0.9);
174 CHECK_RANGE(p2, cosCurve, Dimension::X, 0.1, 0.9);
175 CHECK_RANGE(p2, cosCurve, Dimension::Y, -1., 1.);
176}
177
178void MultiRangeTest2::mouseWheelXAxisApplyToSelected() {
179 LOAD_PROJECT

Callers

nothing calls this directly

Calls 8

xMethod · 0.80
dataRectMethod · 0.80
QPointFClass · 0.50
setSelectedMethod · 0.45
yMethod · 0.45
centerMethod · 0.45
wheelEventMethod · 0.45

Tested by

no test coverage detected