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

Method shiftDownAutoScale

tests/cartesianplot/CartesianPlotTest.cpp:540–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540void CartesianPlotTest::shiftDownAutoScale() {
541 Project project;
542 auto* ws = new Worksheet(QStringLiteral("worksheet"));
543 QVERIFY(ws != nullptr);
544 project.addChild(ws);
545
546 auto* p = new CartesianPlot(QStringLiteral("plot"));
547 p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
548 QVERIFY(p != nullptr);
549 ws->addChild(p);
550
551 auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))};
552 curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
553 p->addChild(curve);
554
555 XYEquationCurve::EquationData data;
556 data.min = QStringLiteral("1");
557 data.max = QStringLiteral("2");
558 data.count = 1000;
559 data.expression1 = QStringLiteral("x");
560 curve->setEquationData(data);
561 curve->recalculate();
562
563 CHECK_RANGE(p, curve, Dimension::X, 1., 2.);
564 CHECK_RANGE(p, curve, Dimension::Y, 1., 2.);
565
566 p->shiftDownY();
567
568 // Autoscale of the y range was done
569 CHECK_RANGE(p, curve, Dimension::X, 1.1, 2.);
570 CHECK_RANGE(p, curve, Dimension::Y, 1.1, 2.1); // changed range
571}
572
573void CartesianPlotTest::rangeFormatYDataChanged() {
574 Project project;

Callers

nothing calls this directly

Calls 7

setEquationDataMethod · 0.80
shiftDownYMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
recalculateMethod · 0.45

Tested by

no test coverage detected