feat: godot-engine-source-4.3-stable

This commit is contained in:
Jan van der Weide 2025-01-17 16:36:38 +01:00
parent c59a7dcade
commit 7125d019b5
11149 changed files with 5070401 additions and 0 deletions

View file

@ -0,0 +1,7 @@
func test():
var state = PhysicsDirectBodyState3DExtension.new()
assign(state)
state.free()
func assign(state):
state.center_of_mass.x -= 1.0

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: assign()
>> runtime/assign_to_read_only_property.gd
>> 7
>> Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.

View file

@ -0,0 +1,8 @@
func test():
var state = PhysicsDirectBodyState3DExtension.new()
var prop = &"center_of_mass"
assign(state, prop)
state.free()
func assign(state, prop):
state[prop].x = 1.0

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: assign()
>> runtime/assign_to_read_only_property_with_variable_index.gd
>> 8
>> Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.

View file

@ -0,0 +1,8 @@
var weakling = 'not float'
func weak(x: float = weakling):
print(x)
print('typeof x is', typeof(x))
func test():
print(typeof(weak()))
print('not ok')

View file

@ -0,0 +1,8 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: weak()
>> runtime/errors/bad_conversion_for_default_parameter.gd
>> 2
>> Trying to assign value of type 'String' to a variable of type 'float'.
0
not ok

View file

@ -0,0 +1,6 @@
#debug-only
func test():
var node := Node.new()
var inside_tree = node.is_inside_tree
node.free()
inside_tree.call()

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/callable_call_after_free_object.gd
>> 6
>> Attempt to call function 'null::is_inside_tree (Callable)' on a null instance.

View file

@ -0,0 +1,4 @@
func test():
var node := Node.new()
node.free()
print(node as Node2D)

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_freed_object.gd
>> 4
>> Trying to cast a freed object.

View file

@ -0,0 +1,4 @@
func test():
var integer: Variant = 1
@warning_ignore("unsafe_cast")
print(integer as Array)

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_int_to_array.gd
>> 4
>> Invalid cast: could not convert value to 'Array'.

View file

@ -0,0 +1,4 @@
func test():
var integer: Variant = 1
@warning_ignore("unsafe_cast")
print(integer as Node)

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_int_to_object.gd
>> 4
>> Invalid cast: can't convert a non-object value to an object type.

View file

@ -0,0 +1,4 @@
func test():
var object: Variant = RefCounted.new()
@warning_ignore("unsafe_cast")
print(object as int)

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_object_to_int.gd
>> 4
>> Invalid cast: could not convert value to 'int'.

View file

@ -0,0 +1,6 @@
const array: Array = [{}]
func test():
var dictionary := array[0]
var key: int = 0
dictionary[key] = 0

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/constant_array_is_deep.gd
>> 6
>> Invalid assignment on read-only value (on base: 'Dictionary').

View file

@ -0,0 +1,6 @@
const dictionary := {0: [0]}
func test():
var array := dictionary[0]
var key: int = 0
array[key] = 0

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/constant_dictionary_is_deep.gd
>> 6
>> Invalid assignment on read-only value (on base: 'Array').

View file

@ -0,0 +1,4 @@
func test():
var a: Array = [Resource.new()]
for node: Node in a:
print(node)

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/for_loop_iterator_type_not_match_specified.gd
>> 3
>> Trying to assign value of type 'Resource' to a variable of type 'Node'.

View file

@ -0,0 +1,3 @@
func test():
var x = Color()
print(len(x)) # GDScript utility function.

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/gd_utility_function_wrong_arg.gd
>> 3
>> Error calling GDScript utility function "len()": Value of type 'Color' can't provide a length.

View file

@ -0,0 +1,9 @@
# https://github.com/godotengine/godot/issues/90086
class MyObj:
var obj: WeakRef
func test():
var obj_1 = MyObj.new()
var obj_2 = MyObj.new()
obj_1.obj = obj_2

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/invalid_property_assignment.gd
>> 9
>> Invalid assignment of property or key 'obj' with value of type 'RefCounted (MyObj)' on a base object of type 'RefCounted (MyObj)'.

