| 439 | } |
| 440 | |
| 441 | void CartesianPlotTest::shiftLeftAutoScale() { |
| 442 | Project project; |
| 443 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 444 | QVERIFY(ws != nullptr); |
| 445 | project.addChild(ws); |
| 446 | |
| 447 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 448 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 449 | QVERIFY(p != nullptr); |
| 450 | ws->addChild(p); |
| 451 | |
| 452 | auto* curve{new XYEquationCurve(QStringLiteral("f(x)"))}; |
| 453 | curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex()); |
| 454 | p->addChild(curve); |
| 455 | |
| 456 | XYEquationCurve::EquationData data; |
| 457 | data.min = QStringLiteral("1"); |
| 458 | data.max = QStringLiteral("2"); |
| 459 | data.count = 1000; |
| 460 | data.expression1 = QStringLiteral("x"); |
| 461 | curve->setEquationData(data); |
| 462 | curve->recalculate(); |
| 463 | |
| 464 | CHECK_RANGE(p, curve, Dimension::X, 1., 2.); |
| 465 | CHECK_RANGE(p, curve, Dimension::Y, 1., 2.); |
| 466 | |
| 467 | p->shiftLeftX(); |
| 468 | |
| 469 | // Autoscale of the y range was done |
| 470 | CHECK_RANGE(p, curve, Dimension::X, 1.1, 2.1); |
| 471 | CHECK_RANGE(p, curve, Dimension::Y, 1.1, 2.); // changed range |
| 472 | } |
| 473 | |
| 474 | void CartesianPlotTest::shiftRightAutoScale() { |
| 475 | Project project; |
nothing calls this directly
no test coverage detected