diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2022-10-16 15:06:13 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2022-10-16 19:30:03 +0100 |
commit | 4bfb1d953c5960701a07fd0ca15852dd12332359 (patch) | |
tree | e53684ea36d6b465b2a6533ed2589ea37af08c7a /tests | |
parent | 3a59c833f1b7e34ddef57522800288a0dee8562d (diff) |
Fix undo redo not adjusting TextEdit viewport to caret
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scene/test_text_edit.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 3a20ac123b..2ef0a3345f 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -3918,6 +3918,32 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); + // Typing and undo / redo should adjust viewport + text_edit->set_caret_line(0); + text_edit->set_caret_column(0); + text_edit->set_line_as_first_visible(5); + MessageQueue::get_singleton()->flush(); + CHECK(text_edit->get_first_visible_line() == 5); + + SEND_GUI_KEY_EVENT(text_edit, Key::A); + CHECK(text_edit->get_first_visible_line() == 0); + + text_edit->set_line_as_first_visible(5); + MessageQueue::get_singleton()->flush(); + CHECK(text_edit->get_first_visible_line() == 5); + + text_edit->undo(); + MessageQueue::get_singleton()->flush(); + CHECK(text_edit->get_first_visible_line() == 0); + + text_edit->set_line_as_first_visible(5); + MessageQueue::get_singleton()->flush(); + CHECK(text_edit->get_first_visible_line() == 5); + + text_edit->redo(); + MessageQueue::get_singleton()->flush(); + CHECK(text_edit->get_first_visible_line() == 0); + memdelete(text_edit); } |