| 538 | } |
| 539 | |
| 540 | void 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 | |
| 573 | void CartesianPlotTest::rangeFormatYDataChanged() { |
| 574 | Project project; |
nothing calls this directly
no test coverage detected