summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-05 10:08:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-05 10:08:58 +0200
commitaa554e82785ff4c446532f121427c6ea6b4d15e6 (patch)
tree0a1e834a0b19647a6586f5e25db6c87ac5065757 /tests
parent829d9bb6ba24ad955ac8fd29a88ed25572adc1dd (diff)
parent676627e1d16367616c7022df8d12c836c201c5f4 (diff)
downloadredot-engine-aa554e82785ff4c446532f121427c6ea6b4d15e6.tar.gz
Merge pull request #82694 from BrianMacIntosh/master
"Whole Words" search can detect word boundaries inside the search term.
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_text_edit.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index 7e9b472af1..840a04becf 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -3193,7 +3193,7 @@ TEST_CASE("[SceneTree][TextEdit] search") {
TextEdit *text_edit = memnew(TextEdit);
SceneTree::get_singleton()->get_root()->add_child(text_edit);
- text_edit->set_text("hay needle, hay\nHAY NEEDLE, HAY");
+ text_edit->set_text("hay needle, hay\nHAY NEEDLE, HAY\nwordword.word.word");
int length = text_edit->get_line(1).length();
CHECK(text_edit->search("test", 0, 0, 0) == Point2i(-1, -1));
@@ -3225,6 +3225,11 @@ TEST_CASE("[SceneTree][TextEdit] search") {
CHECK(text_edit->search("need", TextEdit::SEARCH_WHOLE_WORDS | TextEdit::SEARCH_MATCH_CASE, 0, 0) == Point2i(-1, -1));
CHECK(text_edit->search("need", TextEdit::SEARCH_WHOLE_WORDS | TextEdit::SEARCH_MATCH_CASE | TextEdit::SEARCH_BACKWARDS, 0, 0) == Point2i(-1, -1));
+ CHECK(text_edit->search("word", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(9, 2));
+ CHECK(text_edit->search("word", TextEdit::SEARCH_WHOLE_WORDS, 2, 10) == Point2i(14, 2));
+ CHECK(text_edit->search(".word", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(8, 2));
+ CHECK(text_edit->search("word.", TextEdit::SEARCH_WHOLE_WORDS, 2, 0) == Point2i(9, 2));
+
ERR_PRINT_OFF;
CHECK(text_edit->search("", 0, 0, 0) == Point2i(-1, -1));
CHECK(text_edit->search("needle", 0, -1, 0) == Point2i(-1, -1));