summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-29 14:08:31 +0200
committerGitHub <noreply@github.com>2022-04-29 14:08:31 +0200
commit65aacd6b0af7d6fd7cc2f8b9d032bc130d0860fb (patch)
tree9e31bdc13ce54e170518225f3dd55e4e44efdfc5 /tests
parent700ca5bb3c934df6aeecc280ea2741cbabd51f7a (diff)
parent925e54ad65d30eb1eecdde31502dd554bf00bce7 (diff)
Merge pull request #60519 from nathanfranke/fix-newline-indent
fix lines with ':' that end in comments causing auto indent
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_code_edit.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h
index 574cacda95..62931cd4dd 100644
--- a/tests/scene/test_code_edit.h
+++ b/tests/scene/test_code_edit.h
@@ -2179,8 +2179,24 @@ TEST_CASE("[SceneTree][CodeEdit] indent") {
SEND_GUI_ACTION(code_edit, "ui_text_newline");
CHECK(code_edit->get_line(0) == "test: # string");
CHECK(code_edit->get_line(1) == "");
+ code_edit->remove_string_delimiter("#");
+
+ /* Non-whitespace prevents auto-indentation. */
+ code_edit->add_comment_delimiter("#", "");
+ code_edit->set_text("");
+ code_edit->insert_text_at_caret("test := 0 # comment");
+ SEND_GUI_ACTION(code_edit, "ui_text_newline");
+ CHECK(code_edit->get_line(0) == "test := 0 # comment");
+ CHECK(code_edit->get_line(1) == "");
code_edit->remove_comment_delimiter("#");
+ /* Even when there's no comments. */
+ code_edit->set_text("");
+ code_edit->insert_text_at_caret("test := 0");
+ SEND_GUI_ACTION(code_edit, "ui_text_newline");
+ CHECK(code_edit->get_line(0) == "test := 0");
+ CHECK(code_edit->get_line(1) == "");
+
/* If between brace pairs an extra line is added. */
code_edit->set_text("");
code_edit->insert_text_at_caret("test{}");
@@ -2256,8 +2272,24 @@ TEST_CASE("[SceneTree][CodeEdit] indent") {
SEND_GUI_ACTION(code_edit, "ui_text_newline");
CHECK(code_edit->get_line(0) == "test: # string");
CHECK(code_edit->get_line(1) == "");
+ code_edit->remove_string_delimiter("#");
+
+ /* Non-whitespace prevents auto-indentation. */
+ code_edit->add_comment_delimiter("#", "");
+ code_edit->set_text("");
+ code_edit->insert_text_at_caret("test := 0 # comment");
+ SEND_GUI_ACTION(code_edit, "ui_text_newline");
+ CHECK(code_edit->get_line(0) == "test := 0 # comment");
+ CHECK(code_edit->get_line(1) == "");
code_edit->remove_comment_delimiter("#");
+ /* Even when there's no comments. */
+ code_edit->set_text("");
+ code_edit->insert_text_at_caret("test := 0");
+ SEND_GUI_ACTION(code_edit, "ui_text_newline");
+ CHECK(code_edit->get_line(0) == "test := 0");
+ CHECK(code_edit->get_line(1) == "");
+
/* If between brace pairs an extra line is added. */
code_edit->set_text("");
code_edit->insert_text_at_caret("test{}");