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

Method shiftLeftAutoScale

tests/cartesianplot/CartesianPlotTest.cpp:441–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441void CartesianPlotTest::shiftLeftAutoScale() {
442 Project project;
443 auto* ws = new Worksheet(QStringLiteral("worksheet"));
444 QVERIFY(ws != nullptr);
445 project.addChild(ws);
446
447 auto* p = new CartesianPlot(QStringLiteral("plot"));
448 p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
449 QVERIFY(p != nullptr);
450 ws->addChild(p);
451
452 auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))};
453 curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
454 p->addChild(curve);
455
456 XYEquationCurve::EquationData data;
457 data.min = QStringLiteral("1");
458 data.max = QStringLiteral("2");
459 data.count = 1000;
460 data.expression1 = QStringLiteral("x");
461 curve->setEquationData(data);
462 curve->recalculate();
463
464 CHECK_RANGE(p, curve, Dimension::X, 1., 2.);
465 CHECK_RANGE(p, curve, Dimension::Y, 1., 2.);
466
467 p->shiftLeftX();
468
469 // Autoscale of the y range was done
470 CHECK_RANGE(p, curve, Dimension::X, 1.1, 2.1);
471 CHECK_RANGE(p, curve, Dimension::Y, 1.1, 2.); // changed range
472}
473
474void CartesianPlotTest::shiftRightAutoScale() {
475 Project project;

Callers

nothing calls this directly

Calls 7

setEquationDataMethod · 0.80
shiftLeftXMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
recalculateMethod · 0.45

Tested by

no test coverage detected