summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-04 17:12:06 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-04 17:12:06 +0200
commitf69de1c522df087fed5b7e736a20b09746585f03 (patch)
treefe8e1a122e95f6dfa17830bf0c7893911a6e44d4 /tests
parent82d7531a2e0ab339e060b4eb3910d520b2060c04 (diff)
parent3da4f457d024fec4df086bb66314beb621483d86 (diff)
downloadredot-engine-f69de1c522df087fed5b7e736a20b09746585f03.tar.gz
Merge pull request #96038 from kitbdev/fix-line-edit-caret-word-mode
Fix LineEdit word mode when there are no more words
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_text_edit.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index 69e27fe7a0..46a5046b21 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -4232,6 +4232,18 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
CHECK(text_edit->get_caret_line(0) == 0);
CHECK(text_edit->get_caret_column(0) == 4);
text_edit->remove_secondary_carets();
+
+ // Remove when there are no words, only symbols.
+ text_edit->set_text("#{}");
+ text_edit->set_caret_line(0);
+ text_edit->set_caret_column(3);
+
+ SEND_GUI_ACTION("ui_text_backspace_word");
+ CHECK(text_edit->get_viewport()->is_input_handled());
+ CHECK_FALSE(text_edit->has_selection());
+ CHECK(text_edit->get_text() == "");
+ CHECK(text_edit->get_caret_line(0) == 0);
+ CHECK(text_edit->get_caret_column(0) == 0);
}
SUBCASE("[TextEdit] ui_text_backspace_word same line") {
@@ -4891,6 +4903,18 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
CHECK(text_edit->get_caret_line(0) == 0);
CHECK(text_edit->get_caret_column(0) == 2);
text_edit->remove_secondary_carets();
+
+ // Remove when there are no words, only symbols.
+ text_edit->set_text("#{}");
+ text_edit->set_caret_line(0);
+ text_edit->set_caret_column(0);
+
+ SEND_GUI_ACTION("ui_text_delete_word");
+ CHECK(text_edit->get_viewport()->is_input_handled());
+ CHECK_FALSE(text_edit->has_selection());
+ CHECK(text_edit->get_text() == "");
+ CHECK(text_edit->get_caret_line(0) == 0);
+ CHECK(text_edit->get_caret_column(0) == 0);
}
SUBCASE("[TextEdit] ui_text_delete_word same line") {
@@ -5301,6 +5325,16 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_CHECK("caret_changed", empty_signal_args);
SIGNAL_CHECK_FALSE("text_changed");
SIGNAL_CHECK_FALSE("lines_edited_from");
+
+ // Move when there are no words, only symbols.
+ text_edit->set_text("#{}");
+ text_edit->set_caret_line(0);
+ text_edit->set_caret_column(3);
+
+ SEND_GUI_ACTION("ui_text_caret_word_left");
+ CHECK(text_edit->get_viewport()->is_input_handled());
+ CHECK(text_edit->get_caret_line(0) == 0);
+ CHECK(text_edit->get_caret_column(0) == 0);
}
SUBCASE("[TextEdit] ui_text_caret_left") {
@@ -5563,6 +5597,16 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
SIGNAL_CHECK("caret_changed", empty_signal_args);
SIGNAL_CHECK_FALSE("text_changed");
SIGNAL_CHECK_FALSE("lines_edited_from");
+
+ // Move when there are no words, only symbols.
+ text_edit->set_text("#{}");
+ text_edit->set_caret_line(0);
+ text_edit->set_caret_column(0);
+
+ SEND_GUI_ACTION("ui_text_caret_word_right");
+ CHECK(text_edit->get_viewport()->is_input_handled());
+ CHECK(text_edit->get_caret_line(0) == 0);
+ CHECK(text_edit->get_caret_column(0) == 3);
}
SUBCASE("[TextEdit] ui_text_caret_right") {