| 626 | } |
| 627 | |
| 628 | void WorksheetElementTest::referenceLineInverseScaling() { |
| 629 | Project project; |
| 630 | |
| 631 | auto* worksheet = new Worksheet(QStringLiteral("Worksheet")); |
| 632 | project.addChild(worksheet); |
| 633 | |
| 634 | auto* plot = new CartesianPlot(QStringLiteral("plot")); |
| 635 | worksheet->addChild(plot); |
| 636 | plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 637 | plot->setNiceExtend(true); |
| 638 | |
| 639 | const auto& axes = plot->children<Axis>(); |
| 640 | QCOMPARE(axes.length(), 2); |
| 641 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 642 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 643 | auto* xAxis = axes.at(0); |
| 644 | |
| 645 | CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.); |
| 646 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 647 | |
| 648 | plot->setRangeScale(Dimension::X, 0, RangeT::Scale::Sqrt); |
| 649 | |
| 650 | CHECK_RANGE(plot, xAxis, Dimension::X, 0.0, 1.); |
| 651 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 652 | |
| 653 | auto* referenceLine = new ReferenceLine(plot, QStringLiteral("TestLine")); |
| 654 | referenceLine->setOrientation(ReferenceLine::Orientation::Horizontal); |
| 655 | plot->addChild(referenceLine); |
| 656 | referenceLine->retransform(); |
| 657 | |
| 658 | const auto& rect = plot->dataRect(); |
| 659 | |
| 660 | QCOMPARE(qAbs(referenceLine->d_func()->length), rect.width()); |
| 661 | QCOMPARE(referenceLine->d_func()->pos().x(), rect.center().x()); |
| 662 | } |
| 663 | |
| 664 | #define DEBUG_ELEMENT_NAMES(aspectVector) \ |
| 665 | do { \ |
nothing calls this directly
no test coverage detected