[mmptest] Reuse the existing iOS version of the link-data-contract-1 test. Partial fix for #4975. (#6535)

We already have an iOS version of the link-data-contract-1 test (from which
the link-data-contract-1 test was originally ported), so reuse that version
now.

Fixes part of https://github.com/xamarin/xamarin-macios/issues/4975.
This commit is contained in:
Rolf Bjarne Kvinge 2019-07-09 06:18:29 -07:00 коммит произвёл GitHub
Родитель b60d7a287c
Коммит 87a6dc5fd4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 5 добавлений и 204 удалений

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

@ -13,11 +13,7 @@ using System.Runtime.Serialization;
using System.Text;
using System.Xml;
#if XAMCORE_2_0
using Foundation;
#else
using MonoTouch.Foundation;
#endif
using NUnit.Framework;

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

@ -58,6 +58,8 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="System.Xml" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
@ -69,6 +71,9 @@
<Compile Include="..\..\..\common\mac\Mac.cs">
<Link>Mac.cs</Link>
</Compile>
<Compile Include="..\..\ios\link all\DataContractTest.cs">
<Link>DataContractTest.cs</Link>
</Compile>
<Compile Include="..\..\BaseOptimizeGeneratedCodeTest.cs" />
<Compile Include="LinkAllTest.cs" />
<Compile Include="..\..\..\common\PlatformInfo.cs">

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

@ -23,7 +23,6 @@ TESTS_4_0 = \
system-mono-profile \
DISABLED_TESTS_MONO_4_2 = \
link-data-contract-1 \
link-webclient-2 \
link-xml-serialization \

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

@ -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-data-contract-1</string>
<key>CFBundleIdentifier</key>
<string>com.your-company.linkdatacontract1</string>
<key>CFBundleName</key>
<string>link-data-contract-1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>

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

@ -1,73 +0,0 @@
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Xml;
using MonoMac.AppKit;
using MonoMac.Foundation;
// Test
// * application roundtrip some data using DataContract
// * Adapted from iOS linkall.app, based on bug #11135
//
// Requirement
// * Link SDK or Link All must be enabled
namespace Xamarin.Mac.Linker.Test {
[DataContract(Namespace = "mb")][Flags]
public enum SomeTypes {
[Preserve (AllMembers = true)][EnumMember] None = 0,
[Preserve (AllMembers = true)][EnumMember] Image = 1,
[Preserve (AllMembers = true)][EnumMember] Audio = 2,
[Preserve (AllMembers = true)][EnumMember] Video = 4,
[Preserve (AllMembers = true)][EnumMember] Document = 8
}
public class TestClass
{
public TestClass (SomeTypes types)
{
Types = types;
}
public SomeTypes Types { get; set; }
}
class DataContract {
public static string ToXml<T> (T obj)
{
var sb = new StringBuilder();
using (var x = XmlWriter.Create (sb, new XmlWriterSettings ())) {
var s = new DataContractSerializer (typeof (T));
s.WriteObject(x, obj);
}
return sb.ToString();
}
public static T FromXml<T> (string xml)
{
using (var r = XmlReader.Create (new StringReader (xml))) {
var s = new DataContractSerializer (typeof (T));
return (T) s.ReadObject (r);
}
}
static void Main (string[] args)
{
NSApplication.Init ();
Test.EnsureLinker (true);
var t1 = new TestClass (SomeTypes.Audio | SomeTypes.Image);
var st = ToXml<TestClass> (t1);
var t2 = FromXml<TestClass> (st);
bool success = t2.Types == t1.Types;
Test.Log.WriteLine ("[{0}]\tDataContract roundtrip", success ? "PASS" : "FAIL");
Test.Terminate ();
}
}
}

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

@ -1,96 +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>{CCE59D9C-CA71-4DB8-8156-98D7A9428534}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>linkdatacontract1</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>link-data-contract-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="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="XamMac" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
</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="LinkDataContract1.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="..\common\MainMenu.xib">
<Link>MainMenu.xib</Link>
</InterfaceDefinition>
</ItemGroup>
</Project>

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

@ -31,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-safe-1", "link-safe-1\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-frameworks-1", "link-frameworks-1\link-frameworks-1.csproj", "{842CDD77-7FC8-4BAB-AF69-C6C0D9DB217C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-data-contract-1", "link-data-contract-1\link-data-contract-1.csproj", "{CCE59D9C-CA71-4DB8-8156-98D7A9428534}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-nativebuilder-1", "link-nativebuilder-1\link-nativebuilder-1.csproj", "{D37FC010-0D17-4B68-ABA8-33BA599CD94C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link-blocks-1", "link-blocks-1\link-blocks-1.csproj", "{26634789-2957-4A78-BBF0-929BCA74440F}"
@ -164,12 +162,6 @@ Global
{CA9DCC2E-8DD6-4E73-A5E4-980028A9436C}.Debug|x86.Build.0 = Debug|x86
{CA9DCC2E-8DD6-4E73-A5E4-980028A9436C}.Release|x86.ActiveCfg = Release|x86
{CA9DCC2E-8DD6-4E73-A5E4-980028A9436C}.Release|x86.Build.0 = Release|x86
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.AppStore|x86.ActiveCfg = AppStore|Any CPU
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.AppStore|x86.Build.0 = AppStore|Any CPU
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.Debug|x86.ActiveCfg = Debug|Any CPU
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.Debug|x86.Build.0 = Debug|Any CPU
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.Release|x86.ActiveCfg = Release|Any CPU
{CCE59D9C-CA71-4DB8-8156-98D7A9428534}.Release|x86.Build.0 = Release|Any CPU
{D37FC010-0D17-4B68-ABA8-33BA599CD94C}.AppStore|x86.ActiveCfg = AppStore|Any CPU
{D37FC010-0D17-4B68-ABA8-33BA599CD94C}.AppStore|x86.Build.0 = AppStore|Any CPU
{D37FC010-0D17-4B68-ABA8-33BA599CD94C}.Debug|x86.ActiveCfg = Debug|Any CPU