Skip to content

Commit 8c90367

Browse files
committed
Create .NET version of JcwGen-Tests.
1 parent c92ae5e commit 8c90367

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1393
-0
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,27 @@ stages:
709709
artifactFolder: $(DotNetTargetFramework)-AotLlvm
710710
useDotNet: true
711711

712+
- template: yaml-templates/apk-instrumentation.yaml
713+
parameters:
714+
configuration: $(XA.Build.Configuration)
715+
testName: Xamarin.Android.BindingRuntime_Tests
716+
project: tests/BindingTests/Xamarin.Android.BindingRuntime-Tests/Xamarin.Android.BindingRuntime-Tests.csproj
717+
testResultsFiles: TestResult-Xamarin.Android.BindingRuntime_Tests-$(ApkTestConfiguration).xml
718+
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.BindingRuntime_Tests-Signed.apk
719+
artifactFolder: $(DotNetTargetFramework)-Default
720+
useDotNet: true
721+
722+
- template: yaml-templates/apk-instrumentation.yaml
723+
parameters:
724+
configuration: $(XA.Build.Configuration)
725+
testName: Xamarin.Android.BindingRuntime_Tests_FastDev
726+
project: tests/BindingTests/Xamarin.Android.BindingRuntime-Tests/Xamarin.Android.BindingRuntime-Tests.csproj
727+
testResultsFiles: TestResult-Xamarin.Android.BindingRuntime_Tests_FastDev-$(ApkTestConfiguration).xml
728+
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.BindingRuntime_Tests-Signed.apk
729+
artifactFolder: $(DotNetTargetFramework)-FastDev_Assemblies_Dexes
730+
extraBuildArgs: /p:AndroidFastDeploymentType=Assemblies:Dexes
731+
useDotNet: true
732+
712733
- task: MSBuild@1
713734
displayName: shut down emulator
714735
inputs:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:label="@string/app_name" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true">
4+
</application>
5+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.INTERNET" />
8+
</manifest>
Binary file not shown.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Compile with:
2+
// kotlinc UnsignedMethods.kt -d KotlinUnsignedTypes.jar
3+
4+
package foo;
5+
6+
@kotlin.ExperimentalUnsignedTypes
7+
const val SUBSYSTEM_DEPRECATED: UInt = 3u
8+
9+
@kotlin.ExperimentalUnsignedTypes
10+
open class UnsignedInstanceMethods {
11+
public open fun unsignedInstanceMethod (value: UInt) : UInt { return value; }
12+
13+
public open fun ushortInstanceMethod (value: UShort) : UShort { return value; }
14+
15+
public open fun ulongInstanceMethod (value: ULong) : ULong { println ("kotlin: " + value); return value; }
16+
17+
public open fun ubyteInstanceMethod (value: UByte) : UByte { return value; }
18+
19+
var signedInstanceProperty: Int = 3
20+
21+
var unsignedInstanceProperty: UInt = 3u
22+
23+
var ushortInstanceProperty: UShort = 3u
24+
25+
var ulongInstanceProperty: ULong = 3u
26+
27+
var ubyteInstanceProperty: UByte = 3u
28+
29+
public open fun uintArrayInstanceMethod (value: UIntArray) : UIntArray { return value; }
30+
31+
public open fun ushortArrayInstanceMethod (value: UShortArray) : UShortArray { return value; }
32+
33+
public open fun ulongArrayInstanceMethod (value: ULongArray) : ULongArray { return value; }
34+
35+
public open fun ubyteArrayInstanceMethod (value: UByteArray) : UByteArray { return value; }
36+
37+
public open fun intArrayInstanceMethod (value: IntArray) : IntArray { return value; }
38+
}
39+
40+
@kotlin.ExperimentalUnsignedTypes
41+
open class UnsignedInterfaceImplementedMethods : UnsignedInterface {
42+
public override open fun unsignedInterfaceMethod (value: UInt) : UInt { return value; }
43+
44+
public override open fun unsignedArrayInterfaceMethod (value: UIntArray) : UIntArray { return value; }
45+
46+
override var unsignedInterfaceProperty: UInt = 3u
47+
48+
override var signedInterfaceProperty: Int = 3
49+
}
50+
51+
@kotlin.ExperimentalUnsignedTypes
52+
open class UnsignedAbstractImplementedMethods : UnsignedAbstractClass () {
53+
public override open fun unsignedAbstractMethod (value: UInt) : UInt { return value; }
54+
55+
override var unsignedAbstractClassProperty: UInt = 3u
56+
}
57+
58+
@kotlin.ExperimentalUnsignedTypes
59+
abstract class UnsignedAbstractClass {
60+
abstract fun unsignedAbstractMethod (value: UInt) : UInt
61+
62+
abstract var unsignedAbstractClassProperty: UInt
63+
}
64+
65+
@kotlin.ExperimentalUnsignedTypes
66+
interface UnsignedInterface {
67+
fun unsignedInterfaceMethod (value: UInt) : UInt
68+
69+
fun unsignedArrayInterfaceMethod (value: UIntArray) : UIntArray
70+
71+
var unsignedInterfaceProperty: UInt
72+
73+
var signedInterfaceProperty: Int
74+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.xamarin.android;
2+
3+
public class Bxc37706Throwable extends java.lang.Throwable {
4+
public String getMessage() {
5+
getMessageInvoked = true;
6+
return super.getMessage();
7+
}
8+
9+
public boolean getMessageInvoked;
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.xamarin.android;
2+
3+
import android.graphics.Canvas;
4+
5+
public class Bxc4288 {
6+
// Parameter & return type remapped to Android.Graphics.Color
7+
public int useColors (int color)
8+
{
9+
return color;
10+
}
11+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.xamarin.android;
2+
3+
public class Bxc58383
4+
extends java.util.HashMap
5+
implements java.util.Map
6+
{
7+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.xamarin.android;
2+
3+
public class Bxc7634 {
4+
5+
public boolean finallyBlockRun;
6+
7+
public void runFinallyBlock (Runnable r) {
8+
System.out.println ("Bxc7634.runFinallyBlock: start");
9+
try {
10+
r.run ();
11+
throw new Error ("Should not be reached");
12+
} finally {
13+
System.out.println ("Bxc7634.runFinallyBlock: executing finally!");
14+
finallyBlockRun = true;
15+
}
16+
}
17+
18+
public Throwable throwableCaught;
19+
20+
public void runCatchBlock (Runnable r) {
21+
System.out.println ("Bxc7634.runCatchBlock: start");
22+
try {
23+
r.run ();
24+
throw new Error ("Should not be reached");
25+
} catch (Throwable t) {
26+
System.out.println ("Bxc7634.runCatchBlock: caught exception! " + t);
27+
throwableCaught = t;
28+
}
29+
}
30+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.xamarin.android;
2+
3+
import android.content.Context;
4+
5+
/*
6+
This class exposes a build error in the code generator which was first
7+
seen in the ActionbarSherlock java bindings.
8+
For the Window class in that library a number of generated properties
9+
in the WindowInvoker class were generated like so
10+
11+
static IntPtr id_isFloating;
12+
public override global::System.Boolean IsFloating {
13+
[Register ("isFloating", "()Z", "GetGetIsFloatingHandler")]
14+
get {
15+
if (id_isFloating == IntPtr.Zero)
16+
id_isFloating = JNIEnv.GetMethodID (class_ref, "isFloating", "()Z");
17+
return global::Java.Lang.Object.GetObject<global::System.Boolean> (JNIEnv.CallBooleanMethod (Handle, id_isFloating), JniHandleOwnership.TransferLocalRef);
18+
}
19+
}
20+
21+
This results in a
22+
23+
Error CS1502: The best overloaded method match for 'Java.Lang.Object.GetObject<bool>(System.IntPtr, Android.Runtime.JniHandleOwnership)' has some invalid arguments
24+
25+
when compiling the C# code.
26+
27+
The correct generated code for the return statement in this case should be
28+
29+
return JNIEnv.CallBooleanMethod (Handle, id_isFloating);
30+
31+
This class has been put in place to check for regressions in future builds.
32+
33+
*/
34+
public abstract class Bxc9446 extends android.view.Window {
35+
36+
public Bxc9446 (Context context) {
37+
super (context);
38+
}
39+
40+
}

0 commit comments

Comments
 (0)