MCPcopy Create free account
hub / github.com/KDE/labplot / referenceLineInverseScaling

Method referenceLineInverseScaling

tests/backend/Worksheet/WorksheetElementTest.cpp:628–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628void 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 { \

Callers

nothing calls this directly

Calls 12

setNiceExtendMethod · 0.80
lengthMethod · 0.80
dataRectMethod · 0.80
xMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
nameMethod · 0.45
setRangeScaleMethod · 0.45
setOrientationMethod · 0.45
retransformMethod · 0.45
widthMethod · 0.45
centerMethod · 0.45

Tested by

no test coverage detected