| 472 | } |
| 473 | |
| 474 | void 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 | |
| 507 | void CartesianPlotTest::shiftUpAutoScale() { |
| 508 | Project project; |
nothing calls this directly
no test coverage detected