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

Method referenceLineSqrtScaling

tests/backend/Worksheet/WorksheetElementTest.cpp:592–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592void WorksheetElementTest::referenceLineSqrtScaling() {
593 Project project;
594
595 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
596 project.addChild(worksheet);
597
598 auto* plot = new CartesianPlot(QStringLiteral("plot"));
599 worksheet->addChild(plot);
600 plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
601 plot->setNiceExtend(true);
602
603 const auto& axes = plot->children<Axis>();
604 QCOMPARE(axes.length(), 2);
605 QCOMPARE(axes.at(0)->name(), QStringLiteral("x"));
606 QCOMPARE(axes.at(1)->name(), QStringLiteral("y"));
607 auto* xAxis = axes.at(0);
608
609 CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.);
610 CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.);
611
612 plot->setRangeScale(Dimension::X, 0, RangeT::Scale::Sqrt);
613
614 CHECK_RANGE(plot, xAxis, Dimension::X, 0., 1.);
615 CHECK_RANGE(plot, xAxis, Dimension::Y, 0., 1.);
616
617 auto* referenceLine = new ReferenceLine(plot, QStringLiteral("TestLine"));
618 referenceLine->setOrientation(ReferenceLine::Orientation::Horizontal);
619 plot->addChild(referenceLine);
620 referenceLine->retransform();
621
622 const auto& rect = plot->dataRect();
623
624 QCOMPARE(qAbs(referenceLine->d_func()->length), rect.width());
625 QCOMPARE(referenceLine->d_func()->pos().x(), rect.center().x());
626}
627
628void WorksheetElementTest::referenceLineInverseScaling() {
629 Project project;

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