diff --git a/harness/tests/scripts/godot/tests/Invocation.gdj b/harness/tests/scripts/godot/tests/Invocation.gdj index fdb7977afc..b6ae0b42f1 100644 --- a/harness/tests/scripts/godot/tests/Invocation.gdj +++ b/harness/tests/scripts/godot/tests/Invocation.gdj @@ -7,160 +7,160 @@ relativeSourcePath = src/main/kotlin/godot/tests/Invocation.kt baseType = Node3D supertypes = [ godot.api.Node3D, - godot.api.Node, - godot.api.Object, - godot.core.KtObject, - godot.common.interop.NativeWrapper, - godot.common.interop.NativePointer, - kotlin.Any + godot.api.Node, + godot.api.Object, + godot.core.KtObject, + godot.common.interop.NativeWrapper, + godot.common.interop.NativePointer, + kotlin.Any ] signals = [ ] properties = [ button, - enum_list, - vector_list, - enum_list_mutable, - register_object, - register_object_nullable, - register_object_nullable_pre_init, - register_object_non_nullable_pre_init, - vector, - x, - y, - z, - custom_name, - invocation, - enum_test, - resource_test, - jvm_id, - test_array_any, - nav_meshes, - nullable_array, - any_to_any_dictionary, - nav_meshes_dictionary, - nullable_dictionary, - color, - rid, - packed_byte_array, - packed_int32_array, - packed_float64_array, - packed_color_array, - packed_string_array, - packed_vector2_array, - packed_vector3_array, - p1, - p1_1, - p2, - p3, - p4, - p5, - p6, - p7, - p8, - p9, - p10, - p11, - p12, - p13, - p14, - p15, - p16, - p17, - stringtemplation, - test_string, - ascii_string, - utf8_string + enum_list, + vector_list, + enum_list_mutable, + register_object, + register_object_nullable, + register_object_nullable_pre_init, + register_object_non_nullable_pre_init, + vector, + x, + y, + z, + custom_name, + invocation, + enum_test, + resource_test, + jvm_id, + test_array_any, + nav_meshes, + nullable_array, + any_to_any_dictionary, + nav_meshes_dictionary, + nullable_dictionary, + color, + rid, + packed_byte_array, + packed_int32_array, + packed_float64_array, + packed_color_array, + packed_string_array, + packed_vector2_array, + packed_vector3_array, + p1, + p1_1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16, + p17, + stringtemplation, + test_string, + ascii_string, + utf8_string ] functions = [ int_value, - long_value, - float_value, - double_value, - boolean_value, - string_value, - int_addition, - init_nullables, - _enter_tree, - _ready, - get_rid_id, - get_nav_mesh_rid, - append_to_any_dict, - remove_from_any_dict, - get_from_any_dict, - any_dict_size, - append_to_string_nav_mesh_dict, - remove_from_string_nav_mesh_dict, - get_from_string_nav_mesh_dict, - string_nav_mesh_dict_size, - append_to_string_nav_mesh_nullable_dict, - remove_from_string_nav_mesh_nullable_dict, - string_nav_mesh_nullable_dict_size, - append_nullable_standard_nav_mesh, - append_nullable_nav_mesh, - remove_nullable_nav_mesh, - remove_nullable_nav_mesh_with_index, - nullable_nav_meshes_size, - append_standard_nav_mesh, - append_nav_mesh, - remove_nav_mesh, - remove_nav_mesh_with_index, - get_nav_mesh_from_array, - nav_meshes_size, - append_any_to_array, - remove_any_from_array, - get_any_from_array, - array_any_size, - count_namesh_instance, - get_nav_mesh_count, - parent_is_node3_d, - is_object_node3_d, - other_jvm_id, - has_camera_node, - add_byte_to_packed_array, - add_byte_array_to_packed_array, - delete_byte_from_packed_array, - get_byte_from_packed_array, - set_byte_in_packed_array, - resize_byte_packed_array, - add_color_to_packed_array, - add_color_array_to_packed_array, - delete_color_from_packed_array, - get_color_from_packed_array, - set_color_in_packed_array, - resize_color_packed_array, - add_int_to_packed_array, - add_int_array_to_packed_array, - delete_int_from_packed_array, - get_int_from_packed_array, - set_int_in_packed_array, - resize_int_packed_array, - add_real_to_packed_array, - add_real_array_to_packed_array, - read_string_from_byte_array, - delete_real_from_packed_array, - get_real_from_packed_array, - set_real_in_packed_array, - resize_real_packed_array, - add_string_to_packed_array, - add_string_array_to_packed_array, - delete_string_from_packed_array, - get_string_from_packed_array, - set_string_in_packed_array, - resize_string_packed_array, - add_vector2_to_packed_array, - add_vector2_array_to_packed_array, - delete_vector2_from_packed_array, - get_vector2_from_packed_array, - set_vector2_in_packed_array, - resize_vector2_packed_array, - add_vector3_to_packed_array, - add_vector3_array_to_packed_array, - delete_vector3_from_packed_array, - get_vector3_from_packed_array, - set_vector3_in_packed_array, - resize_vector3_packed_array, - is_sent_xr_same_instance_as_jvm_singleton, - create_variant_array_of_user_type -] + long_value, + float_value, + double_value, + boolean_value, + string_value, + int_addition, + init_nullables, + _enter_tree, + _ready, + get_rid_id, + get_nav_mesh_rid, + append_to_any_dict, + remove_from_any_dict, + get_from_any_dict, + any_dict_size, + append_to_string_nav_mesh_dict, + remove_from_string_nav_mesh_dict, + get_from_string_nav_mesh_dict, + string_nav_mesh_dict_size, + append_to_string_nav_mesh_nullable_dict, + remove_from_string_nav_mesh_nullable_dict, + string_nav_mesh_nullable_dict_size, + append_nullable_standard_nav_mesh, + append_nullable_nav_mesh, + remove_nullable_nav_mesh, + remove_nullable_nav_mesh_with_index, + nullable_nav_meshes_size, + append_standard_nav_mesh, + append_nav_mesh, + remove_nav_mesh, + remove_nav_mesh_with_index, + get_nav_mesh_from_array, + nav_meshes_size, + append_any_to_array, + remove_any_from_array, + get_any_from_array, + array_any_size, + count_namesh_instance, + get_nav_mesh_count, + parent_is_node3_d, + is_object_node3_d, + other_jvm_id, + has_camera_node, + add_byte_to_packed_array, + add_byte_array_to_packed_array, + delete_byte_from_packed_array, + get_byte_from_packed_array, + set_byte_in_packed_array, + resize_byte_packed_array, + add_color_to_packed_array, + add_color_array_to_packed_array, + delete_color_from_packed_array, + get_color_from_packed_array, + set_color_in_packed_array, + resize_color_packed_array, + add_int_to_packed_array, + add_int_array_to_packed_array, + delete_int_from_packed_array, + get_int_from_packed_array, + set_int_in_packed_array, + resize_int_packed_array, + add_real_to_packed_array, + add_real_array_to_packed_array, + read_string_from_byte_array, + delete_real_from_packed_array, + get_real_from_packed_array, + set_real_in_packed_array, + resize_real_packed_array, + add_string_to_packed_array, + add_string_array_to_packed_array, + delete_string_from_packed_array, + get_string_from_packed_array, + set_string_in_packed_array, + resize_string_packed_array, + add_vector2_to_packed_array, + add_vector2_array_to_packed_array, + delete_vector2_from_packed_array, + get_vector2_from_packed_array, + set_vector2_in_packed_array, + resize_vector2_packed_array, + add_vector3_to_packed_array, + add_vector3_array_to_packed_array, + delete_vector3_from_packed_array, + get_vector3_from_packed_array, + set_vector3_in_packed_array, + resize_vector3_packed_array, + is_sent_xr_same_instance_as_jvm_singleton, + create_variant_array_of_user_type +] \ No newline at end of file diff --git a/harness/tests/scripts/godot/tests/JavaTestClass.gdj b/harness/tests/scripts/godot/tests/JavaTestClass.gdj index 655a8a716a..e9875e81cb 100644 --- a/harness/tests/scripts/godot/tests/JavaTestClass.gdj +++ b/harness/tests/scripts/godot/tests/JavaTestClass.gdj @@ -14,8 +14,7 @@ supertypes = [ kotlin.Any ] signals = [ - test_signal, - test_signal2 + ] properties = [ java_enum, diff --git a/harness/tests/scripts/godot/tests/packedarray/PackedArrayTest.gdj b/harness/tests/scripts/godot/tests/packedarray/PackedArrayTest.gdj index 07fa993352..1cd0293fda 100644 --- a/harness/tests/scripts/godot/tests/packedarray/PackedArrayTest.gdj +++ b/harness/tests/scripts/godot/tests/packedarray/PackedArrayTest.gdj @@ -25,9 +25,15 @@ functions = [ convert_long_array, convert_float_array, convert_double_array, + convert_vector2_array, + convert_vector3_array, + convert_vector4_array, get_byte_array_value, get_int_array_value, get_long_array_value, get_float_array_value, - get_double_array_value + get_double_array_value, + get_vector2_array_value, + get_vector3_array_value, + get_vector4_array_value ] \ No newline at end of file diff --git a/harness/tests/src/main/java/godot/tests/JavaTestClass.java b/harness/tests/src/main/java/godot/tests/JavaTestClass.java index 663bbce5c6..55a4f3784b 100644 --- a/harness/tests/src/main/java/godot/tests/JavaTestClass.java +++ b/harness/tests/src/main/java/godot/tests/JavaTestClass.java @@ -6,6 +6,7 @@ import godot.api.RenderingServer; import godot.annotation.*; import godot.core.*; +import kotlin.Unit; import org.jetbrains.annotations.NotNull; @RegisterClass @@ -13,12 +14,12 @@ public class JavaTestClass extends Node { @RegisterSignal public Signal0 testSignal = Signal0.create(this, "test_signal"); - @RegisterSignal(parameters = {"param1", "param2"}) - public Signal2 testSignal2 = Signal2.create(this, "test_signal_2"); + @RegisterSignal(parameters = {"param1"}) + public Signal1 testSignal1 = Signal1.create(this, "test_signal_2"); // The following should NOT work as we cannot extract parameter names. The compiler checks should catch that and throw a build error -// @RegisterSignal -// public Signal testSignal3 = new Signal2<>(this, "name"); + //@RegisterSignal + //public Signal testSignal3 = new Signal2<>(this, "name"); @Export @RegisterProperty @@ -71,15 +72,15 @@ public String greeting() { @RegisterProperty public Dictionary dictionary = new Dictionary<>(Float.class, String.class); - public LambdaCallable lambdaCallable = LambdaCallable0.create( - Void.class, - () -> { - System.out.println("Hello from Callable"); - return null; - } - ); - - public NativeCallable methodCallable = Callable.create(this, StringNames.asStringName("DummyName")); + //public LambdaCallable lambdaCallable = LambdaCallable0.create( + // Void.class, + // () -> { + // System.out.println("Hello from Callable"); + // return null; + // } + //); +// + //public NativeCallable methodCallable = Callable.create(this, StringNames.asStringName("DummyName")); @RegisterFunction @Override @@ -96,22 +97,16 @@ public void _ready() { @RegisterFunction public void connectAndTriggerSignal() { - connect( - StringNames.asStringName("test_signal"), - new NativeCallable(this, StringNames.asStringName("signal_callback")), - (int) ConnectFlags.ONE_SHOT.getId() - ); - emitSignal(StringNames.asStringName("test_signal")); + Callable1 callable = MethodCallable1.createUnsafe(this, Node.setNameName); + testSignal1.connect(callable, ConnectFlags.ONE_SHOT); + testSignal1.emit("test"); } @NotNull @Override public GodotNotification _notification() { return godotNotification( - this, (myself, notification) -> { - System.out.println(notification); - return null; - } + (JavaTestClass myself, int notification) -> System.out.println(notification) ); } diff --git a/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt b/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt index f6a0b33ed1..7c1582c937 100644 --- a/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt +++ b/harness/tests/src/main/kotlin/godot/tests/FuncRefTest.kt @@ -6,9 +6,10 @@ import godot.annotation.RegisterFunction import godot.annotation.RegisterProperty import godot.annotation.RegisterSignal import godot.annotation.Rpc +import godot.core.callable0 +import godot.core.callable1 import godot.core.signal0 -import godot.extension.call -import godot.extension.callDeferred +import godot.extension.connectMethod @RegisterClass class FuncRefTest : Node() { @@ -30,7 +31,7 @@ class FuncRefTest : Node() { @RegisterFunction override fun _ready() { - test.connect(this, FuncRefTest::testSignalCallback) + test.connectMethod(this, FuncRefTest::testSignalCallback) } @Rpc @@ -51,12 +52,12 @@ class FuncRefTest : Node() { @RegisterFunction fun testCallWithoutParam() { - call(this::withoutParamCallback) + callable0(this::withoutParamCallback).call() } @RegisterFunction fun testCallDeferredWithoutParam() { - callDeferred(this::withoutParamCallback) + callable0(this::withoutParamCallback).callDeferred() } @RegisterFunction @@ -66,11 +67,11 @@ class FuncRefTest : Node() { @RegisterFunction fun testCallWithParam() { - call(this::withParamCallback, true) + callable1(this::withParamCallback).call(true) } @RegisterFunction fun testCallDeferredWithParam() { - callDeferred(this::withParamCallback, true) + callable1(this::withParamCallback).callDeferred(true) } } diff --git a/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt b/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt index ed05f24a06..c841be215c 100644 --- a/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt +++ b/harness/tests/src/main/kotlin/godot/tests/GodotStaticTest.kt @@ -3,7 +3,7 @@ package godot.tests import godot.api.Node import godot.api.PackedScene import godot.api.ResourceLoader -import godot.extension.asStatic +import godot.extension.api.asStatic object GodotStaticDelegateTest { var ref = (ResourceLoader.load("res://Spatial.tscn") as PackedScene?).asStatic() diff --git a/harness/tests/src/main/kotlin/godot/tests/Invocation.kt b/harness/tests/src/main/kotlin/godot/tests/Invocation.kt index 6d249d1ce6..bdac36c7f6 100644 --- a/harness/tests/src/main/kotlin/godot/tests/Invocation.kt +++ b/harness/tests/src/main/kotlin/godot/tests/Invocation.kt @@ -38,10 +38,11 @@ import godot.core.Vector2 import godot.core.Vector3 import godot.core.dictionaryOf import godot.core.variantArrayOf -import godot.extension.getNodeAs import godot.registration.Range import godot.tests.subpackage.OtherScript import godot.common.util.RealT +import godot.extension.api.getNodeAs +import godot.extension.connectMethod import org.joda.time.DateTime enum class TestEnum { @@ -370,7 +371,7 @@ class Invocation : Node3D() { val path = NodePath("CanvasLayer/Button") val getNode2 = getNodeAs