View file

@ -0,0 +1,6 @@
# https://github.com/godotengine/godot/issues/66675
func test():
example(Node2D)
func example(thing):
print(thing.has_method('asdf'))

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: example()
>> runtime/errors/non_static_method_call_on_native_class.gd
>> 6
>> Invalid call. Nonexistent function 'has_method' in base 'Node2D'.

View file

@ -0,0 +1,4 @@
func test():
var dictionary := { "a": 0 }
dictionary.make_read_only()
dictionary.a = 1

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/read_only_dictionary.gd
>> 4
>> Invalid assignment on read-only value (on base: 'Dictionary').

View file

@ -0,0 +1,4 @@
func test():
var basic := [1]
var typed: Array[int] = basic
print('not ok')

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_assign_basic_to_typed.gd
>> 3
>> Trying to assign an array of type "Array" to a variable of type "Array[int]".

View file

@ -0,0 +1,4 @@
func test():
var differently: Variant = [1.0] as Array[float]
var typed: Array[int] = differently
print('not ok')

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_assign_differently_typed.gd
>> 3
>> Trying to assign an array of type "Array[float]" to a variable of type "Array[int]".

View file

@ -0,0 +1,7 @@
class Foo: pass
class Bar extends Foo: pass
class Baz extends Foo: pass
func test():
var typed: Array[Bar] = [Baz.new() as Foo]
print('not ok')

View file

@ -0,0 +1,5 @@
GDTEST_RUNTIME_ERROR
>> ERROR
>> Method/function failed.
>> Unable to convert array index 0 from "Object" to "Object".
not ok

View file

@ -0,0 +1,7 @@
func expect_typed(typed: Array[int]):
print(typed.size())
func test():
var basic := [1]
expect_typed(basic)
print('not ok')

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_pass_basic_to_typed.gd
>> 6
>> Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_basic_to_typed.gd)'. The array of argument 1 (Array) does not have the same element type as the expected typed array argument.

View file

@ -0,0 +1,7 @@
func expect_typed(typed: Array[int]):
print(typed.size())
func test():
var differently: Variant = [1.0] as Array[float]
expect_typed(differently)
print('not ok')

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_pass_differently_to_typed.gd
>> 6
>> Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_differently_to_typed.gd)'. The array of argument 1 (Array[float]) does not have the same element type as the expected typed array argument.

View file

@ -0,0 +1,4 @@
func test():
var obj
obj = Node.new()
print(obj.free())

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_free_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"

View file

@ -0,0 +1,4 @@
func test():
var value
value = []
print(value.reverse())

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_void_builtin_method_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"

View file

@ -0,0 +1,4 @@
func test():
var obj
obj = RefCounted.new()
print(obj.notify_property_list_changed())

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_void_native_method_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"

View file

@ -0,0 +1,3 @@
func test():
var x = Color()
print(floor(x)) # Built-in utility function.

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/utility_function_wrong_arg.gd
>> 3
>> Error calling utility function "floor()": Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i".

View file

