MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / test_undo_basic

Function test_undo_basic

src/text_input.rs:3603–3622  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 2

push_undoMethod · 0.80
insert_textMethod · 0.80

Tested by

no test coverage detected