summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/README.md2
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.cfg11
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.gd8
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.cfg9
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.gd3
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.cfg11
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.gd8
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.cfg9
-rw-r--r--modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.gd3
-rw-r--r--modules/gdscript/tests/scripts/project.godot7
-rw-r--r--modules/gdscript/tests/test_completion.h2
11 files changed, 73 insertions, 0 deletions
diff --git a/modules/gdscript/tests/README.md b/modules/gdscript/tests/README.md
index 714e38397f..4dc706f8d1 100644
--- a/modules/gdscript/tests/README.md
+++ b/modules/gdscript/tests/README.md
@@ -25,6 +25,8 @@ The config file contains two section:
- `cs: boolean = false`: If `true`, the test will be skipped when running a non C# build.
- `use_single_quotes: boolean = false`: Configures the corresponding editor setting for the test.
+- `add_node_path_literals: boolean = false`: Configures the corresponding editor setting for the test.
+- `add_string_name_literals: boolean = false`: Configures the corresponding editor setting for the test.
- `scene: String`: Allows to specify a scene which is opened while autocompletion is performed. If this is not set the test runner will search for a `.tscn` file with the same basename as the GDScript file. If that isn't found either, autocompletion will behave as if no scene was opened.
- `node_path: String`: The node path of the node which holds the current script inside of the scene. Defaults to the scene root node.
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.cfg b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.cfg
new file mode 100644
index 0000000000..a8f26d83f9
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.cfg
@@ -0,0 +1,11 @@
+[input]
+add_node_path_literals=true
+[output]
+include=[
+ {"insert_text": "^\"property_of_a\""},
+ {"insert_text": "^\"name\""},
+]
+exclude=[
+ {"insert_text": "\"property_of_a\""},
+ {"insert_text": "\"name\""},
+]
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.gd b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.gd
new file mode 100644
index 0000000000..bfdb5c7995
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_node_path_tween.gd
@@ -0,0 +1,8 @@
+extends Node
+
+const A = preload("res://completion/class_a.notest.gd")
+
+func _ready() -> void:
+ var a := A.new()
+ var tween := get_tree().create_tween()
+ tween.tween_property(a, ➡)
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.cfg b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.cfg
new file mode 100644
index 0000000000..309fa8ed38
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.cfg
@@ -0,0 +1,9 @@
+[input]
+add_string_name_literals=true
+[output]
+include=[
+ {"insert_text": "&\"test_input_action\""},
+]
+exclude=[
+ {"insert_text": "\"test_input_action\""},
+]
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.gd b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.gd
new file mode 100644
index 0000000000..9b325e632d
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/add_string_name_input_event.gd
@@ -0,0 +1,3 @@
+func _input(event: InputEvent) -> void:
+ event.is_action_pressed(➡)
+ pass
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.cfg b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.cfg
new file mode 100644
index 0000000000..45d0ad0f3b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.cfg
@@ -0,0 +1,11 @@
+[input]
+add_node_path_literals=false
+[output]
+include=[
+ {"insert_text": "\"property_of_a\""},
+ {"insert_text": "\"name\""},
+]
+exclude=[
+ {"insert_text": "^\"property_of_a\""},
+ {"insert_text": "^\"name\""},
+]
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.gd b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.gd
new file mode 100644
index 0000000000..bfdb5c7995
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_node_path_tween.gd
@@ -0,0 +1,8 @@
+extends Node
+
+const A = preload("res://completion/class_a.notest.gd")
+
+func _ready() -> void:
+ var a := A.new()
+ var tween := get_tree().create_tween()
+ tween.tween_property(a, ➡)
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.cfg b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.cfg
new file mode 100644
index 0000000000..7a388d54e1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.cfg
@@ -0,0 +1,9 @@
+[input]
+add_string_name_literals=false
+[output]
+include=[
+ {"insert_text": "\"test_input_action\""},
+]
+exclude=[
+ {"insert_text": "&\"test_input_action\""},
+]
diff --git a/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.gd b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.gd
new file mode 100644
index 0000000000..9b325e632d
--- /dev/null
+++ b/modules/gdscript/tests/scripts/completion/argument_options/string_literals/dont_add_string_name_input_event.gd
@@ -0,0 +1,3 @@
+func _input(event: InputEvent) -> void:
+ event.is_action_pressed(➡)
+ pass
diff --git a/modules/gdscript/tests/scripts/project.godot b/modules/gdscript/tests/scripts/project.godot
index c500ef443d..c9035ecab9 100644
--- a/modules/gdscript/tests/scripts/project.godot
+++ b/modules/gdscript/tests/scripts/project.godot
@@ -8,3 +8,10 @@ config_version=5
[application]
config/name="GDScript Integration Test Suite"
+
+[input]
+
+test_input_action={
+"deadzone": 0.5,
+"events": []
+}
diff --git a/modules/gdscript/tests/test_completion.h b/modules/gdscript/tests/test_completion.h
index 327446acee..387358934d 100644
--- a/modules/gdscript/tests/test_completion.h
+++ b/modules/gdscript/tests/test_completion.h
@@ -130,6 +130,8 @@ static void test_directory(const String &p_dir) {
#endif
EditorSettings::get_singleton()->set_setting("text_editor/completion/use_single_quotes", conf.get_value("input", "use_single_quotes", false));
+ EditorSettings::get_singleton()->set_setting("text_editor/completion/add_node_path_literals", conf.get_value("input", "add_node_path_literals", false));
+ EditorSettings::get_singleton()->set_setting("text_editor/completion/add_string_name_literals", conf.get_value("input", "add_string_name_literals", false));
List<Dictionary> include;
to_dict_list(conf.get_value("output", "include", Array()), include);