()
| 3601 | |
| 3602 | #[test] |
| 3603 | fn test_undo_basic() { |
| 3604 | let mut state = TextEditState::default(); |
| 3605 | state.text = "hello".to_string(); |
| 3606 | state.cursor_pos = 5; |
| 3607 | |
| 3608 | // Push undo, then modify |
| 3609 | state.push_undo(UndoActionKind::Paste); |
| 3610 | state.insert_text(" world", None); |
| 3611 | assert_eq!(state.text, "hello world"); |
| 3612 | |
| 3613 | // Undo should restore |
| 3614 | assert!(state.undo()); |
| 3615 | assert_eq!(state.text, "hello"); |
| 3616 | assert_eq!(state.cursor_pos, 5); |
| 3617 | |
| 3618 | // Redo should restore the edit |
| 3619 | assert!(state.redo()); |
| 3620 | assert_eq!(state.text, "hello world"); |
| 3621 | assert_eq!(state.cursor_pos, 11); |
| 3622 | } |
| 3623 | |
| 3624 | #[test] |
| 3625 | fn test_undo_grouping_insert_char() { |
nothing calls this directly
no test coverage detected