@ -0,0 +1,102 @@
extends Node
func my_func_1(_foo, _bar):
pass
func my_func_2(_foo, _bar, _baz):
pass
static func my_static_func_1(_foo, _bar):
pass
static func my_static_func_2(_foo, _bar, _baz):
pass
@rpc
func my_rpc_func_1(_foo, _bar):
pass
@rpc
func my_rpc_func_2(_foo, _bar, _baz):
pass
func test():
# Test built-in methods.
var builtin_callable_1 : Callable = add_to_group
print(builtin_callable_1.get_argument_count()) # Should print 2.
var builtin_callable_2 : Callable = find_child
print(builtin_callable_2.get_argument_count()) # Should print 3.
# Test built-in vararg methods.
var builtin_vararg_callable_1 : Callable = call_thread_safe
print(builtin_vararg_callable_1.get_argument_count()) # Should print 1.
var builtin_vararg_callable_2 : Callable = rpc_id
print(builtin_vararg_callable_2.get_argument_count()) # Should print 2.
# Test plain methods.
var callable_1 : Callable = my_func_1
print(callable_1.get_argument_count()) # Should print 2.
var callable_2 : Callable = my_func_2
print(callable_2.get_argument_count()) # Should print 3.
# Test static methods.
var static_callable_1 : Callable = my_static_func_1
print(static_callable_1.get_argument_count()) # Should print 2.
var static_callable_2 : Callable = my_static_func_2
print(static_callable_2.get_argument_count()) # Should print 3.
# Test rpc methods.
var rpc_callable_1 : Callable = my_rpc_func_1
print(rpc_callable_1.get_argument_count()) # Should print 2.
var rpc_callable_2 : Callable = my_rpc_func_2
print(rpc_callable_2.get_argument_count()) # Should print 3.
# Test lambdas.
var lambda_callable_1 : Callable = func(_foo, _bar): pass
print(lambda_callable_1.get_argument_count()) # Should print 2.
var lambda_callable_2 : Callable = func(_foo, _bar, _baz): pass
print(lambda_callable_2.get_argument_count()) # Should print 3.
# Test lambdas with self.
var lambda_self_callable_1 : Callable = func(_foo, _bar): return self
print(lambda_self_callable_1.get_argument_count()) # Should print 2.
var lambda_self_callable_2 : Callable = func(_foo, _bar, _baz): return self
print(lambda_self_callable_2.get_argument_count()) # Should print 3.
# Test bind.
var bind_callable_1 : Callable = my_func_2.bind(1)
print(bind_callable_1.get_argument_count()) # Should print 2.
var bind_callable_2 : Callable = my_func_2.bind(1, 2)
print(bind_callable_2.get_argument_count()) # Should print 1.
# Test unbind.
var unbind_callable_1 : Callable = my_func_2.unbind(1)
print(unbind_callable_1.get_argument_count()) # Should print 4.
var unbind_callable_2 : Callable = my_func_2.unbind(2)
print(unbind_callable_2.get_argument_count()) # Should print 5.
# Test variant callables.
var string_tmp := String()
var variant_callable_1 : Callable = string_tmp.replace
print(variant_callable_1.get_argument_count()) # Should print 2.
var variant_callable_2 : Callable = string_tmp.rsplit
print(variant_callable_2.get_argument_count()) # Should print 3.
# Test variant vararg callables.
var callable_tmp := Callable()
var variant_vararg_callable_1 : Callable = callable_tmp.call
print(variant_vararg_callable_1.get_argument_count()) # Should print 0.
var variant_vararg_callable_2 : Callable = callable_tmp.rpc_id
print(variant_vararg_callable_2.get_argument_count()) # Should print 1.
# Test global methods.
var global_callable_1 = is_equal_approx
print(global_callable_1.get_argument_count()) # Should print 2.
var global_callable_2 = inverse_lerp
print(global_callable_2.get_argument_count()) # Should print 3.
# Test GDScript methods.
var gdscript_callable_1 = char
print(gdscript_callable_1.get_argument_count()) # Should print 1.
var gdscript_callable_2 = is_instance_of
print(gdscript_callable_2.get_argument_count()) # Should print 2.

View file

@ -0,0 +1,27 @@
GDTEST_OK
2
3
1
2
2
3
2
3
2
3
2
3
2
3
2
1
4
5
2
3
0
1
2
3
1
2

View file

