Fix SCRIPT ERROR/ERROR/WARNING on test output

Also "fixing" some GDScript completion tests which
where named wrongly.
This commit is contained in:
Pablo Andres Fuente 2025-03-06 00:40:35 +01:00
parent 134da37497
commit 5775d29ad8
33 changed files with 30 additions and 13 deletions

View File

@ -1,3 +1,5 @@
extends Node
@onready var anim := $AnimationPlayer
func test():

View File

@ -1,3 +1,5 @@
extends Node
@onready var anim: AnimationPlayer = $AnimationPlayer
func test():

View File

@ -1,3 +1,5 @@
extends Node
@onready var anim = $AnimationPlayer
func test():

View File

@ -1,5 +1,5 @@
extends Node
func a():
%AnimationPlayer.
$UniqueAnimationPlayer.
pass

View File

@ -1,5 +1,5 @@
extends Node
func a():
$UniqueAnimationPlayer.
%AnimationPlayer.
pass

View File

@ -1,6 +1,6 @@
extends Node
var test = $A
@onready var test = $A
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test = $AnimationPlayer
@onready var test = $AnimationPlayer
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test: AnimationPlayer = $AnimationPlayer
@onready var test: AnimationPlayer = $AnimationPlayer
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test: Node = $A
@onready var test: Node = $A
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test: Node = $AnimationPlayer
@onready var test: Node = $AnimationPlayer
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test: Area2D = $A
@onready var test: Area2D = $A
func a():
test.

View File

@ -1,6 +1,6 @@
extends Node
var test: Area2D = $AnimationPlayer
@onready var test: Area2D = $AnimationPlayer
func a():
test.

View File

@ -161,6 +161,8 @@ static void test_directory(const String &p_dir) {
owner = scene->get_node(conf.get_value("input", "node_path", "."));
}
// The only requirement is for the script to be parsable, warnings and errors from the analyzer might happen and completion should still work.
ERR_PRINT_OFF;
if (owner != nullptr) {
// Remove the line which contains the sentinel char, to get a valid script.
Ref<GDScript> scr;
@ -184,6 +186,8 @@ static void test_directory(const String &p_dir) {
}
GDScriptLanguage::get_singleton()->complete_code(code, res_path, owner, &options, forced, call_hint);
ERR_PRINT_ON;
String contains_excluded;
for (ScriptLanguage::CodeCompletionOption &option : options) {
for (const Dictionary &E : exclude) {

View File

@ -235,9 +235,13 @@ TEST_CASE("[AHashMap] Insert, iterate and remove many elements") {
TEST_CASE("[AHashMap] Insert, iterate and remove many strings") {
const int elem_max = 432;
AHashMap<String, String> map;
// To not print WARNING: Excessive collision count (NN), is the right hash function being used?
ERR_PRINT_OFF;
for (int i = 0; i < elem_max; i++) {
map.insert(itos(i), itos(i));
}
ERR_PRINT_ON;
//insert order should have been kept
int idx = 0;

View File

@ -4492,7 +4492,8 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
Point2 caret_pos = code_edit->get_caret_draw_pos();
caret_pos.x += 60;
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::NONE, 0, Key::NONE);
SEND_GUI_MOUSE_MOTION_EVENT(caret_pos, MouseButtonMask::NONE, Key::NONE);
CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text");
SIGNAL_WATCH(code_edit, "symbol_validate");

View File

@ -8014,6 +8014,8 @@ TEST_CASE("[SceneTree][TextEdit] gutters") {
SIGNAL_WATCH(text_edit, "gutter_removed");
SUBCASE("[TextEdit] gutter add and remove") {
text_edit->set_text("test1\ntest2\ntest3\ntest4");
text_edit->add_gutter();
CHECK(text_edit->get_gutter_count() == 1);
CHECK(text_edit->get_gutter_width(0) == 24);

View File

@ -306,7 +306,7 @@ struct GodotTestCaseListener : public doctest::IReporter {
// So we have to do this for each test case. Also make sure there is
// no residual theme from something else.
ThemeDB::get_singleton()->finalize_theme();
ThemeDB::get_singleton()->initialize_theme_noproject();
ThemeDB::get_singleton()->initialize_theme();
#ifndef _3D_DISABLED
physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server();