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

Method referenceRangeSaveLoad

tests/backend/Worksheet/WorksheetElementTest.cpp:398–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398void WorksheetElementTest::referenceRangeSaveLoad() {
399 QString savePath;
400 {
401 SETUP_PROJECT
402
403 auto* referenceRange = new ReferenceRange(p, QStringLiteral("range"));
404 referenceRange->setOrientation(ReferenceRange::Orientation::Horizontal);
405 p->addChild(referenceRange);
406 referenceRange->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
407 auto pp = referenceRange->position();
408 pp.point = QPointF(0, 0);
409 referenceRange->setPosition(pp);
410 referenceRange->setCoordinateBindingEnabled(true);
411 SAVE_PROJECT("testReferenceRangeSaveLoad");
412 }
413
414 {
415 Project project;
416 QCOMPARE(project.load(savePath), true); // shall not crash
417
418 const auto* ws = project.child<Worksheet>(0);
419 QVERIFY(ws);
420 const auto* p = ws->child<CartesianPlot>(0);
421 QVERIFY(p);
422 const auto* referenceRange = p->child<ReferenceRange>(0);
423 QVERIFY(referenceRange);
424
425 QCOMPARE(referenceRange->positionLogical().x(), 0.5);
426 QCOMPARE(referenceRange->positionLogical().y(), 0.5);
427 QCOMPARE(referenceRange->positionLogicalStart().y(), 0.45);
428 QCOMPARE(referenceRange->positionLogicalEnd().y(), 0.55);
429 CHECK_REFERENCERANGE_RECT(referenceRange, 0., 0.55, 1., 0.45);
430 }
431}
432
433/*!
434 * \brief create and add a new ReferenceLine, undo and redo this step

Callers

nothing calls this directly

Calls 11

positionMethod · 0.80
xMethod · 0.80
QPointFClass · 0.50
setOrientationMethod · 0.45
addChildMethod · 0.45
setPositionMethod · 0.45
loadMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected