Skip to content

Commit

Permalink
Update CodeEdit and its tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Meorge committed Dec 20, 2024
1 parent 837388c commit f0f34f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scene/gui/code_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,7 @@ void CodeEdit::_bind_methods() {

ClassDB::bind_method(D_METHOD("get_text_for_code_completion"), &CodeEdit::get_text_for_code_completion);
ClassDB::bind_method(D_METHOD("request_code_completion", "force"), &CodeEdit::request_code_completion, DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_code_completion_option", "type", "display_text", "insert_text", "text_color", "icon", "value", "location"), &CodeEdit::add_code_completion_option, DEFVAL(Color(1, 1, 1)), DEFVAL(Ref<Resource>()), DEFVAL(Variant()), DEFVAL(LOCATION_OTHER));
ClassDB::bind_method(D_METHOD("add_code_completion_option", "type", "display_text", "insert_text", "text_color", "icon", "value", "location", "deprecated"), &CodeEdit::add_code_completion_option, DEFVAL(Color(1, 1, 1)), DEFVAL(Ref<Resource>()), DEFVAL(Variant()), DEFVAL(LOCATION_OTHER), DEFVAL(false));
ClassDB::bind_method(D_METHOD("update_code_completion_options", "force"), &CodeEdit::update_code_completion_options);
ClassDB::bind_method(D_METHOD("get_code_completion_options"), &CodeEdit::get_code_completion_options);
ClassDB::bind_method(D_METHOD("get_code_completion_option", "index"), &CodeEdit::get_code_completion_option);
Expand Down
5 changes: 3 additions & 2 deletions tests/scene/test_code_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -4032,7 +4032,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
code_edit->set_code_completion_selected_index(1);
ERR_PRINT_ON;
CHECK(code_edit->get_code_completion_selected_index() == 0);
CHECK(code_edit->get_code_completion_option(0).size() == 7);
CHECK(code_edit->get_code_completion_option(0).size() == 8);
CHECK(code_edit->get_code_completion_options().size() == 1);

/* Check cancel closes completion. */
Expand All @@ -4043,7 +4043,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
CHECK(code_edit->get_code_completion_selected_index() == 0);
code_edit->set_code_completion_selected_index(1);
CHECK(code_edit->get_code_completion_selected_index() == 1);
CHECK(code_edit->get_code_completion_option(0).size() == 7);
CHECK(code_edit->get_code_completion_option(0).size() == 8);
CHECK(code_edit->get_code_completion_options().size() == 3);

/* Check data. */
Expand All @@ -4054,6 +4054,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
CHECK(option["font_color"] == Color(1, 0, 0));
CHECK(option["icon"] == Ref<Resource>());
CHECK(option["default_value"] == Color(1, 0, 0));
CHECK(option["deprecated"] == Variant(false));

/* Set size for mouse input. */
code_edit->set_size(Size2(100, 100));
Expand Down

0 comments on commit f0f34f4

Please sign in to comment.