| 482 | } |
| 483 | |
| 484 | void WorksheetElementTest::referenceLineLinearScaling() { |
| 485 | Project project; |
| 486 | |
| 487 | auto* worksheet = new Worksheet(QStringLiteral("Worksheet")); |
| 488 | project.addChild(worksheet); |
| 489 | |
| 490 | auto* plot = new CartesianPlot(QStringLiteral("plot")); |
| 491 | worksheet->addChild(plot); |
| 492 | plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 493 | plot->setNiceExtend(true); |
| 494 | |
| 495 | const auto& axes = plot->children<Axis>(); |
| 496 | QCOMPARE(axes.length(), 2); |
| 497 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 498 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 499 | auto* xAxis = axes.at(0); |
| 500 | |
| 501 | CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.); |
| 502 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 503 | |
| 504 | plot->setRangeScale(Dimension::X, 0, RangeT::Scale::Linear); |
| 505 | |
| 506 | CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.); |
| 507 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 508 | |
| 509 | auto* referenceLine = new ReferenceLine(plot, QStringLiteral("TestLine")); |
| 510 | referenceLine->setOrientation(ReferenceLine::Orientation::Horizontal); |
| 511 | plot->addChild(referenceLine); |
| 512 | referenceLine->retransform(); |
| 513 | |
| 514 | const auto& rect = plot->dataRect(); |
| 515 | |
| 516 | QCOMPARE(qAbs(referenceLine->d_func()->length), rect.width()); |
| 517 | QCOMPARE(referenceLine->d_func()->pos().x(), rect.center().x()); |
| 518 | } |
| 519 | |
| 520 | void WorksheetElementTest::referenceLineLog10Scaling() { |
| 521 | Project project; |
nothing calls this directly
no test coverage detected