diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 10:32:07 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 10:32:07 +0100 |
commit | 273410ba5a5eae4ee9614f76a9c31770b934669a (patch) | |
tree | 53d252b0a92b221ccdf1c9d7d351f0d42ce14c9f /tests | |
parent | 996f7e5142b5055fca4b0fab2929c6082a76e404 (diff) | |
parent | e5354cacd0e85dc8c054179b40fecc2d7d24a8fd (diff) |
Merge pull request #67139 from PucklaMotzer09/insert_caret_at_carets
Add Caret Insert Below and Above shortcuts to TextEdit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scene/test_text_edit.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 4b92b9daff..652cbed6e8 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -3353,7 +3353,7 @@ TEST_CASE("[SceneTree][TextEdit] caret") { memdelete(text_edit); } -TEST_CASE("[SceneTree][TextEdit] muiticaret") { +TEST_CASE("[SceneTree][TextEdit] multicaret") { TextEdit *text_edit = memnew(TextEdit); SceneTree::get_singleton()->get_root()->add_child(text_edit); text_edit->set_multiple_carets_enabled(true); @@ -3443,6 +3443,43 @@ TEST_CASE("[SceneTree][TextEdit] muiticaret") { CHECK(text_edit->get_caret_index_edit_order() == caret_index_get_order); } + SUBCASE("[TextEdit] add caret at carets") { + text_edit->remove_secondary_carets(); + text_edit->set_caret_line(1); + text_edit->set_caret_column(9); + + text_edit->add_caret_at_carets(true); + CHECK(text_edit->get_caret_count() == 2); + CHECK(text_edit->get_caret_line(1) == 2); + CHECK(text_edit->get_caret_column(1) == 4); + + text_edit->add_caret_at_carets(true); + CHECK(text_edit->get_caret_count() == 2); + + text_edit->add_caret_at_carets(false); + CHECK(text_edit->get_caret_count() == 3); + CHECK(text_edit->get_caret_line(2) == 0); + CHECK(text_edit->get_caret_column(2) == 7); + + text_edit->remove_secondary_carets(); + text_edit->set_caret_line(0); + text_edit->set_caret_column(4); + text_edit->select(0, 0, 0, 4); + text_edit->add_caret_at_carets(true); + CHECK(text_edit->get_caret_count() == 2); + CHECK(text_edit->get_selection_from_line(1) == 1); + CHECK(text_edit->get_selection_to_line(1) == 1); + CHECK(text_edit->get_selection_from_column(1) == 0); + CHECK(text_edit->get_selection_to_column(1) == 3); + + text_edit->add_caret_at_carets(true); + CHECK(text_edit->get_caret_count() == 3); + CHECK(text_edit->get_selection_from_line(2) == 2); + CHECK(text_edit->get_selection_to_line(2) == 2); + CHECK(text_edit->get_selection_from_column(2) == 0); + CHECK(text_edit->get_selection_to_column(2) == 4); + } + memdelete(text_edit); } |