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

Method testReferenceRangeDuplicate

tests/backend/Worksheet/WorksheetElementTest.cpp:118–137  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

116 * \brief create and add a new ReferenceRange, duplicate it and check the number of children
117 */
118void WorksheetElementTest::testReferenceRangeDuplicate() {
119 Project project;
120 auto* ws = new Worksheet(QStringLiteral("worksheet"));
121 project.addChild(ws);
122
123 auto* plot = new CartesianPlot(QStringLiteral("plot"));
124 ws->addChild(plot);
125
126 auto* range = new ReferenceRange(plot, QStringLiteral("range"));
127 plot->addChild(range);
128
129 range->duplicate();
130
131 auto children = plot->children<ReferenceRange>();
132 QCOMPARE(children.size(), 2);
133
134 project.undoStack()->undo();
135 children = plot->children<ReferenceRange>();
136 QCOMPARE(children.size(), 1);
137}
138
139void WorksheetElementTest::referenceRangeXMouseMove() {
140 SETUP_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