@ -0,0 +1,35 @@
# https://github.com/godotengine/godot/issues/63965
func test():
var array_str: Array = []
array_str.push_back("godot")
print("StringName in Array: ", &"godot" in array_str)
var array_sname: Array = []
array_sname.push_back(&"godot")
print("String in Array: ", "godot" in array_sname)
# Not equal because the values are different types.
print("Arrays not equal: ", array_str != array_sname)
var string_array: Array[String] = []
var stringname_array: Array[StringName] = []
string_array.push_back(&"abc")
print("Array[String] insert converted: ", typeof(string_array[0]) == TYPE_STRING)
stringname_array.push_back("abc")
print("Array[StringName] insert converted: ", typeof(stringname_array[0]) == TYPE_STRING_NAME)
print("StringName in Array[String]: ", &"abc" in string_array)
print("String in Array[StringName]: ", "abc" in stringname_array)
var packed_string_array: PackedStringArray = []
assert(!packed_string_array.push_back("abc"))
print("StringName in PackedStringArray: ", &"abc" in packed_string_array)
string_array.push_back("abc")
print("StringName finds String in Array: ", string_array.find(&"abc"))
stringname_array.push_back(&"abc")
print("String finds StringName in Array: ", stringname_array.find("abc"))

View file

@ -0,0 +1,11 @@
GDTEST_OK
StringName in Array: true
String in Array: true
Arrays not equal: true
Array[String] insert converted: true
Array[StringName] insert converted: true
StringName in Array[String]: true
String in Array[StringName]: true
StringName in PackedStringArray: true
StringName finds String in Array: 0
String finds StringName in Array: 0

View file

@ -0,0 +1,32 @@
# https://github.com/godotengine/godot/issues/48121
func test():
var x := []
var y := []
x.push_back(y)
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
x.clear()
x = Array()
y = Array()
x.push_back(y)
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
x.clear()
x = Array().duplicate()
y = Array().duplicate()
x.push_back(y)
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
x.clear()
x = [].duplicate()
y = [].duplicate()
x.push_back(y)
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
x.clear()
x = Array()
y = Array()
x.push_back(y)
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
x.clear()

View file

@ -0,0 +1,6 @@
GDTEST_OK
TEST ARRAY ADD TO SELF: 0
TEST ARRAY ADD TO SELF: 0
TEST ARRAY ADD TO SELF: 0
TEST ARRAY ADD TO SELF: 0
TEST ARRAY ADD TO SELF: 0

View file

@ -0,0 +1,13 @@
extends Node
func test():
process_priority = 10
var change = 20
print(process_priority)
print(change)
process_priority += change
print(process_priority)
print(change)

View file

@ -0,0 +1,5 @@
GDTEST_OK
10
20
30
20

View file

@ -0,0 +1,31 @@
# https://github.com/godotengine/godot/issues/75832
@warning_ignore("narrowing_conversion")
func test():
var hf := 2.0
var sf = 2.0
var i := 2
i *= hf
i *= sf
i *= 2.0
print(i)
var v2 := Vector2i(1, 2)
v2 *= hf
v2 *= sf
v2 *= 2.0
print(v2)
var v3 := Vector3i(1, 2, 3)
v3 *= hf
v3 *= sf
v3 *= 2.0
print(v3)
var v4 := Vector4i(1, 2, 3, 4)
v4 *= hf
v4 *= sf
v4 *= 2.0
print(v4)
var arr := [1, 2, 3]
arr += [4, 5]
print(arr)

View file

@ -0,0 +1,6 @@
GDTEST_OK
16
(8, 16)
(8, 16, 24)
(8, 16, 24, 32)
[1, 2, 3, 4, 5]

View file

@ -0,0 +1,7 @@
func wait() -> void:
pass
func test():
@warning_ignore("redundant_await")
await wait()
print("end")

View file

@ -0,0 +1,2 @@
GDTEST_OK
end

View file

@ -0,0 +1,25 @@
signal no_parameters()
signal one_parameter(number)
signal two_parameters(number1, number2)
func await_no_parameters():
var result = await no_parameters
print(result)
func await_one_parameter():
var result = await one_parameter
print(result)
func await_two_parameters():
var result = await two_parameters
print(result)
func test():
await_no_parameters()
no_parameters.emit()
await_one_parameter()
one_parameter.emit(1)
await_two_parameters()
two_parameters.emit(1, 2)

View file

@ -0,0 +1,4 @@
GDTEST_OK
<null>
1
[1, 2]

View file

