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

Method zoomXSelection_AllRanges

tests/multirange/MultiRangeTest.cpp:102–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100// ZOOM SELECTION
101
102void MultiRangeTest::zoomXSelection_AllRanges() {
103 LOAD_PROJECT
104 auto refValuesAxis1 = vertAxisP1->tickLabelValues();
105 auto refValuesAxis2 = vertAxis2P1->tickLabelValues();
106 auto refValuesAxis3 = vertAxis3P1->tickLabelValues();
107 w->setCartesianPlotActionMode(Worksheet::CartesianPlotActionMode::ApplyActionToSelection);
108 horAxisP1->setSelected(true);
109 SET_CARTESIAN_MOUSE_MODE(CartesianPlot::MouseMode::ZoomXSelection)
110
111 // select range with mouse
112 p1->mousePressZoomSelectionMode(QPointF(0.2, -150), -1);
113 p1->mouseMoveZoomSelectionMode(QPointF(0.6, 100), -1);
114 p1->mouseReleaseZoomSelectionMode(-1);
115
116 // DEBUG_RANGE(p1, sinCurve)
117 // DEBUG_RANGE(p1, tanCurve)
118 // DEBUG_RANGE(p1, logCurve)
119
120 CHECK_RANGE(p1, sinCurve, Dimension::X, .2, .6); // zoom
121 CHECK_RANGE(p1, sinCurve, Dimension::Y, -1., 1.);
122 CHECK_RANGE(p1, tanCurve, Dimension::X, .2, .6); // zoom
123 CHECK_RANGE(p1, tanCurve, Dimension::Y, -250., 250.);
124 CHECK_RANGE(p1, logCurve, Dimension::X, 20., 60.); // zoom
125 CHECK_RANGE(p1, logCurve, Dimension::Y, -10., 6.); // No niceExtends() done!
126
127 QVector<double> ref = {-250, -150.0, -50, 50, 150, 250};
128 COMPARE_DOUBLE_VECTORS(vertAxisP1->tickLabelValues(), ref);
129 ref = {-1., -0.5, 0.0, 0.5, 1.0};
130 COMPARE_DOUBLE_VECTORS(vertAxis2P1->tickLabelValues(), refValuesAxis2);
131 COMPARE_DOUBLE_VECTORS(vertAxis3P1->tickLabelValues(), refValuesAxis3); // on third axis there is no autoscale, because it uses a different range
132}
133
134void MultiRangeTest::zoomXSelection_SingleRange() {
135 LOAD_PROJECT

Callers

nothing calls this directly

Calls 7

tickLabelValuesMethod · 0.80
QPointFClass · 0.50
setSelectedMethod · 0.45

Tested by

no test coverage detected