[tests] Add unit tests for Mac Catalyst on .NET 6.
This commit is contained in:
Родитель
e71be2a09b
Коммит
913b612d6d
|
@ -40,6 +40,7 @@ namespace Xamarin.Tests
|
|||
public static bool include_tvos;
|
||||
public static bool include_watchos;
|
||||
public static bool include_dotnet_watchos;
|
||||
public static bool include_maccatalyst;
|
||||
public static bool include_device;
|
||||
|
||||
static Version xcode_version;
|
||||
|
@ -267,6 +268,7 @@ namespace Xamarin.Tests
|
|||
include_tvos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_TVOS", ""));
|
||||
include_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_WATCH", ""));
|
||||
include_dotnet_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DOTNET_WATCH", ""));
|
||||
include_maccatalyst = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MACCATALYST", ""));
|
||||
include_device = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DEVICE", ""));
|
||||
DotNet5BclDir = GetVariable ("DOTNET5_BCL_DIR", null);
|
||||
|
||||
|
@ -291,6 +293,7 @@ namespace Xamarin.Tests
|
|||
Console.WriteLine (" INCLUDE_MAC={0}", include_mac);
|
||||
Console.WriteLine (" INCLUDE_TVOS={0}", include_tvos);
|
||||
Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos);
|
||||
Console.WriteLine (" INCLUDE_MACCATALYST={0}", include_maccatalyst);
|
||||
}
|
||||
|
||||
public static string RootPath {
|
||||
|
@ -817,6 +820,10 @@ namespace Xamarin.Tests
|
|||
if (!include_mac)
|
||||
Assert.Ignore ("macOS is not included in this build");
|
||||
break;
|
||||
case ApplePlatform.MacCatalyst:
|
||||
if (!include_maccatalyst)
|
||||
Assert.Ignore ("Mac Catalyst is not included in this build");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}");
|
||||
}
|
||||
|
@ -830,6 +837,7 @@ namespace Xamarin.Tests
|
|||
case "tvos":
|
||||
case "watchos":
|
||||
case "macosx":
|
||||
case "maccatalyst":
|
||||
IgnoreIfIgnoredPlatform ((ApplePlatform) Enum.Parse (typeof (ApplePlatform), platform, true));
|
||||
break;
|
||||
case "macos":
|
||||
|
|
|
@ -100,10 +100,30 @@ namespace Xamarin.Tests {
|
|||
Assert.That (result.StandardOutput.ToString (), Does.Contain ("The specified RuntimeIdentifier 'watchos-x86' is not recognized."), "Missing runtime pack for watchOS");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildMyCatalystApp ()
|
||||
{
|
||||
var platform = ApplePlatform.MacCatalyst;
|
||||
var project_path = GetProjectPath ("MyCatalystApp");
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
Clean (project_path);
|
||||
var result = DotNet.AssertBuild (project_path, verbosity);
|
||||
AssertThatLinkerExecuted (result);
|
||||
var appPath = Path.Combine (Path.GetDirectoryName (project_path), "bin", "Debug", "net6.0-maccatalyst", "maccatalyst-x64", "MyCatalystApp.app");
|
||||
AssertAppContents (platform, appPath);
|
||||
var infoPlistPath = Path.Combine (appPath, "Contents", "Info.plist");
|
||||
var infoPlist = PDictionary.FromFile (infoPlistPath);
|
||||
Assert.AreEqual ("com.xamarin.mycatalystapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
|
||||
Assert.AreEqual ("MyCatalystApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
|
||||
Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
|
||||
Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
|
||||
}
|
||||
|
||||
[TestCase ("iOS")]
|
||||
[TestCase ("tvOS")]
|
||||
[TestCase ("watchOS")]
|
||||
[TestCase ("macOS")]
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildMyClassLibrary (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -117,6 +137,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS")]
|
||||
[TestCase ("watchOS")]
|
||||
[TestCase ("macOS")]
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildEmbeddedResourcesTest (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -150,6 +171,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS")]
|
||||
[TestCase ("watchOS")]
|
||||
[TestCase ("macOS")]
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildFSharpLibraryTest (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -177,6 +199,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS")]
|
||||
[TestCase ("watchOS")]
|
||||
[TestCase ("macOS")]
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildBindingsTest (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -208,6 +231,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS")]
|
||||
[TestCase ("watchOS")]
|
||||
[TestCase ("macOS")]
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildBindingsTest2 (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -238,6 +262,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS", "monotouch")]
|
||||
[TestCase ("watchOS", "monotouch")]
|
||||
[TestCase ("macOS", "xammac")]
|
||||
[TestCase ("MacCatalyst", "monotouch")]
|
||||
public void BuildBundledResources (string platform, string prefix)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -271,6 +296,7 @@ namespace Xamarin.Tests {
|
|||
[TestCase ("tvOS")]
|
||||
// [TestCase ("watchOS")] // No watchOS Touch.Client project for .NET yet
|
||||
// [TestCase ("macOS")] // No macOS Touch.Client project for .NET yet
|
||||
[TestCase ("MacCatalyst")]
|
||||
public void BuildInterdependentBindingProjects (string platform)
|
||||
{
|
||||
Configuration.IgnoreIfIgnoredPlatform (platform);
|
||||
|
@ -376,6 +402,7 @@ namespace Xamarin.Tests {
|
|||
info_plist_path = Path.Combine (app_directory, "Info.plist");
|
||||
break;
|
||||
case ApplePlatform.MacOSX:
|
||||
case ApplePlatform.MacCatalyst:
|
||||
info_plist_path = Path.Combine (app_directory, "Contents", "Info.plist");
|
||||
break;
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче