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

Method shiftUpAutoScale

tests/cartesianplot/CartesianPlotTest.cpp:507–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void CartesianPlotTest::shiftUpAutoScale() {
508 Project project;
509 auto* ws = new Worksheet(QStringLiteral("worksheet"));
510 QVERIFY(ws != nullptr);
511 project.addChild(ws);
512
513 auto* p = new CartesianPlot(QStringLiteral("plot"));
514 p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
515 QVERIFY(p != nullptr);
516 ws->addChild(p);
517
518 auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))};
519 curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
520 p->addChild(curve);
521
522 XYEquationCurve::EquationData data;
523 data.min = QStringLiteral("1");
524 data.max = QStringLiteral("2");
525 data.count = 1000;
526 data.expression1 = QStringLiteral("x");
527 curve->setEquationData(data);
528 curve->recalculate();
529
530 CHECK_RANGE(p, curve, Dimension::X, 1., 2.);
531 CHECK_RANGE(p, curve, Dimension::Y, 1., 2.);
532
533 p->shiftUpY();
534
535 // Autoscale of the y range was done
536 CHECK_RANGE(p, curve, Dimension::X, 1., 1.9);
537 CHECK_RANGE(p, curve, Dimension::Y, 0.9, 1.9); // changed range
538}
539
540void CartesianPlotTest::shiftDownAutoScale() {
541 Project project;

Callers

nothing calls this directly

Calls 7

setEquationDataMethod · 0.80
shiftUpYMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
recalculateMethod · 0.45

Tested by

no test coverage detected