| 1134 | // ── Multiple undos past the beginning don't crash ── |
| 1135 | |
| 1136 | void testExcessiveUndos() { |
| 1137 | int idx = findNode(m_doc->tree, "field_u32"); |
| 1138 | QVERIFY(idx >= 0); |
| 1139 | |
| 1140 | m_ctrl->setNodeValue(idx, 0, "42"); |
| 1141 | QApplication::processEvents(); |
| 1142 | QCOMPARE(m_doc->undoStack.count(), 1); |
| 1143 | |
| 1144 | // Undo once (valid) |
| 1145 | m_doc->undoStack.undo(); |
| 1146 | // Undo 50 more times (all no-ops, should not crash) |
| 1147 | for (int i = 0; i < 50; i++) |
| 1148 | m_doc->undoStack.undo(); |
| 1149 | QApplication::processEvents(); |
| 1150 | |
| 1151 | // Redo 50 times past the end |
| 1152 | m_doc->undoStack.redo(); |
| 1153 | for (int i = 0; i < 50; i++) |
| 1154 | m_doc->undoStack.redo(); |
| 1155 | QApplication::processEvents(); |
| 1156 | } |
| 1157 | }; |
| 1158 | |
| 1159 | QTEST_MAIN(TestValidationController) |
nothing calls this directly
no test coverage detected