[tests][mmp] Convert old mmp calendar regression tests to unit tests (#4983)

This commit is contained in:
Sebastien Pouliot 2018-10-15 11:15:20 -04:00 коммит произвёл GitHub
Родитель 250fd976a4
Коммит e8b87b77d7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 30 добавлений и 310 удалений

Просмотреть файл

@ -9,9 +9,21 @@ namespace LinkAllTests
[Preserve (AllMembers = true)] [Preserve (AllMembers = true)]
public class LinkAllTest public class LinkAllTest
{ {
[Test]
public void Existence () static void Check (string calendarName, bool present)
{ {
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type != null);
Assert.AreEqual (present, type != null, calendarName);
}
[Test]
public void Calendars ()
{
Check ("GregorianCalendar", true);
Check ("UmAlQuraCalendar", false);
Check ("HijriCalendar", false);
Check ("ThaiBuddhistCalendar", false);
} }
} }
} }

Просмотреть файл

@ -9,9 +9,21 @@ namespace LinkSdkTests
[Preserve (AllMembers = true)] [Preserve (AllMembers = true)]
public class LinkSdkTest public class LinkSdkTest
{ {
[Test] static void Check (string calendarName, bool present)
public void Existence ()
{ {
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type != null);
Assert.AreEqual (present, type != null, calendarName);
}
[Test]
public void Calendars ()
{
Check ("GregorianCalendar", true);
// because project options enabled them
Check ("UmAlQuraCalendar", true);
Check ("HijriCalendar", true);
Check ("ThaiBuddhistCalendar", true);
} }
} }
} }

Просмотреть файл

@ -31,6 +31,7 @@
<LinkMode>SdkOnly</LinkMode> <LinkMode>SdkOnly</LinkMode>
<XamMacArch></XamMacArch> <XamMacArch></XamMacArch>
<AOTMode>None</AOTMode> <AOTMode>None</AOTMode>
<I18n>mideast,other</I18n>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType></DebugType> <DebugType></DebugType>
@ -49,6 +50,7 @@
<HttpClientHandler></HttpClientHandler> <HttpClientHandler></HttpClientHandler>
<XamMacArch></XamMacArch> <XamMacArch></XamMacArch>
<AOTMode>None</AOTMode> <AOTMode>None</AOTMode>
<I18n>mideast,other</I18n>
<CodeSigningKey>Mac Developer</CodeSigningKey> <CodeSigningKey>Mac Developer</CodeSigningKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey> <PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
</PropertyGroup> </PropertyGroup>

Просмотреть файл

@ -24,8 +24,6 @@ TESTS_4_0 = \
link-frameworks-1 \ link-frameworks-1 \
link-aes-1 \ link-aes-1 \
link-blocks-1 \ link-blocks-1 \
link-preserve-calendar-1 \
link-preserve-calendar-2 \
link-typedescriptor-1 \ link-typedescriptor-1 \
link-typedescriptor-2 \ link-typedescriptor-2 \
embedded-mono \ embedded-mono \

Просмотреть файл

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>link-preserve-calendar-1</string>
<key>CFBundleIdentifier</key>
<string>com.your-company.linkpreservecalendar1</string>
<key>CFBundleName</key>
<string>link-preserve-calendar-1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>

Просмотреть файл

@ -1,36 +0,0 @@
using System;
using MonoMac.AppKit;
// Test
// * application .exe does not *directly* use any Calendar
// * only the default GregorianCalendar is linked in
//
// Requirement
// * Link SDK or Link All must be enabled
namespace Xamarin.Mac.Linker.Test {
class PreserveCalendar {
static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type != null);
Test.Log.WriteLine ("[{0}]\t{1} {2}", success ? "PASS" : "FAIL", calendarName, present ? "present" : "absent");
}
static void Main (string[] args)
{
NSApplication.Init ();
Test.EnsureLinker (true);
Check ("GregorianCalendar", true);
Check ("UmAlQuraCalendar", false);
Check ("HijriCalendar", false);
Check ("ThaiBuddhistCalendar", false);
Test.Terminate ();
}
}
}

Просмотреть файл

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{910B8B76-46C3-4550-AB5C-BD813F053A98}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>linkpreservecalendar1</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-preserve-calendar-1</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
<I18n>
</I18n>
<LinkMode>Full</LinkMode>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<CreatePackage>true</CreatePackage>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>true</EnablePackageSigning>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<ItemGroup>
<Reference Include="XamMac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\common\Test.cs">
<Link>Test.cs</Link>
</Compile>
<Compile Include="LinkPreserveCalendar1.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="..\common\MainMenu.xib">
<Link>MainMenu.xib</Link>
</InterfaceDefinition>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>link-preserve-calendar-2</string>
<key>CFBundleIdentifier</key>
<string>com.your-company.linkpreservecalendar2</string>
<key>CFBundleName</key>
<string>link-preserve-calendar-2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>

Просмотреть файл

@ -1,36 +0,0 @@
using System;
using MonoMac.AppKit;
// Test
// * application .exe does not *directly* use any Calendar
// * -i18n option is used to keep MidEast and Other so their calendars are also preserved
//
// Requirement
// * Link SDK or Link All must be enabled
namespace Xamarin.Mac.Linker.Test {
class PreserveCalendar {
static void Check (string calendarName, bool present)
{
var type = Type.GetType ("System.Globalization." + calendarName);
bool success = present == (type != null);
Test.Log.WriteLine ("[{0}]\t{1} {2}", success ? "PASS" : "FAIL", calendarName, present ? "present" : "absent");
}
static void Main (string[] args)
{
NSApplication.Init ();
Test.EnsureLinker (true);
Check ("GregorianCalendar", true);
Check ("UmAlQuraCalendar", true);
Check ("HijriCalendar", true);
Check ("ThaiBuddhistCalendar", true);
Test.Terminate ();
}
}
}

Просмотреть файл

@ -1,98 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88BD48BB-BF1C-40B2-90C0-3C2C644E3037}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>linkpreservecalendar2</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-preserve-calendar-2</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
<I18n>mideast,other</I18n>
<LinkMode>Full</LinkMode>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<EnablePackageSigning>false</EnablePackageSigning>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<CreatePackage>true</CreatePackage>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
<I18n>mideast,other</I18n>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<LinkMode>Full</LinkMode>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>3rd Party Mac Developer Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>true</EnablePackageSigning>
<I18n>
</I18n>
<UseRefCounting>false</UseRefCounting>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="XamMac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\common\Test.cs">
<Link>Test.cs</Link>
</Compile>
<Compile Include="LinkPreserveCalendar2.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="..\common\MainMenu.xib">
<Link>MainMenu.xib</Link>
</InterfaceDefinition>
</ItemGroup>
</Project>