@ -0,0 +1,8 @@
# https://github.com/godotengine/godot/issues/50894
func test():
print(await not_coroutine())
func not_coroutine() -> String:
return "awaited"

View file

@ -0,0 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 4
>> REDUNDANT_AWAIT
>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal.
awaited

View file

@ -0,0 +1,13 @@
func test():
var array: Array = [1, 2, 3]
print(array)
var array_clear: Callable = array.clear
array_clear.call()
print(array)
var dictionary: Dictionary = {1: 2, 3: 4}
print(dictionary)
# `dictionary.clear` is treated as a key.
var dictionary_clear := Callable.create(dictionary, &"clear")
dictionary_clear.call()
print(dictionary)

View file

@ -0,0 +1,5 @@
GDTEST_OK
[1, 2, 3]
[]
{ 1: 2, 3: 4 }
{ }

View file

@ -0,0 +1,6 @@
func test():
# Validated native static call with return value.
print(FileAccess.file_exists("some_file"))
# Validated native static call without return value.
Node.print_orphan_nodes()

View file

@ -0,0 +1,19 @@
func test():
var dictionary1: Variant = {1:Vector2()}
dictionary1[1].x = 2
var dictionary2: Dictionary = {3:Vector2()}
dictionary2[3].x = 4
var array1: Variant = [[Vector2()]]
array1[0][0].x = 5
var array2: Array = [[Vector2()]]
array2[0][0].x = 6
var array3: Array[Array] = [[Vector2()]]
array3[0][0].x = 7
var transform = Transform3D()
transform.basis.x = Vector3(8.0, 9.0, 7.0)
print(dictionary1)
print(dictionary2)
print(array1)
print(array2)
print(array3)
print(transform)

View file

@ -0,0 +1,7 @@
GDTEST_OK
{ 1: (2, 0) }
{ 3: (4, 0) }
[[(5, 0)]]
[[(6, 0)]]
[[(7, 0)]]
[X: (8, 9, 7), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)]

View file

@ -0,0 +1,146 @@
func test():
var value
# null
value = null
print(value == null)
# bool
value = false
print(value == null)
# int
value = 0
print(value == null)
# float
value = 0.0
print(value == null)
# String
value = ""
print(value == null)
# Vector2
value = Vector2()
print(value == null)
# Vector2i
value = Vector2i()
print(value == null)
# Rect2
value = Rect2()
print(value == null)
# Rect2i
value = Rect2i()
print(value == null)
# Vector3
value = Vector3()
print(value == null)
# Vector3i
value = Vector3i()
print(value == null)
# Transform2D
value = Transform2D()
print(value == null)
# Plane
value = Plane()
print(value == null)
# Quaternion
value = Quaternion()
print(value == null)
# AABB
value = AABB()
print(value == null)
# Basis
value = Basis()
print(value == null)
# Transform3D
value = Transform3D()
print(value == null)
# Projection
value = Projection()
print(value == null)
# Color
value = Color()
print(value == null)
# StringName
value = &""
print(value == null)
# NodePath
value = ^""
print(value == null)
# RID
value = RID()
print(value == null)
# Callable
value = Callable()
print(value == null)
# Signal
value = Signal()
print(value == null)
# Dictionary
value = {}
print(value == null)
# Array
value = []
print(value == null)
# PackedByteArray
value = PackedByteArray()
print(value == null)
# PackedInt32Array
value = PackedInt32Array()
print(value == null)
# PackedInt64Array
value = PackedInt64Array()
print(value == null)
# PackedFloat32Array
value = PackedFloat32Array()
print(value == null)
# PackedFloat64Array
value = PackedFloat64Array()
print(value == null)
# PackedStringArray
value = PackedStringArray()
print(value == null)
# PackedVector2Array
value = PackedVector2Array()
print(value == null)
# PackedVector3Array
value = PackedVector3Array()
print(value == null)
# PackedColorArray
value = PackedColorArray()
print(value == null)
# PackedVector4Array
value = PackedVector4Array()
print(value == null)

View file

@ -0,0 +1,37 @@
GDTEST_OK
true
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false

View file

@ -0,0 +1,146 @@
func test():
var value
# null
value = null
print(value != null)
# bool
value = false
print(value != null)
# int
value = 0
print(value != null)
# float
value = 0.0
print(value != null)
# String
value = ""
print(value != null)
# Vector2
value = Vector2()
print(value != null)
# Vector2i
value = Vector2i()
print(value != null)
# Rect2
value = Rect2()
print(value != null)
# Rect2i
value = Rect2i()
print(value != null)
# Vector3
value = Vector3()
print(value != null)
# Vector3i
value = Vector3i()
print(value != null)
# Transform2D
value = Transform2D()
print(value != null)
# Plane
value = Plane()
print(value != null)
# Quaternion
value = Quaternion()
print(value != null)
# AABB
value = AABB()
print(value != null)
# Basis
value = Basis()
print(value != null)
# Transform3D
value = Transform3D()
print(value != null)
# Projection
value = Projection()
print(value != null)
# Color
value = Color()
print(value != null)
# StringName
value = &""
print(value != null)
# NodePath
value = ^""
print(value != null)
# RID
value = RID()
print(value != null)
# Callable
value = Callable()
print(value != null)
# Signal
value = Signal()
print(value != null)
# Dictionary
value = {}
print(value != null)
# Array
value = []
print(value != null)
# PackedByteArray
value = PackedByteArray()
print(value != null)
# PackedInt32Array
value = PackedInt32Array()
print(value != null)
# PackedInt64Array
value = PackedInt64Array()
print(value != null)
# PackedFloat32Array
value = PackedFloat32Array()
print(value != null)
# PackedFloat64Array
value = PackedFloat64Array()
print(value != null)
# PackedStringArray
value = PackedStringArray()
print(value != null)
# PackedVector2Array
value = PackedVector2Array()
print(value != null)
# PackedVector3Array
value = PackedVector3Array()
print(value != null)
# PackedColorArray
value = PackedColorArray()
print(value != null)
# PackedVector4Array
value = PackedVector4Array()
print(value != null)

View file

@ -0,0 +1,37 @@
GDTEST_OK
false
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true

View file

@ -0,0 +1,142 @@
func test():
var value
# null
value = null
print(null == value)
# bool
value = false
print(null == value)
# int
value = 0
print(null == value)
# float
value = 0.0
print(null == value)
# String
value = ""
print(null == value)
# Vector2
value = Vector2()
print(null == value)
# Vector2i
value = Vector2i()
print(null == value)
# Rect2
value = Rect2()
print(null == value)
# Rect2i
value = Rect2i()
print(null == value)
# Vector3
value = Vector3()
print(null == value)
# Vector3i
value = Vector3i()
print(null == value)
# Transform2D
value = Transform2D()
print(null == value)
# Plane
value = Plane()
print(null == value)
# Quaternion
value = Quaternion()
print(null == value)
# AABB
value = AABB()
print(null == value)
# Basis
value = Basis()
print(null == value)
# Transform3D
value = Transform3D()
print(null == value)
# Color
value = Color()
print(null == value)
# StringName
value = &""
print(null == value)
# NodePath
value = ^""
print(null == value)
# RID
value = RID()
print(null == value)
# Callable
value = Callable()
print(null == value)
# Signal
value = Signal()
print(null == value)
# Dictionary
value = {}
print(null == value)
# Array
value = []
print(null == value)
# PackedByteArray
value = PackedByteArray()
print(null == value)
# PackedInt32Array
value = PackedInt32Array()
print(null == value)
# PackedInt64Array
value = PackedInt64Array()
print(null == value)
# PackedFloat32Array
value = PackedFloat32Array()
print(null == value)
# PackedFloat64Array
value = PackedFloat64Array()
print(null == value)
# PackedStringArray
value = PackedStringArray()
print(null == value)
# PackedVector2Array
value = PackedVector2Array()
print(null == value)
# PackedVector3Array
value = PackedVector3Array()
print(null == value)
# PackedColorArray
value = PackedColorArray()
print(null == value)
# PackedVector4Array
value = PackedVector4Array()
print(null == value)

