Skip to content

Commit

Permalink
ADd Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jan 14, 2025
1 parent b523914 commit fcc310b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace ${ROOT_NAMESPACE}
{
[Register ("${JAVA_PACKAGENAME}.MainActivity"), Activity (Label = "${PROJECT_NAME}", MainLauncher = true, Icon = "@drawable/icon")]
//${ATTRIBUTES}
public class MainActivity : Activity
{
//${FIELDS}
Expand Down
27 changes: 27 additions & 0 deletions tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,33 @@ public void DotNetRun ([Values (true, false)] bool isRelease)
Assert.IsTrue (didLaunch, "Activity should have started.");
}

[Test]
public void ActivityAliasRuns ([Values (true, false)] bool isRelease)
{
var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease
};
proj.AndroidManifest = proj.AndroidManifest.Replace ("</application>", @"
<activity-alias
android:name="".MainActivityAlias""
android:enabled=""true""
android:icon=""@drawable/icon""
android:targetActivity="".MainActivity""
android:exported=""true"">
<intent-filter>
<action android:name=""android.intent.action.MAIN"" />
<category android:name=""android.intent.category.LAUNCHER"" />
</intent-filter>
</activity-alias>
</application>");
proj.MainActivity = proj.DefaultMainActivity.Replace ("//${ATTRIBUTES}",$"[Register(\"{proj.PackageName}.MainActivity\")]").Replace("MainLauncher = true", "MainLauncher = false");
using var builder = CreateApkBuilder ();
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
RunProjectAndAssert (proj, builder);
Assert.True (WaitForActivityToStart (proj.PackageName, "MainActivityAlias",
Path.Combine (Root, builder.ProjectDirectory, "logcat.log"), 30), "Activity MainActivityAlias should have started.");
}

[Test]
public void NativeAssemblyCacheWithSatelliteAssemblies ([Values (true, false)] bool enableMarshalMethods)
{
Expand Down

0 comments on commit fcc310b

Please sign in to comment.