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

Method shiftRightAutoScale

tests/cartesianplot/CartesianPlotTest.cpp:474–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474void CartesianPlotTest::shiftRightAutoScale() {
475 Project project;
476 auto* ws = new Worksheet(QStringLiteral("worksheet"));
477 QVERIFY(ws != nullptr);
478 project.addChild(ws);
479
480 auto* p = new CartesianPlot(QStringLiteral("plot"));
481 p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
482 QVERIFY(p != nullptr);
483 ws->addChild(p);
484
485 auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))};
486 curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
487 p->addChild(curve);
488
489 XYEquationCurve::EquationData data;
490 data.min = QStringLiteral("1");
491 data.max = QStringLiteral("2");
492 data.count = 1000;
493 data.expression1 = QStringLiteral("x");
494 curve->setEquationData(data);
495 curve->recalculate();
496
497 CHECK_RANGE(p, curve, Dimension::X, 1., 2.);
498 CHECK_RANGE(p, curve, Dimension::Y, 1., 2.);
499
500 p->shiftRightX();
501
502 // Autoscale of the y range was done
503 CHECK_RANGE(p, curve, Dimension::X, 0.9, 1.9);
504 CHECK_RANGE(p, curve, Dimension::Y, 1., 1.9); // changed range
505}
506
507void CartesianPlotTest::shiftUpAutoScale() {
508 Project project;

Callers

nothing calls this directly

Calls 7

setEquationDataMethod · 0.80
shiftRightXMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
recalculateMethod · 0.45

Tested by

no test coverage detected