! * \brief create and add a new ReferenceLine, duplicate it and check the number of children */
| 461 | * \brief create and add a new ReferenceLine, duplicate it and check the number of children |
| 462 | */ |
| 463 | void 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 | |
| 484 | void WorksheetElementTest::referenceLineLinearScaling() { |
| 485 | Project project; |