Skip to content

Commit

Permalink
MAUI project with non-ASCII project name cannot release to my Android…
Browse files Browse the repository at this point in the history
… phone
  • Loading branch information
dellis1972 committed May 19, 2023
1 parent da2ac33 commit b5d6f8f
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,26 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile ()
StringAssertEx.DoesNotContainRegex (@$"Using profile data file.*{filename}\.aotprofile", b.LastBuildOutput, "Should not use default AOT profile", RegexOptions.IgnoreCase);
}

[Test]
[Category ("SmokeTests")]
[TestCase ("テスト", false)]
[TestCase ("随机生成器", false)]
[TestCase ("テスト", true)]
[TestCase ("随机生成器", true)]
public void BuildAotApplicationWithSpecialCharactersInProject (string testName, bool aot)
{
var rootPath = Path.Combine (Root, "temp", TestName);
var proj = new XamarinAndroidApplicationProject () {
ProjectName = testName,
IsRelease = true,
AotAssemblies = aot,
};
proj.SetAndroidSupportedAbis ("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
}
}

static object [] AotChecks () => new object [] {
new object[] {
/* supportedAbis */ "arm64-v8a",
Expand Down
81 changes: 79 additions & 2 deletions tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,89 @@ public void MonoSymbolicateAndroidStackTrace ()
}) ;
}

static object [] AotChecks () => new object [] {
new object[] {
/* aotAssemblies */ true,
/* enableLLVM */ false,
/* usesAssemblyBlobs */ false,
/* testName*/ "テスト",
},
new object[] {
/* aotAssemblies */ false,
/* enableLLVM */ true,
/* usesAssemblyBlobs */ true,
/* testName*/ "テスト",
},
new object[] {
/* aotAssemblies */ true,
/* enableLLVM */ false,
/* usesAssemblyBlobs */ true,
/* testName*/ "テスト",
},
new object[] {
/* aotAssemblies */ false,
/* enableLLVM */ true,
/* usesAssemblyBlobs */ false,
/* testName*/ "テスト",
},
new object[] {
/* aotAssemblies */ false,
/* enableLLVM */ false,
/* usesAssemblyBlobs */ false,
/* testName*/ "随机生成器",
},
new object[] {
/* aotAssemblies */ true,
/* enableLLVM */ true,
/* usesAssemblyBlobs */ true,
/* testName*/ "随机生成器",
},
new object[] {
/* aotAssemblies */ false,
/* enableLLVM */ false,
/* usesAssemblyBlobs */ true,
/* testName*/ "随机生成器",
},
new object[] {
/* aotAssemblies */ true,
/* enableLLVM */ true,
/* usesAssemblyBlobs */ false,
/* testName*/ "随机生成器",
},
};

[Test]
[Category ("UsesDevice")]
public void SmokeTestBuildAndRunWithSpecialCharacters ()
[TestCaseSource (nameof (AotChecks))]
public void SmokeTestNativeBuildAndRunWithSpecialCharacters (bool aotAssemblies, bool enableLLVM, bool usesAssemblyBlobs, string testName)
{
var testName = "テスト";
AssertHasDevices ();

var rootPath = Path.Combine (Root, "temp", TestName);
var proj = new XamarinAndroidApplicationProject () {
ProjectName = testName,
AotAssemblies = aotAssemblies,
IsRelease = true,
};
proj.SetProperty ("EnableLLVM", enableLLVM.ToString ());
proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ());
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetDefaultTargetDevice ();
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
Assert.IsTrue (builder.RunTarget (proj, "_Run", doNotCleanupOnUpdate: true), "Project should have run.");
var timeoutInSeconds = 120;
Assert.IsTrue (WaitForActivityToStart (proj.PackageName, "MainActivity",
Path.Combine (Root, builder.ProjectDirectory, "startup-logcat.log"), timeoutInSeconds));
}
}

[Test]
[Category ("UsesDevice")]
[TestCase ("テスト")]
[TestCase ("随机生成器")]
public void SmokeTestBuildAndRunWithSpecialCharacters (string testName)
{
var rootPath = Path.Combine (Root, "temp", TestName);
var proj = new XamarinFormsAndroidApplicationProject () {
ProjectName = testName,
Expand Down

0 comments on commit b5d6f8f

Please sign in to comment.