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

Method testReferenceLineDuplicate

tests/backend/Worksheet/WorksheetElementTest.cpp:463–482  ·  view source on GitHub ↗

! * \brief create and add a new ReferenceLine, duplicate it and check the number of children */

Source from the content-addressed store, hash-verified

461 * \brief create and add a new ReferenceLine, duplicate it and check the number of children
462 */
463void WorksheetElementTest::testReferenceLineDuplicate() {
464 Project project;
465 auto* ws = new Worksheet(QStringLiteral("worksheet"));
466 project.addChild(ws);
467
468 auto* plot = new CartesianPlot(QStringLiteral("plot"));
469 ws->addChild(plot);
470
471 auto* line = new ReferenceLine(plot, QStringLiteral("line"));
472 plot->addChild(line);
473
474 line->duplicate();
475
476 auto children = plot->children<ReferenceLine>();
477 QCOMPARE(children.size(), 2);
478
479 project.undoStack()->undo();
480 children = plot->children<ReferenceLine>();
481 QCOMPARE(children.size(), 1);
482}
483
484void WorksheetElementTest::referenceLineLinearScaling() {
485 Project project;

Callers

nothing calls this directly

Calls 5

duplicateMethod · 0.80
addChildMethod · 0.45
sizeMethod · 0.45
undoMethod · 0.45
undoStackMethod · 0.45

Tested by

no test coverage detected