View file

@ -0,0 +1,36 @@
GDTEST_OK
true
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false

View file

@ -0,0 +1,142 @@
func test():
var value
# null
value = null
print(null != value)
# bool
value = false
print(null != value)
# int
value = 0
print(null != value)
# float
value = 0.0
print(null != value)
# String
value = ""
print(null != value)
# Vector2
value = Vector2()
print(null != value)
# Vector2i
value = Vector2i()
print(null != value)
# Rect2
value = Rect2()
print(null != value)
# Rect2i
value = Rect2i()
print(null != value)
# Vector3
value = Vector3()
print(null != value)
# Vector3i
value = Vector3i()
print(null != value)
# Transform2D
value = Transform2D()
print(null != value)
# Plane
value = Plane()
print(null != value)
# Quaternion
value = Quaternion()
print(null != value)
# AABB
value = AABB()
print(null != value)
# Basis
value = Basis()
print(null != value)
# Transform3D
value = Transform3D()
print(null != value)
# Color
value = Color()
print(null != value)
# StringName
value = &""
print(null != value)
# NodePath
value = ^""
print(null != value)
# RID
value = RID()
print(null != value)
# Callable
value = Callable()
print(null != value)
# Signal
value = Signal()
print(null != value)
# Dictionary
value = {}
print(null != value)
# Array
value = []
print(null != value)
# PackedByteArray
value = PackedByteArray()
print(null != value)
# PackedInt32Array
value = PackedInt32Array()
print(null != value)
# PackedInt64Array
value = PackedInt64Array()
print(null != value)
# PackedFloat32Array
value = PackedFloat32Array()
print(null != value)
# PackedFloat64Array
value = PackedFloat64Array()
print(null != value)
# PackedStringArray
value = PackedStringArray()
print(null != value)
# PackedVector2Array
value = PackedVector2Array()
print(null != value)
# PackedVector3Array
value = PackedVector3Array()
print(null != value)
# PackedColorArray
value = PackedColorArray()
print(null != value)
# PackedVector4Array
value = PackedVector4Array()
print(null != value)

View file

@ -0,0 +1,36 @@
GDTEST_OK
false
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true

View file

@ -0,0 +1,16 @@
# https://github.com/godotengine/godot/issues/61636
const External := preload("const_class_reference_external.notest.gd")
class Class1:
class Class2:
pass
const Class1Alias = Class1
const Class1Class2Alias = Class1.Class2
const ExternalAlias = External
const ExternalClassAlias = External.Class
func test():
pass

View file

@ -0,0 +1,10 @@
const array: Array = [0]
const dictionary := {1: 2}
@warning_ignore("assert_always_true")
func test():
assert(array.is_read_only() == true)
assert(str(array) == '[0]')
assert(dictionary.is_read_only() == true)
assert(str(dictionary) == '{ 1: 2 }')
print('ok')

View file

@ -0,0 +1,2 @@
GDTEST_OK
ok

View file

@ -0,0 +1,19 @@
func literal(x: float = 1):
print('x is ', x)
print('typeof x is ', typeof(x))
var inferring := 2
func inferred(x: float = inferring):
print('x is ', x)
print('typeof x is ', typeof(x))
var weakling = 3
func weak(x: float = weakling):
print('x is ', x)
print('typeof x is ', typeof(x))
func test():
literal()
inferred()
weak()
print('ok')

View file

@ -0,0 +1,8 @@
GDTEST_OK
x is 1
typeof x is 3
x is 2
typeof x is 3
x is 3
typeof x is 3
ok

View file

@ -0,0 +1,11 @@
class Foo extends Node:
func _init():
name = 'f'
var string: String = name
assert(typeof(string) == TYPE_STRING)
assert(string == 'f')
print('ok')
func test():
var foo := Foo.new()
foo.free()

View file

