Skip to content

Commit 50bb710

Browse files
committed
Add new test to check auto generated delegate type(s)
1 parent 775c4bf commit 50bb710

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

tests/Java.Interop.Export-Tests/Java.Interop/ExportTest.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,66 @@ public static bool StaticFuncThisMethodTakesLotsOfParameters (
159159
return false;
160160
return true;
161161
}
162+
163+
[JavaCallable ("staticManyParametersWithAutogeneratedDelegateType", Signature="(IBCSIJFDLjava/lang/Object;Ljava/lang/String;Ljava/util/ArrayList;Ljava/lang/String;Ljava/lang/Object;DFJII)Z")]
164+
public static int staticManyParametersWithAutogeneratedDelegateType (
165+
bool a,
166+
sbyte b,
167+
char c,
168+
short d,
169+
int e,
170+
long f,
171+
float g,
172+
double h,
173+
IntPtr i, // java.lang.Object
174+
IntPtr j, // java.lang.String
175+
IntPtr k, // java.util.ArrayList<String>
176+
IntPtr l, // java.lang.String
177+
IntPtr m, // java.lang.Object
178+
double n,
179+
float o,
180+
long p,
181+
int q,
182+
int rv)
183+
{
184+
if (a != false)
185+
return -1;
186+
if (b != (byte) 0xb)
187+
return -1;
188+
if (c != 'c')
189+
return -1;
190+
if (d != (short) 0xd)
191+
return -1;
192+
if (e != 0xe)
193+
return -1;
194+
if (f != 0xf)
195+
return -1;
196+
if (g != 1.0f)
197+
return -1;
198+
if (h != 2.0)
199+
return -1;
200+
if (i == IntPtr.Zero)
201+
return -1;
202+
if (j == IntPtr.Zero)
203+
return -1;
204+
if (k == IntPtr.Zero)
205+
return -1;
206+
if (l == IntPtr.Zero)
207+
return -1;
208+
if (m == IntPtr.Zero)
209+
return -1;
210+
if (n != 3.0)
211+
return -1;
212+
if (o != 4.0f)
213+
return -1;
214+
if (p != 0x70)
215+
return -1;
216+
if (q != 111111)
217+
return -1;
218+
if (rv != 222222)
219+
return -1;
220+
return rv;
221+
}
162222
}
163223

164224
[JniValueMarshaler (typeof (MyColorValueMarshaler))]

tests/Java.Interop.Export-Tests/java/com/xamarin/interop/export/ExportType.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ public static void testStaticMethods () {
3030
public static native void staticActionInt32String (int i, String s);
3131
public static native int staticFuncMyLegacyColorMyColor_MyColor (int color1, int color2);
3232

33+
public static native int staticManyParametersWithAutogeneratedDelegateType (
34+
boolean a,
35+
byte b,
36+
char c,
37+
short d,
38+
int e,
39+
long f,
40+
float g,
41+
double h,
42+
Object i,
43+
String j,
44+
ArrayList<String> k,
45+
String l,
46+
Object m,
47+
double n,
48+
float o,
49+
long p,
50+
int q,
51+
int rv);
52+
3353
public static native boolean staticFuncThisMethodTakesLotsOfParameters (
3454
boolean a,
3555
byte b,
@@ -64,6 +84,29 @@ public void testMethods () {
6484
staticActionInt (1);
6585
staticActionFloat (2.0f);
6686

87+
int ivalue = staticManyParametersWithAutogeneratedDelegateType (
88+
false,
89+
(byte) 0xb,
90+
'c',
91+
(short) 0xd,
92+
0xe,
93+
0xf,
94+
1.0f,
95+
2.0,
96+
new Object (),
97+
"j",
98+
new ArrayList<String>(),
99+
"l",
100+
new Object (),
101+
3.0,
102+
4.0f,
103+
0x70,
104+
111111,
105+
222222
106+
);
107+
if (ivalue != 222222)
108+
throw new Error ("staticManyParametersWithAutogeneratedDelegateType should return last parameter value, which is 222222");
109+
67110
boolean r = staticFuncThisMethodTakesLotsOfParameters (
68111
false,
69112
(byte) 0xb,

0 commit comments

Comments
 (0)