| 144 | } |
| 145 | |
| 146 | void AbstractAspectTest::testDuplicateChildUndoRedo() { |
| 147 | Project project; |
| 148 | |
| 149 | auto* worksheet = new Worksheet(QStringLiteral("Worksheet")); |
| 150 | project.addChild(worksheet); |
| 151 | |
| 152 | auto* plot = new CartesianPlot(QStringLiteral("plot")); |
| 153 | worksheet->addChild(plot); |
| 154 | |
| 155 | auto* curve = new XYCurve(QStringLiteral("curve")); |
| 156 | plot->addChild(curve); |
| 157 | curve->duplicate(); |
| 158 | |
| 159 | auto* undoStack = project.undoStack(); |
| 160 | |
| 161 | // there should be 4 entries on the undo stack: |
| 162 | // 1. add worksheet |
| 163 | // 2. add plot |
| 164 | // 3. add curve |
| 165 | // 4. duplicate of curve |
| 166 | QCOMPARE(undoStack->count(), 4); |
| 167 | |
| 168 | // the number of entries should stay the same after undo/redo |
| 169 | undoStack->undo(); |
| 170 | QCOMPARE(undoStack->count(), 4); |
| 171 | undoStack->redo(); |
| 172 | QCOMPARE(undoStack->count(), 4); |
| 173 | } |
| 174 | |
| 175 | void AbstractAspectTest::copyPaste() { |
| 176 | Project project; |