| 505 | } |
| 506 | |
| 507 | void 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 | |
| 540 | void CartesianPlotTest::shiftDownAutoScale() { |
| 541 | Project project; |
nothing calls this directly
no test coverage detected