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

Method mouseWheelXAxisApplyToAllX

tests/multirange/MultiRangeTest2.cpp:69–117  ·  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 */

Source from the content-addressed store, hash-verified

67 * selected axis should also execute the mousewheel on other plots
68 */
69void MultiRangeTest2::mouseWheelXAxisApplyToAllX() {
70 LOAD_PROJECT
71
72 QCOMPARE(w->cartesianPlotActionMode(), Worksheet::CartesianPlotActionMode::ApplyActionToAllX);
73
74 CHECK_RANGE(p1, sinCurve, Dimension::X, 0., 1.);
75 CHECK_RANGE(p1, sinCurve, Dimension::Y, -1., 1.);
76 CHECK_RANGE(p1, tanCurve, Dimension::X, 0., 1.);
77 CHECK_RANGE(p1, tanCurve, Dimension::Y, -250., 250.); // zoom
78 CHECK_RANGE(p1, logCurve, Dimension::X, 0., 100.);
79 CHECK_RANGE(p1, logCurve, Dimension::Y, -10., 6.);
80 CHECK_RANGE(p2, horAxisP1, Dimension::X, 0., 1.);
81 CHECK_RANGE(p2, cosCurve, Dimension::X, 0., 1.);
82 CHECK_RANGE(p2, cosCurve, Dimension::Y, -1., 1.);
83
84 horAxisP1->setSelected(true); // seems not to work
85 view->m_selectedElement = horAxisP1;
86
87 int counter = 0;
88 connect(p1,
89 &CartesianPlot::wheelEventSignal,
90 [&counter](const QPointF& relScenePos, int delta, int xIndex, int /*yIndex*/, bool considerDimension, Dimension dim) {
91 QCOMPARE(delta, 10);
92 QCOMPARE(xIndex, 0); // x Range of horAxisP1
93 QCOMPARE(relScenePos.x(), 0.5);
94 QCOMPARE(relScenePos.y(), 0.5);
95 QCOMPARE(considerDimension, true);
96 QCOMPARE(dim, Dimension::X);
97 counter++;
98 });
99
100 QGraphicsSceneWheelEvent event;
101 event.setDelta(10);
102 event.setPos(QPointF(p1->dataRect().center().x(), p1->dataRect().center().y()));
103 p1->d_func()->wheelEvent(&event);
104
105 QCOMPARE(counter, 1);
106
107 // All x ranges are zoomed, for plot 1 and plot 2
108 CHECK_RANGE(p1, sinCurve, Dimension::X, 0.1, 0.9); // zoom
109 CHECK_RANGE(p1, sinCurve, Dimension::Y, -1., 1.);
110 CHECK_RANGE(p1, tanCurve, Dimension::X, 0.1, 0.9); // zoom
111 CHECK_RANGE(p1, tanCurve, Dimension::Y, -250., 250.);
112 CHECK_RANGE(p1, logCurve, Dimension::X, 10., 90.); // zoom
113 CHECK_RANGE(p1, logCurve, Dimension::Y, -10., 6.);
114 CHECK_RANGE(p2, horAxisP1, Dimension::X, 0.1, 0.9);
115 CHECK_RANGE(p2, cosCurve, Dimension::X, 0.1, 0.9);
116 CHECK_RANGE(p2, cosCurve, Dimension::Y, -1., 1.);
117}
118
119/*!
120 * \brief MultiRangeTest2::mouseWheelXAxisApplyToAllX

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