summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-18 10:37:59 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-18 10:37:59 +0200
commit77623d0a36d66b7b979c2b0a3141b99796deb860 (patch)
tree51a0d042a8e738d6f80627596bcc9d8e5b0a599d /tests
parent3e233e1f2417b6831220c950ab4747b6c47cbda8 (diff)
parent6170381bd754490aee34e5a34558460d5c2f33f9 (diff)
downloadredot-engine-77623d0a36d66b7b979c2b0a3141b99796deb860.tar.gz
Merge pull request #81354 from MJacred/textedit_pixel_pos_fix
Fix `TextEdit.get_rect_at_line_column returning` negative pos even though cursor is in viewable area of the control
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_text_edit.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index 79766cd919..7e9b472af1 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -3241,6 +3241,15 @@ TEST_CASE("[SceneTree][TextEdit] mouse") {
SceneTree::get_singleton()->get_root()->add_child(text_edit);
text_edit->set_size(Size2(800, 200));
+
+ CHECK(text_edit->get_rect_at_line_column(0, 0).get_position() == Point2i(0, 0));
+
+ text_edit->set_line(0, "A");
+ MessageQueue::get_singleton()->flush();
+ CHECK(text_edit->get_rect_at_line_column(0, 1).get_position().x > 0);
+
+ text_edit->clear(); // Necessary, otherwise the following test cases fail.
+
text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
MessageQueue::get_singleton()->flush();