Add non-POD structure test for method or event parameter reference passing via scripting bindings
This commit is contained in:
@@ -107,7 +107,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int TestMethod(string str, ref TestStructPOD pod, TestStruct[] struct1, ref TestStruct[] struct2, out Object[] objects)
|
||||
public override int TestMethod(string str, ref TestStructPOD pod, ref TestStruct nonPod, TestStruct[] struct1, ref TestStruct[] struct2, out Object[] objects)
|
||||
{
|
||||
objects = new Object[3];
|
||||
if (struct1 == null || struct1.Length != 1)
|
||||
@@ -124,7 +124,7 @@ namespace FlaxEngine
|
||||
pod.Vector = Float3.Half;
|
||||
|
||||
// Test C++ base method invocation
|
||||
return str.Length + base.TestMethod(str, ref pod, struct1, ref struct2, out _);
|
||||
return str.Length + base.TestMethod(str, ref pod, ref nonPod, struct1, ref struct2, out _);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -134,18 +134,22 @@ namespace FlaxEngine
|
||||
return str.Length + base.TestInterfaceMethod(str);
|
||||
}
|
||||
|
||||
private void OnSimpleEvent(int arg1, Float3 arg2, string arg3, ref string arg4, TestStruct[] arg5, ref TestStruct[] arg6)
|
||||
private void OnSimpleEvent(int arg1, Float3 arg2, string arg3, ref string arg4, ref TestStruct nonPod, TestStruct[] arg5, ref TestStruct[] arg6)
|
||||
{
|
||||
// Verify that C++ passed proper data to C# via event bindings
|
||||
if (arg1 == 1 &&
|
||||
arg2 == Float3.One &&
|
||||
arg3 == "1" &&
|
||||
arg4 == "2" &&
|
||||
nonPod.Object == null &&
|
||||
nonPod.Vector == Float3.One &&
|
||||
arg5 != null && arg5.Length == 1 && arg5[0] == SimpleStruct &&
|
||||
arg6 != null && arg6.Length == 1 && arg6[0] == SimpleStruct)
|
||||
{
|
||||
// Test passing data back from C# to C++
|
||||
SimpleField = 4;
|
||||
nonPod.Object = this;
|
||||
nonPod.Vector = Float3.UnitY;
|
||||
arg4 = "4";
|
||||
arg6 = new TestStruct[2]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user