| 518 | } |
| 519 | |
| 520 | void WorksheetElementTest::referenceLineLog10Scaling() { |
| 521 | Project project; |
| 522 | |
| 523 | auto* worksheet = new Worksheet(QStringLiteral("Worksheet")); |
| 524 | project.addChild(worksheet); |
| 525 | |
| 526 | auto* plot = new CartesianPlot(QStringLiteral("plot")); |
| 527 | worksheet->addChild(plot); |
| 528 | plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 529 | plot->setNiceExtend(true); |
| 530 | |
| 531 | const auto& axes = plot->children<Axis>(); |
| 532 | QCOMPARE(axes.length(), 2); |
| 533 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 534 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 535 | auto* xAxis = axes.at(0); |
| 536 | |
| 537 | CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.); |
| 538 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 539 | |
| 540 | plot->setRangeScale(Dimension::X, 0, RangeT::Scale::Log10); |
| 541 | |
| 542 | CHECK_RANGE(plot, xAxis, Dimension::X, 0.01, 1.); |
| 543 | CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.); |
| 544 | |
| 545 | auto* referenceLine = new ReferenceLine(plot, QStringLiteral("TestLine")); |
| 546 | referenceLine->setOrientation(ReferenceLine::Orientation::Horizontal); |
| 547 | plot->addChild(referenceLine); |
| 548 | referenceLine->retransform(); |
| 549 | |
| 550 | const auto& rect = plot->dataRect(); |
| 551 | |
| 552 | QCOMPARE(qAbs(referenceLine->d_func()->length), rect.width()); |
| 553 | QCOMPARE(referenceLine->d_func()->pos().x(), rect.center().x()); |
| 554 | } |
| 555 | |
| 556 | void WorksheetElementTest::referenceLineSquareScaling() { |
| 557 | Project project; |
nothing calls this directly
no test coverage detected