Skip to content

Commit cae5fb1

Browse files
committed
Add Unit Test
1 parent 3269d4a commit cae5fb1

File tree

1 file changed

+29
-0
lines changed
  • src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests

1 file changed

+29
-0
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,35 @@ public void CheckLintConfigMerging ()
15541554
}
15551555
}
15561556

1557+
[Test]
1558+
public void BuildApplicationWithJavaSourceUsingAndroidX ([Values(true, false)] bool isRelease)
1559+
{
1560+
var proj = new XamarinAndroidApplicationProject () {
1561+
IsRelease = isRelease,
1562+
OtherBuildItems = {
1563+
new BuildItem (AndroidBuildActions.AndroidJavaSource, "ToolbarEx.java") {
1564+
TextContent = () => @"package com.unnamedproject.unnamedproject;
1565+
import android.content.Context;
1566+
import androidx.appcompat.widget.Toolbar;
1567+
public class ToolbarEx {
1568+
public static Toolbar GetToolbar (Context context) {
1569+
return new Toolbar (context);
1570+
}
1571+
}
1572+
",
1573+
Encoding = Encoding.ASCII
1574+
},
1575+
}
1576+
};
1577+
proj.PackageReferences.Add (KnownPackages.AndroidXAppCompat);
1578+
using (var b = CreateApkBuilder ()) {
1579+
b.ThrowOnBuildFailure = false;
1580+
Assert.IsTrue (b.Build (proj), "Build should have succeeded");
1581+
1582+
Assert.IsTrue (b.Clean (proj), "Clean should have succeeded.");
1583+
}
1584+
}
1585+
15571586
[Test]
15581587
public void BuildApplicationCheckThatAddStaticResourcesTargetDoesNotRerun ()
15591588
{

0 commit comments

Comments
 (0)