@ -0,0 +1,10 @@
# https://github.com/godotengine/godot/issues/70319
class InnerClass:
pass
func test():
var inner_ctor : Callable = InnerClass.new
print(inner_ctor)
var native_ctor : Callable = Node.new
print(native_ctor)

View file

@ -0,0 +1,3 @@
GDTEST_OK
GDScript::new
GDScriptNativeClass::new

View file

@ -0,0 +1,20 @@
extends Node
@onready var later_inferred := [1]
@onready var later_static: Array
@onready var later_static_with_init: Array = [1]
@onready var later_untyped = [1]
func test():
assert(typeof(later_inferred) == TYPE_ARRAY)
assert(later_inferred.size() == 0)
assert(typeof(later_static) == TYPE_ARRAY)
assert(later_static.size() == 0)
assert(typeof(later_static_with_init) == TYPE_ARRAY)
assert(later_static_with_init.size() == 0)
assert(typeof(later_untyped) == TYPE_NIL)
print("ok")

View file

@ -0,0 +1,2 @@
GDTEST_OK
ok

View file

@ -0,0 +1,19 @@
# https://github.com/godotengine/godot/issues/48121
func test():
var x := Dictionary()
var y := Dictionary()
y[0]=1
y[1]=1
y[2]=1
print("TEST OTHER DICTIONARY: " + str(len(x)))
x.clear()
x = Dictionary().duplicate()
y = Dictionary().duplicate()
y[0]=1
y[1]=1
y[2]=1
print("TEST OTHER DICTIONARY: " + str(len(x)))
x.clear()
return

View file

@ -0,0 +1,3 @@
GDTEST_OK
TEST OTHER DICTIONARY: 0
TEST OTHER DICTIONARY: 0

View file

@ -0,0 +1,17 @@
# https://github.com/godotengine/godot/issues/62957
func test():
var string_dict = {}
string_dict["abc"] = 42
var stringname_dict = {}
stringname_dict[&"abc"] = 24
print("String key is TYPE_STRING: ", typeof(string_dict.keys()[0]) == TYPE_STRING)
print("StringName key is TYPE_STRING: ", typeof(stringname_dict.keys()[0]) == TYPE_STRING)
print("StringName gets String: ", string_dict.get(&"abc"))
print("String gets StringName: ", stringname_dict.get("abc"))
stringname_dict[&"abc"] = 42
# They compare equal because StringName keys are converted to String.
print("String Dictionary == StringName Dictionary: ", string_dict == stringname_dict)

View file

@ -0,0 +1,6 @@
GDTEST_OK
String key is TYPE_STRING: true
StringName key is TYPE_STRING: true
StringName gets String: 42
String gets StringName: 24
String Dictionary == StringName Dictionary: true

View file

@ -0,0 +1,17 @@
# https://github.com/godotengine/godot/issues/71177
func test():
builtin_method()
builtin_method_static()
print("done")
func builtin_method():
var pba := PackedByteArray()
@warning_ignore("return_value_discarded")
pba.resize(1) # Built-in validated.
func builtin_method_static():
var _pba := PackedByteArray()
@warning_ignore("return_value_discarded")
Vector2.from_angle(PI) # Static built-in validated.

View file

@ -0,0 +1,12 @@
# https://github.com/godotengine/godot/issues/89439
extends Node
signal my_signal
func async_func():
await my_signal
my_signal.emit()
func test():
async_func()
my_signal.emit()

View file

@ -0,0 +1 @@
GDTEST_OK

View file

@ -0,0 +1,22 @@
# https://github.com/godotengine/godot/issues/89439
signal my_signal
func foo():
print("Foo")
my_signal.emit()
func bar():
print("Bar")
func baz():
print("Baz")
func test():
@warning_ignore("return_value_discarded")
my_signal.connect(foo, CONNECT_ONE_SHOT)
@warning_ignore("return_value_discarded")
my_signal.connect(bar, CONNECT_ONE_SHOT)
@warning_ignore("return_value_discarded")
my_signal.connect(baz)
my_signal.emit()

Some files were not shown because too many files have changed in this diff Show more