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

Method referenceLineLinearScaling

tests/backend/Worksheet/WorksheetElementTest.cpp:484–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484void 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
520void WorksheetElementTest::referenceLineLog10Scaling() {
521 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