Коммит
3ab8d24268
|
@ -1,4 +1,26 @@
|
|||
*-tvos.csproj
|
||||
*-watchos.csproj
|
||||
*-unified.csproj
|
||||
index.html
|
||||
*.log
|
||||
*-unified.sln
|
||||
TestResult.xml
|
||||
build
|
||||
*-tvos.?sproj
|
||||
*-tvos.sln
|
||||
*-watchos.?sproj
|
||||
*-watchos-app.?sproj
|
||||
*-watchos-extension.?sproj
|
||||
*-watchos.sln
|
||||
*-tvos.plist
|
||||
*-watchos.plist
|
||||
*-unified.?sproj
|
||||
*-unifiedXM45.?sproj
|
||||
*-unifiedXM45.sln
|
||||
Makefile-mac.inc
|
||||
.stamp*
|
||||
Info-*.plist
|
||||
*.zip
|
||||
Makefile.inc
|
||||
*.stamp
|
||||
test.config
|
||||
mac-test-package
|
||||
.nuget
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?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>{FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>BundledResources</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>BundledResources</AssemblyName>
|
||||
<TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<DefineConstants>DO_NOT_REMOVE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="..\monotouch-test\basn3p08.png">
|
||||
<Link>basn3p08.png</Link>
|
||||
</BundleResource>
|
||||
<BundleResource Include="..\monotouch-test\xamvideotest.mp4">
|
||||
<Link>xamvideotest.mp4</Link>
|
||||
</BundleResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ResourcesTest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// Resource Bundling Tests
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2013 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace BundledResources {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class ResourcesTest {
|
||||
|
||||
[Test]
|
||||
public void Bundled ()
|
||||
{
|
||||
// files are extracted (by MonoDevelop) so we can see them in the file system
|
||||
// that's true for simulator or devices and whatever the linker settings are
|
||||
var dir = NSBundle.MainBundle.BundlePath;
|
||||
Assert.True (File.Exists (Path.Combine (dir, "basn3p08.png")), "file-basn3p08.png");
|
||||
Assert.True (File.Exists (Path.Combine (dir, "xamvideotest.mp4")), "xamvideotest.mp4");
|
||||
|
||||
// resources are removed by the linker or an extra step (e.g. "link sdk" or "don't link") but that
|
||||
// extra step is done only on device (to keep the simulator builds as fast as possible)
|
||||
var resources = typeof(ResourcesTest).Assembly.GetManifestResourceNames ();
|
||||
if (Runtime.Arch == Arch.DEVICE) {
|
||||
Assert.That (resources.Length, Is.EqualTo (0), "No resources");
|
||||
} else {
|
||||
Assert.That (resources.Length, Is.GreaterThanOrEqualTo (2), "Resources");
|
||||
Assert.That (resources, Contains.Item ("__monotouch_content_basn3p08.png"), "res-basn3p08.png");
|
||||
Assert.That (resources, Contains.Item ("__monotouch_content_xamvideotest.mp4"), "res-xamvideotest.mp4");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?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>{676F527D-3352-42EA-9DE2-181C45003568}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>EmbeddedResources</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>EmbeddedResources</AssemblyName>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\..\xamarin-macios\product.snk</AssemblyOriginatorKeyFile>
|
||||
<TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<DefineConstants>DO_NOT_REMOVE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ResourcesTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Welcome.resx" />
|
||||
<EmbeddedResource Include="Welcome.es.resx" />
|
||||
<EmbeddedResource Include="Welcome.de.resx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// Resource Bundling Tests
|
||||
//
|
||||
// Authors:
|
||||
// Rolf Bjarne Kvinge (rolf@xamarin.com)
|
||||
//
|
||||
// Copyright 2013 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Resources;
|
||||
using System.Globalization;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace EmbeddedResources {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class ResourcesTest {
|
||||
|
||||
[Test]
|
||||
public void Embedded ()
|
||||
{
|
||||
var manager = new ResourceManager ("EmbeddedResources.Welcome", typeof(ResourcesTest).Assembly);
|
||||
|
||||
Assert.AreEqual ("Welcome", manager.GetString ("String1", new CultureInfo ("en")), "en");
|
||||
Assert.AreEqual ("Willkommen", manager.GetString ("String1", new CultureInfo ("de")), "de");
|
||||
Assert.AreEqual ("Bienvenido", manager.GetString ("String1", new CultureInfo ("es")), "es");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="String1" xml:space="preserve">
|
||||
<value>Willkommen</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="String1" xml:space="preserve">
|
||||
<value>Bienvenido</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="String1" xml:space="preserve">
|
||||
<value>Welcome</value>
|
||||
</data>
|
||||
</root>
|
345
tests/Makefile
345
tests/Makefile
|
@ -1,5 +1,342 @@
|
|||
TOP=..
|
||||
include $(TOP)/Make.config
|
||||
TOP = ../../xamarin-macios
|
||||
|
||||
ifdef INCLUDE_MAC
|
||||
SUBDIRS += no-mmp
|
||||
endif
|
||||
# disabled for now: mac-test
|
||||
|
||||
include $(TOP)/Make.config
|
||||
include $(TOP)/mk/rules.mk
|
||||
|
||||
MTOUCH=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch
|
||||
UNIT_SERVER_DIR=$(TOUCH_UNIT_PATH)/Touch.Server
|
||||
UNIT_SERVER=$(UNIT_SERVER_DIR)/bin/Debug/Touch.Server.exe
|
||||
TEST_SUITES=monotouch-test link\ sdk link\ all dont\ link framework-test mini
|
||||
BCL_TEST_SUITES=mscorlib System System.Core System.Data System.Net.Http System.Numerics System.Runtime.Serialization System.Transactions System.Web.Services System.Xml System.Xml.Linq Mono.Security System.ComponentModel.DataAnnotations System.Json System.ServiceModel.Web Mono.Data.Sqlite
|
||||
ALL_TEST_SUITES=$(TEST_SUITES) $(BCL_TEST_SUITES)
|
||||
EXEC_UNIT_SERVER=XCODE_DEVELOPER_ROOT=$(XCODE_DEVELOPER_ROOT) MONOTOUCH_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) $(SYSTEM_MONO) --debug $(UNIT_SERVER)
|
||||
|
||||
export MD_APPLE_SDK_ROOT=$(abspath $(XCODE_DEVELOPER_ROOT)/../..)
|
||||
export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)
|
||||
export XBUILD_FRAMEWORK_FOLDERS_PATH=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks
|
||||
export MSBuildExtensionsPath=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild
|
||||
export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
|
||||
export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
|
||||
|
||||
ifneq ($(RELEASE),)
|
||||
CONFIG=Release
|
||||
else
|
||||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
ifeq ($(V),)
|
||||
ifeq ($(BUILD_REVISION),)
|
||||
# non-verbose local build
|
||||
XHARNESS_VERBOSITY=
|
||||
else
|
||||
# wrench build
|
||||
XHARNESS_VERBOSITY=--verbose
|
||||
endif
|
||||
else
|
||||
# verbose build
|
||||
XHARNESS_VERBOSITY=--verbose
|
||||
endif
|
||||
|
||||
#
|
||||
# To run all the tests, just do:
|
||||
#
|
||||
# make run-tests
|
||||
#
|
||||
# and go take a long tea break.
|
||||
#
|
||||
# For faster turnaround there are specific targets that can be used
|
||||
# to run specific test suites. For more information read the README.md.
|
||||
#
|
||||
|
||||
all-local:: qa-test-dependencies.zip mac-test-package.zip
|
||||
|
||||
test.config: Makefile $(TOP)/Make.config
|
||||
@rm -f $@
|
||||
@echo "MONOTOUCH_PREFIX=$(abspath $(MONOTOUCH_PREFIX))" >> $@
|
||||
@echo "IOS_DESTDIR=$(abspath $(IOS_DESTDIR))" >> $@
|
||||
@echo "MAC_DESTDIR=$(abspath $(MAC_DESTDIR))" >> $@
|
||||
@echo "WATCH_MONO_PATH=$(abspath $(WATCH_MONO_PATH))" >> $@
|
||||
|
||||
clean-local::
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhone /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-unified.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhone /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-unified.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-tvos.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-tvos.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhone /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-watchos.sln
|
||||
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhone /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests-watchos.sln
|
||||
|
||||
## run targets = build + [install] + exec
|
||||
|
||||
run run-all run-tests run-test:
|
||||
$(Q) for subdir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$subdir run || exit 1; \
|
||||
done
|
||||
$(Q) $(MAKE) run-local
|
||||
|
||||
# separate build-dev-* entries because some of them are build with debug other (llvm) with release
|
||||
build-dev-bots: build-test-libraries
|
||||
# test LLVM armv6, this is Classic only because arm64 doesn't have llvm support.
|
||||
$(MAKE) "build-ios-devclassic-dont link" CONFIG=Release
|
||||
# test LLVM armv7, this is Classic only because arm64 doesn't have llvm support.
|
||||
$(MAKE) "build-ios-devclassic-link all" CONFIG=Release
|
||||
# test LLVM armv6 arm7 (fat), this is Classic only because arm64 doesn't have llvm support.
|
||||
$(MAKE) "build-ios-devclassic-link sdk" CONFIG=Release
|
||||
# test LLVM arm7 w/thumb2, this is Classic only because arm64 doesn't have llvm support.
|
||||
$(MAKE) build-ios-devclassic-monotouch-test CONFIG=Release
|
||||
# test BCL mscorlib
|
||||
$(MAKE) build-ios-dev-mscorlib CONFIG=Release
|
||||
# test BCL System.Core
|
||||
$(MAKE) build-ios-dev-System.Core CONFIG=Release
|
||||
# run any other scripted tests
|
||||
$(MAKE) -C scripted
|
||||
|
||||
build-% run-% exec-% install-%:
|
||||
@echo ""
|
||||
@echo "\033[0;31mUnknown target: $@\033[0m"
|
||||
@echo ""
|
||||
@echo "Syntax is: <action>-<platform>-<where>-<what>"
|
||||
@echo " Action: build, install (only for device), exec, run (= build + install + exec)."
|
||||
@echo " Platform: ios, tvos, watchos (can be skipped, in which case all platforms are executed)"
|
||||
@echo " Where: "
|
||||
@echo " ios: sim = [simclassic + simunified = [sim32, sim64]]; dev = [devclassic + devunified]"
|
||||
@echo " tvos/watchos: sim, dev"
|
||||
@echo " What: The test project to run (BCL tests do not need to be treated specially anymore, just use test project's name)"
|
||||
@echo ""
|
||||
@echo "Example:"
|
||||
@echo ""
|
||||
@echo " # this will run monotouch-test on an Apple TV device"
|
||||
@echo " $ make run-tvos-dev-monotouch-test"
|
||||
@echo ""
|
||||
@echo "For more info read README.md."
|
||||
@echo ""
|
||||
@exit 1
|
||||
|
||||
check-result:
|
||||
@test -z "$(BUILD_REVISION)" || echo "@MonkeyWrench: AddFile: $(abspath $(FILE))"
|
||||
@if grep "Tests run" "$(FILE)"; then \
|
||||
if grep FAIL "$(FILE)"; then \
|
||||
test "x" == "x$(BUILD_REVISION)" -o "x" == "x$(TESTNAME)" || echo "@MonkeyWrench: AddSummary: <b>$(TESTNAME) failed: `grep "Tests run:" "$(FILE)" | sed 's/Tests run: //'`</b><br/>"; \
|
||||
echo Test run failed; \
|
||||
exit 1; \
|
||||
else \
|
||||
test "x" == "x$(BUILD_REVISION)" -o "x" == "x$(TESTNAME)" || echo "@MonkeyWrench: AddSummary: $(TESTNAME) succeeded: `grep "Tests run:" "$(FILE)" | sed 's/Tests run: //'`<br/>"; \
|
||||
echo Test run succeeded; \
|
||||
fi; \
|
||||
else \
|
||||
test "x" == "x$(BUILD_REVISION)" -o "x" == "x$(TESTNAME)" || echo "@MonkeyWrench: AddSummary: <b><i>$(TESTNAME) crashed</i></b><br/>"; \
|
||||
echo Test run crashed; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
logdev:
|
||||
$(MTOUCH) --logdev
|
||||
|
||||
$(UNIT_SERVER): $(wildcard $(UNIT_SERVER_DIR)/*.cs)
|
||||
(cd $(UNIT_SERVER_DIR) && $(SYSTEM_XBUILD))
|
||||
|
||||
build-test-libraries:
|
||||
@$(MAKE) -C $(TOP)/tests/test-libraries
|
||||
|
||||
Makefile.inc: xharness/xharness.exe
|
||||
$(Q_GEN) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)
|
||||
|
||||
-include Makefile.inc
|
||||
|
||||
$(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe:
|
||||
XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current xbuild $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj
|
||||
|
||||
$(GUI_UNIT_PATH)/bin/xammac_mobile/GuiUnit.exe:
|
||||
XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current xbuild $(GUI_UNIT_PATH)/src/framework/GuiUnit_xammac_mobile.csproj
|
||||
|
||||
Makefile-mac.inc: xharness/xharness.exe
|
||||
$(Q_GEN) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --configure --autoconf --mac --rootdir $(CURDIR)
|
||||
|
||||
-include Makefile-mac.inc
|
||||
|
||||
$(TOP)/tools/mtouch/SdkVersions.cs: $(TOP)/tools/mtouch/SdkVersions.cs.in
|
||||
@$(MAKE) -C $(TOP)/tools/mtouch SdkVersions.cs
|
||||
|
||||
.stamp-src-project-files:
|
||||
@$(MAKE) -C $(TOP)/src project-files
|
||||
@touch $@
|
||||
|
||||
xharness/xharness.exe: $(wildcard xharness/*.cs) xharness/xharness.csproj $(TOP)/tools/mtouch/SdkVersions.cs test.config .stamp-src-project-files
|
||||
$(Q_GEN) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY_QUIET) xharness/xharness.csproj
|
||||
|
||||
killall:
|
||||
@killall "iPhone Simulator" >/dev/null 2>&1 || true
|
||||
@killall "iOS Simulator" >/dev/null 2>&1 || true
|
||||
@killall Touch.Server >/dev/null 2>&1 || true
|
||||
|
||||
NUNIT_MSBUILD_DIR=$(TOP)/msbuild/packages/NUnit.Runners.2.6.4/tools/lib
|
||||
test-ios-tasks:
|
||||
$(SYSTEM_XBUILD) $(TOP)/msbuild/Xamarin.MacDev.Tasks.sln
|
||||
cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_MONO) ../nunit-console.exe ../../../../tests/bin/Xamarin.iOS.Tasks.Tests.dll -xml=TestResults_Xamarin.iOS.Tasks.Tests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
|
||||
@[[ -z "$$BUILD_REPOSITORY" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt $(NUNIT_MSBUILD_DIR)/TestResults_Xamarin.iOS.Tasks.Tests.xml > $(TOP)/tests/index.html && echo "@MonkeyWrench: AddFile: $$PWD/index.html" )
|
||||
@if test -e $(NUNIT_MSBUILD_DIR)/.failed-stamp; then rm $(NUNIT_MSBUILD_DIR)/.failed-stamp; exit 1; fi
|
||||
|
||||
ifdef ENABLE_XAMARIN
|
||||
ifdef INCLUDE_IOS
|
||||
qa-test-dependencies.zip:
|
||||
@$(MAKE) build-test-libraries
|
||||
@# Make sure we start from a clean slate
|
||||
$(Q) rm -rf $@ $@.tmpdir
|
||||
ifdef INCLUDE_TVOS
|
||||
@# TVOS
|
||||
$(Q) mkdir -p $@.tmpdir/tvos
|
||||
$(Q) cp $(TOP)/src/build/tvos/reference/MonoTouch.Dialog-1.dll* $@.tmpdir/tvos
|
||||
$(Q) cp $(TOP)/src/build/tvos/reference/MonoTouch.NUnitLite.dll* $@.tmpdir/tvos
|
||||
$(Q) cp $(TOP)/tests/test-libraries/.libs/tvos/libtest.a $@.tmpdir/tvos
|
||||
$(Q) cp $(TOP)/tests/test-libraries/.libs/tvos/libtest.dylib $@.tmpdir/tvos
|
||||
$(Q) cp -a $(TOP)/tests/test-libraries/.libs/tvos/XTest.framework $@.tmpdir/tvos
|
||||
endif
|
||||
@# iOS
|
||||
$(Q) mkdir -p $@.tmpdir/ios
|
||||
$(Q) cp $(TOP)/tests/test-libraries/.libs/ios/libtest.a $@.tmpdir/ios
|
||||
$(Q) cp $(TOP)/tests/test-libraries/.libs/ios/libtest.dylib $@.tmpdir/ios
|
||||
$(Q) cp -a $(TOP)/tests/test-libraries/.libs/ios/XTest.framework $@.tmpdir/ios
|
||||
$(Q) cp $(MACCORE_PATH)/tools/mlaunch/mlaunch $@.tmpdir
|
||||
@# Generate zip
|
||||
$(Q_GEN) cd $@.tmpdir && zip -9r $(abspath $@) .
|
||||
@# Cleanup
|
||||
$(Q) rm -rf $@.tmpdir
|
||||
else
|
||||
qa-test-dependencies.zip:
|
||||
@echo Not enabled
|
||||
endif
|
||||
else
|
||||
qa-test-dependencies.zip:
|
||||
@echo Xamarin build not enabled
|
||||
endif
|
||||
|
||||
ifdef INCLUDE_MAC
|
||||
mac-test-package.zip:
|
||||
./package-mac-tests.sh
|
||||
else
|
||||
mac-test-package.zip:
|
||||
@echo Not enabled
|
||||
endif
|
||||
|
||||
#XI
|
||||
ifdef INCLUDE_IOS
|
||||
wrench-mtouch:
|
||||
cd mtouch && $(MAKE)
|
||||
git clean -xfdq
|
||||
|
||||
wrench-btouch:
|
||||
cd generator && $(MAKE)
|
||||
cd generator && git clean -xfdq
|
||||
|
||||
wrench-build-unit-test-dev:
|
||||
$(MAKE) build-dev-bots
|
||||
git clean -xfdq
|
||||
|
||||
wrench-sim-linksdk:
|
||||
$(Q) $(MAKE) wrench-sim-link\ sdk
|
||||
|
||||
wrench-sim-linkall:
|
||||
$(Q) $(MAKE) wrench-sim-link\ all
|
||||
|
||||
wrench-sim-dontlink:
|
||||
$(Q) $(MAKE) wrench-sim-dont\ link
|
||||
|
||||
else
|
||||
wrench-mtouch wrench-btouch wrench-build-unit-test-dev:
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
|
||||
## XM
|
||||
ifdef INCLUDE_MAC
|
||||
wrench-mac-dontlink:
|
||||
$(Q) $(MAKE) run-mac-dontlink
|
||||
$(Q) $(MAKE) clean-mac-dontlink
|
||||
|
||||
wrench-mac-mmp:
|
||||
@echo Now part of wrench-mac-mmptest
|
||||
|
||||
wrench-mac-misc:
|
||||
@echo Tests mac-misc tests removed
|
||||
|
||||
wrench-mac-apidiff:
|
||||
@echo This is done in the normal api-diff target now.
|
||||
|
||||
wrench-mac-drm:
|
||||
@echo "The DRM tests have all been removed."
|
||||
|
||||
wrench-mac-api:
|
||||
$(Q) $(MAKE) run-mac-apitest
|
||||
$(Q) $(MAKE) clean-mac-apitest
|
||||
|
||||
wrench-mac-mmptest:
|
||||
$(Q) $(MAKE) run-mac-mmptest
|
||||
$(Q) $(MAKE) clean-mac-mmptest
|
||||
$(Q) $(MAKE) -C mmptest/regression
|
||||
|
||||
wrench-mac-msbuild:
|
||||
$(Q) $(MAKE) run-mac-msbuild
|
||||
$(Q) $(MAKE) clean-mac-msbuild
|
||||
|
||||
wrench-mac-binding-project:
|
||||
cd mac-binding-project && $(MAKE)
|
||||
cd mac-binding-project && git clean -xfdq
|
||||
|
||||
else
|
||||
wrench-mac-%:
|
||||
@echo "Mac tests have been disabled [$@]"
|
||||
endif
|
||||
|
||||
wrench-msbuild:
|
||||
$(MAKE) -C $(TOP)/msbuild test-xml
|
||||
ifdef INCLUDE_IOS
|
||||
$(MAKE) test-ios-tasks
|
||||
else
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
cd $(TOP)/msbuild && git clean -xfdq
|
||||
|
||||
wrench-docs:
|
||||
ifdef ENABLE_XAMARIN
|
||||
ifdef INCLUDE_IOS
|
||||
$(MAKE) -C $(MACCORE_PATH) update-docs
|
||||
else
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
else
|
||||
@echo "Docs have been disabled [$@]"
|
||||
endif
|
||||
|
||||
# the wrenchhelper-* targets are generated.
|
||||
wrench-sim-%:
|
||||
git clean -xfdq
|
||||
ifdef INCLUDE_IOS
|
||||
unset LD_LIBRARY_PATH && script -q /dev/null $(MAKE) "wrenchhelper-$*"
|
||||
else
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
|
||||
wrench-bcl-sim-%:
|
||||
git clean -xfdq
|
||||
ifdef INCLUDE_IOS
|
||||
unset LD_LIBRARY_PATH && script -q /dev/null $(MAKE) "wrenchhelper-$*"
|
||||
else
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
|
||||
wrench-%:
|
||||
git clean -xfdq
|
||||
ifdef INCLUDE_IOS
|
||||
touch "exec-$*.log"
|
||||
echo "@MonkeyWrench: AddFile: $(PWD)/exec-$*.log"
|
||||
unset LD_LIBRARY_PATH && script -q /dev/null $(MAKE) "run-$*"
|
||||
echo "Test succeeded"
|
||||
else
|
||||
@echo "iOS tests have been disabled [$@]"
|
||||
endif
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(MACCORE_PATH)/tests $@
|
||||
|
|
183
tests/README.md
183
tests/README.md
|
@ -1,4 +1,181 @@
|
|||
README.md
|
||||
# Various tests to be executed prior to releases
|
||||
|
||||
## Test solutions
|
||||
|
||||
Many of the test solutions and test projects are generated, and will
|
||||
only be available after running `make` once.
|
||||
|
||||
* tests.sln: This is the base test solution, which targets iOS using the Classic API. _Not_ generated.
|
||||
* tests-unified.sln: All the iOS test projects using the Unified API. Generated.
|
||||
* tests-tvos.sln: All the TVOS test projects. Generated.
|
||||
* tests-watchos.sln: All the WatchOS test projects. Generated.
|
||||
|
||||
### Test solution/project generation
|
||||
|
||||
The tool that generates the test solutions / projects is called xharness,
|
||||
and lives in the xharness subdirectory.
|
||||
|
||||
## Types of Tests
|
||||
|
||||
### Unit Tests
|
||||
|
||||
Most of the projects are using NUnit[Lite] and looks like unit tests.
|
||||
They are meant to be executed on the target: simulator, devices, OSX.
|
||||
|
||||
In reality most of them are regression tests - but that does not change
|
||||
the need to execute and continually expand them to cover new code.
|
||||
|
||||
|
||||
### Introspection Tests
|
||||
|
||||
Introspection tests are executed on target (both simulator and device for
|
||||
iOS) or a specific version of OSX. The application proceed to analyze itself
|
||||
using:
|
||||
|
||||
* `System.Reflection` for managed code; and
|
||||
* the ObjectiveC runtime library for native code
|
||||
|
||||
and compare the results. E.g. if using .NET reflection it can see a binding
|
||||
for a `NSBundle` type then it should be able to find a native `NSBundle`
|
||||
type using the ObjC runtime functions. Otherwise an error is raised...
|
||||
|
||||
Since the application analyze itself it must contains everything we wish
|
||||
to test. That's why the introspection tests are part of the `dontlink.app`
|
||||
application (for iOS) and the dontlink-mac project (for OSX).
|
||||
|
||||
Pros
|
||||
|
||||
* They always tell the truth, which can differ from documentation
|
||||
|
||||
Cons
|
||||
|
||||
* Incomplete - Not everything is encoded in the metadata / executable;
|
||||
* Too complete - Not every truth is good to be known (or published)
|
||||
|
||||
|
||||
### Extrospection Tests ###
|
||||
|
||||
Extrospection tests takes data from some outside sources and see if our
|
||||
implementation match the information, e.g.
|
||||
|
||||
* Header files from the SDK;
|
||||
* Rules, like Gendarme or FxCop;
|
||||
|
||||
Since this is done externally there's no need to run them on the devices,
|
||||
simulator or even a specific version of OSX.
|
||||
|
||||
Pro
|
||||
|
||||
* There is more data available, e.g. information lost when compiling
|
||||
|
||||
Con
|
||||
|
||||
* The data might not represent the truth (errors, false positives...)
|
||||
|
||||
|
||||
|
||||
# Test Suites
|
||||
|
||||
## *-tests : where * is the assembly name, e.g. monotouch
|
||||
|
||||
Use the project defaults for linking, i.e.
|
||||
|
||||
* "Don't link" for simulator
|
||||
|
||||
* "Link SDK assemblies only" for devices
|
||||
|
||||
## dontlink
|
||||
|
||||
* regression testing without using the linker
|
||||
|
||||
* both simulator and devices are set to "Don't link"
|
||||
|
||||
## linkall
|
||||
|
||||
* regression testing using the linker on the all assemblies
|
||||
|
||||
* "Link all assemblies" for both simulator/devices
|
||||
|
||||
## linksdk
|
||||
|
||||
* regression testing using the linker on the SDK assemblies
|
||||
|
||||
* "Link SDK assemblies only" for both simulator/devices
|
||||
|
||||
## bcl-test
|
||||
|
||||
These are the Mono BCL test suite tweaked to run on the mobile profile.
|
||||
It reuse the files directly from mono's repository (linking, not copying).
|
||||
|
||||
As other unit tests the configuration is set to mimick normal apps, e.g.
|
||||
|
||||
* "Don't link" for simulator
|
||||
|
||||
* "Link SDK assemblies only" for devices
|
||||
|
||||
|
||||
# Common make targets
|
||||
|
||||
Run every test in both the simulator and on device, using both the compat and the new profile (for the simulator both in 32 and 64bit mode).
|
||||
|
||||
$ make run
|
||||
|
||||
Run every test in the simulator, using both the compat and the new profile (both 32 and 64bit simulators).
|
||||
|
||||
$ make run-all-sim
|
||||
|
||||
Run every test on device, using both the compat and the new profile
|
||||
|
||||
$ make run-all-dev
|
||||
|
||||
# Detailed make targets
|
||||
|
||||
* Main target
|
||||
|
||||
* run-*what*-*where*-*project*: Builds, installs (if applicable) and runs the specified test project on the specified platform. This is the most common target to use.
|
||||
* build-*what*-*where*-*project*: Will build the specified test project for the specified platform and target.
|
||||
* install-*what*-*where*-*project*: Will install the specified test project on a connected device. There's currently no way to select the device, so ensure you've only one connected (if many devices are connected, it's random which will used).
|
||||
* exec-*what*-*where*-*project*: Will run the specified test project in the simulator or on a device.
|
||||
|
||||
* What
|
||||
|
||||
* -ios-: iOS.
|
||||
* -tvos-: TVOS.
|
||||
* -watchos-: WatchOS
|
||||
|
||||
If "What" is skipped, all variations are executed sequentially.
|
||||
|
||||
* Where
|
||||
|
||||
* -simclassic-: Simulator using the Classic API. Only applicable when platform is iOS.
|
||||
* -simunified-: Simulator using Unified API. The build will contain both an i386 and an x86_64 binary. Only applicable to the build-* target, while the -sim32- and -sim64- are only applicable to the exec-* targets. Only applicable when the platform is iOS.
|
||||
* -sim32-: 32bits iOS simulator using the Unified API. Not applicable to other platforms.
|
||||
* -sim64-: 64bits iOS simulator using the Unified API. Not applicable to other platforms.
|
||||
* -sim-:
|
||||
* iOS: Both the -simclassic- and -simunified- versions.
|
||||
* WatchOS/TVOS: The WatchOS/TVOS simulator.
|
||||
* -devclassic-: Device using the Classic API. Only applicable when the platform is iOS.
|
||||
* -devunified-: Device using the Unified API. The build will contain both an armv7 and an arm64 binary. It's not possible to select a 32/64bit version, you'll run what your device supports. Only applicable when the platform is iOS.
|
||||
* -dev-:
|
||||
* iOS: Both the -devclassic- and -devunified- versions.
|
||||
* WatchOS/TVOS: A Watch or TV device.
|
||||
|
||||
* Examples
|
||||
|
||||
$ make run-ios-sim32-monotouchtest: This will run `monotouch-test` using the Unified API in a 32-bit simulator.
|
||||
$ make run-tvos-dev-dont\ link: This will run `dont link` on an Apple TV device.
|
||||
|
||||
# Utility run-* targets
|
||||
|
||||
These targets will build, install (if applicable) and run the specified project(s).
|
||||
|
||||
* Simulator
|
||||
* run-sim-*project*: Builds and runs the specified test project in the simulator in compat, 32 and 64bit mode.
|
||||
* run-sim: Builds and runs all the non-bcl test projects in the simulator in compat, 32 and 64bit mode.
|
||||
|
||||
* Device
|
||||
* run-dev-*project*: Builds and runs the specified non-bcl test project on a device in compat and native mode (if it's 32 and 64bit depends on the device; 64bit devices will run in 64bit mode and the same for 32bit devices).
|
||||
* run-devcompat: Run all the non-bcl test projects on device, in compat mode.
|
||||
* run-devdual: Run all the non-bcl test projects on device, in native mode (if it's 32 and 64bit depends on the device; 64bit devices will run in 64bit mode and the same for 32bit devices).
|
||||
* run-dev: Run all the non-bcl test projects on device, in both compat and native mode.
|
||||
|
||||
Our test suites are presently being re-worked to work without external,
|
||||
non public, dependencies. They will be added here shortly.
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// Unit tests for CFNotificationCenter
|
||||
//
|
||||
// Authors:
|
||||
// Miguel de Icaza (miguel@xamarin.com)
|
||||
//
|
||||
// Copyright 2015 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using CoreFoundation;
|
||||
#else
|
||||
#if MONOMAC
|
||||
using MonoMac.CoreFoundation;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using MonoTouch.CoreFoundation;
|
||||
using MonoTouch.Foundation;
|
||||
#endif
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreFoundation
|
||||
{
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class CFNotificationCenterTest
|
||||
{
|
||||
[Test]
|
||||
public void TestObservers ()
|
||||
{
|
||||
var target = new NSObject ();
|
||||
var d = CFNotificationCenter.Local;
|
||||
int count = 0;
|
||||
int count2 = 0;
|
||||
CFNotificationObserverToken o2 = null;
|
||||
var o1 = d.AddObserver ("hello", target, (x,dd)=>{
|
||||
count++;
|
||||
// Console.WriteLine ("Here");
|
||||
|
||||
if (count == 1)
|
||||
o2 = d.AddObserver ("hello", target, (y,ee)=> {
|
||||
// Console.WriteLine ("There");
|
||||
count2++;
|
||||
});
|
||||
});
|
||||
d.PostNotification ("hello", target, null, deliverImmediately:true);
|
||||
Assert.AreEqual (1, count);
|
||||
d.PostNotification ("hello", target, null, deliverImmediately:true);
|
||||
Assert.AreEqual (2, count);
|
||||
Assert.AreEqual (1, count2);
|
||||
|
||||
// Remove the first observer, count should not be updated
|
||||
d.RemoveObserver (o1);
|
||||
d.PostNotification ("hello", target, null);
|
||||
Assert.AreEqual (2, count);
|
||||
Assert.AreEqual (2, count2);
|
||||
|
||||
// Remove the last observer, there should be no change in count
|
||||
d.RemoveObserver (o2);
|
||||
d.PostNotification ("hello", target, null);
|
||||
Assert.AreEqual (2, count);
|
||||
Assert.AreEqual (2, count2);
|
||||
|
||||
// Test removing all observers
|
||||
count = 0;
|
||||
o1 = d.AddObserver ("hello", target, (x,dd)=>{
|
||||
count++;
|
||||
Console.WriteLine ("Here");
|
||||
});
|
||||
o2 = d.AddObserver ("hello", target, (y,ee)=> {count++;});
|
||||
d.RemoveEveryObserver ();
|
||||
d.PostNotification ("hello", target, null);
|
||||
Assert.AreEqual (0, count);
|
||||
|
||||
// Test removing from a callback
|
||||
count = 0;
|
||||
o2 = d.AddObserver ("hello", target, (y,ee)=> {count++; d.RemoveObserver (o2); });
|
||||
d.PostNotification ("hello", target, null);
|
||||
Assert.AreEqual (1, count);
|
||||
d.PostNotification ("hello", target, null);
|
||||
Assert.AreEqual (1, count);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
//
|
||||
// Unit tests for the registrars.
|
||||
//
|
||||
// Authors:
|
||||
// Rolf Bjarne Kvinge <rolf@xamarin.com>
|
||||
//
|
||||
// Copyright 2015 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#elif __IOS__
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace XamarinTests.ObjCRuntime {
|
||||
[TestFixture]
|
||||
public class RegistrarSharedTest {
|
||||
public static Registrars CurrentRegistrar {
|
||||
get {
|
||||
return Registrar.CurrentRegistrar;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IntPtrCtor ()
|
||||
{
|
||||
IntPtr ptr = IntPtr.Zero;
|
||||
try {
|
||||
ptr = Messaging.IntPtr_objc_msgSend (Class.GetHandle (typeof (IntPtrCtorTestClass)), Selector.GetHandle ("alloc"));
|
||||
ptr = Messaging.IntPtr_objc_msgSend (ptr, Selector.GetHandle ("init"));
|
||||
var ex = Assert.Throws<Exception> (() => Messaging.bool_objc_msgSend_IntPtr (ptr, Selector.GetHandle ("conformsToProtocol:"), IntPtr.Zero));
|
||||
var msg = string.Format ("Failed to marshal the Objective-C object 0x{0} (type: IntPtrCtorTestClass). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'XamarinTests.ObjCRuntime.RegistrarSharedTest+IntPtrCtorTestClass' does not have a constructor that takes one IntPtr argument).", ptr.ToString ("x"));
|
||||
if (CurrentRegistrar == Registrars.Static || CurrentRegistrar == Registrars.OldStatic) {
|
||||
msg += "\nAdditional information:\n\tSelector: conformsToProtocol:\n\tMethod: ";
|
||||
#if !XAMCORE_2_0
|
||||
#if __IOS__
|
||||
msg += "MonoTouch.";
|
||||
#else
|
||||
msg += "MonoMac.";
|
||||
#endif
|
||||
#endif
|
||||
msg += "Foundation.NSObject:InvokeConformsToProtocol (intptr)\n";
|
||||
}
|
||||
Assert.AreEqual (msg, ex.Message, "#message");
|
||||
} finally {
|
||||
Messaging.void_objc_msgSend (ptr, Selector.GetHandle ("release"));
|
||||
}
|
||||
}
|
||||
|
||||
[Register ("IntPtrCtorTestClass")]
|
||||
class IntPtrCtorTestClass : NSObject {
|
||||
[Export ("initWithFoo:")]
|
||||
public IntPtrCtorTestClass (int foo)
|
||||
{
|
||||
Console.WriteLine ("foo1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
TestResult*
|
||||
build/
|
|
@ -0,0 +1,18 @@
|
|||
<?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>apitest</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.apitest</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>apitest</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.7</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,155 @@
|
|||
<?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)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{7A0EDA95-30A6-43E1-AD43-368AD95AC48B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>apitest</RootNamespace>
|
||||
<AssemblyName>apitest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\x86\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;MONOMAC</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<EnableCodeSigning>false</EnableCodeSigning>
|
||||
<CodeSigningKey>Mac Developer</CodeSigningKey>
|
||||
<CreatePackage>false</CreatePackage>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<IncludeMonoRuntime>false</IncludeMonoRuntime>
|
||||
<UseSGen>false</UseSGen>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\x86\Debug</OutputPath>
|
||||
<DefineConstants>MONOMAC</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<EnableCodeSigning>true</EnableCodeSigning>
|
||||
<CodeSigningKey>Developer ID Application</CodeSigningKey>
|
||||
<CreatePackage>true</CreatePackage>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
||||
<UseSGen>false</UseSGen>
|
||||
<LinkMode>SdkOnly</LinkMode>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</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" />
|
||||
<Reference Include="GuiUnit">
|
||||
<HintPath>..\..\..\xamarin-macios\external\guiunit\bin\net_4_5\GuiUnit.exe</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="src\AppKit\NSAppearance.cs" />
|
||||
<Compile Include="src\AppKit\NSApplication.cs" />
|
||||
<Compile Include="src\AppKit\NSCellTest.cs" />
|
||||
<Compile Include="src\AppKit\NSClipView.cs" />
|
||||
<Compile Include="src\AppKit\NSColor.cs" />
|
||||
<Compile Include="src\AppKit\NSControl.cs" />
|
||||
<Compile Include="src\AppKit\NSDraggingItem.cs" />
|
||||
<Compile Include="src\AppKit\NSGradient.cs" />
|
||||
<Compile Include="src\AppKit\NSImage.cs" />
|
||||
<Compile Include="src\AppKit\NSLayoutManagerTests.cs" />
|
||||
<Compile Include="src\AppKit\NSOutlineView.cs" />
|
||||
<Compile Include="src\AppKit\NSPasteboard.cs" />
|
||||
<Compile Include="src\AppKit\NSPathControl.cs" />
|
||||
<Compile Include="src\AppKit\NSPathControlItem.cs" />
|
||||
<Compile Include="src\AppKit\NSSearchField.cs" />
|
||||
<Compile Include="src\AppKit\NSSplitViewController.cs" />
|
||||
<Compile Include="src\AppKit\NSSplitViewItem.cs" />
|
||||
<Compile Include="src\AppKit\NSStackView.cs" />
|
||||
<Compile Include="src\AppKit\NSStepperCell.cs" />
|
||||
<Compile Include="src\AppKit\NSStoryboardSegue.cs" />
|
||||
<Compile Include="src\AppKit\NSTableColumn.cs" />
|
||||
<Compile Include="src\AppKit\NSTableRowView.cs" />
|
||||
<Compile Include="src\AppKit\NSTableView.cs" />
|
||||
<Compile Include="src\AppKit\NSTabViewController.cs" />
|
||||
<Compile Include="src\AppKit\NSTabViewItem.cs" />
|
||||
<Compile Include="src\AppKit\NSTextField.cs" />
|
||||
<Compile Include="src\AppKit\NSTextFinder.cs" />
|
||||
<Compile Include="src\AppKit\NSTextInputClient.cs" />
|
||||
<Compile Include="src\AppKit\NSTextView.cs" />
|
||||
<Compile Include="src\AppKit\NSToolbar.cs" />
|
||||
<Compile Include="src\AppKit\NSUserDefaultsController.cs" />
|
||||
<Compile Include="src\AppKit\NSView.cs" />
|
||||
<Compile Include="src\AppKit\NSViewController.cs" />
|
||||
<Compile Include="src\AppKit\NSVisualEffectView.cs" />
|
||||
<Compile Include="src\AppKit\NSWindowController.cs" />
|
||||
<Compile Include="src\AppKit\NSWorkspace.cs" />
|
||||
<Compile Include="src\Asserts.cs" />
|
||||
<Compile Include="src\AudioUnit\AudioUnit.cs" />
|
||||
<Compile Include="src\AudioUnit\AUGraphTest.cs" />
|
||||
<Compile Include="src\AVFoundation\AVAudioIONode.cs" />
|
||||
<Compile Include="src\AVFoundation\AVPlayerLayerTest.cs" />
|
||||
<Compile Include="src\CoreAnimation\CABasicAnimation.cs" />
|
||||
<Compile Include="src\CoreAnimation\CAKeyFrameAnimation.cs" />
|
||||
<Compile Include="src\CoreAnimation\CALayer.cs" />
|
||||
<Compile Include="src\CoreAnimation\CAOpenGLLayer.cs" />
|
||||
<Compile Include="src\CoreImage\CIFilter.cs" />
|
||||
<Compile Include="src\DelegateAndDataSourceTest.cs" />
|
||||
<Compile Include="src\DerivedEventTest.cs" />
|
||||
<Compile Include="src\EveryFrameworkSmokeTest.cs" />
|
||||
<Compile Include="src\Foundation\AppleScript.cs" />
|
||||
<Compile Include="src\Foundation\NSFormatter.cs" />
|
||||
<Compile Include="src\Foundation\NSIndexSet.cs" />
|
||||
<Compile Include="src\Foundation\NSLayoutConstraint.cs" />
|
||||
<Compile Include="src\Foundation\NSObject.cs" />
|
||||
<Compile Include="src\Foundation\NSScriptCommandArgumentDescriptionTest.cs" />
|
||||
<Compile Include="src\Foundation\NSScriptCommandDescriptionTest.cs" />
|
||||
<Compile Include="src\Foundation\NSString.cs" />
|
||||
<Compile Include="src\Foundation\NSThread.cs" />
|
||||
<Compile Include="src\MonoMac\AssemblyTest.cs" />
|
||||
<Compile Include="src\MonoMac\CBUUID.cs" />
|
||||
<Compile Include="src\NSScriptCommandDescriptionDictionaryTest.cs" />
|
||||
<Compile Include="src\ObjCRuntime\ClassTest.cs" />
|
||||
<Compile Include="src\ObjCRuntime\Messaging.cs" />
|
||||
<Compile Include="src\SceneKit\SceneKit.cs" />
|
||||
<Compile Include="src\SceneKit\SCNGeometrySource.cs" />
|
||||
<Compile Include="src\SceneKit\SCNMaterial.cs" />
|
||||
<Compile Include="src\SceneKit\SCNNode.cs" />
|
||||
<Compile Include="src\SceneKit\SCNScene.cs" />
|
||||
<Compile Include="src\SceneKit\SCNView.cs" />
|
||||
<Compile Include="src\SceneKit\SCNWorld.cs" />
|
||||
<Compile Include="src\SearchKit\SearchKitTest.cs" />
|
||||
<Compile Include="src\SpriteKit\SKPaymentTests.cs" />
|
||||
<Compile Include="src\SpriteKit\SKScene.cs" />
|
||||
<Compile Include="..\api-shared\ObjCRuntime\RegistrarTest.cs">
|
||||
<Link>shared\ObjCRuntime\RegistrarTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\xamarin-macios\tests\api-shared\ObjCRuntime\Registrar.cs">
|
||||
<Link>shared\ObjCRuntime\Registrar.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\api-shared\CoreFoundation\CFNotificationCenterTest.cs">
|
||||
<Link>src\CoreFoundation\CFNotificationCenterTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bindings\PlatformInfo.cs">
|
||||
<Link>shared\PlatformInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\common\mac\MacTestMain.cs">
|
||||
<Link>shared\MacTestMain.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.AudioUnit;
|
||||
using MonoMac.AVFoundation;
|
||||
using AUUnit = MonoMac.AudioUnit.AudioUnit;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using AudioUnit;
|
||||
using AUUnit = AudioUnit.AudioUnit;
|
||||
using AVFoundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AVAudioIONodeTests
|
||||
{
|
||||
[Test]
|
||||
public void AVAudioIONodeTests_AudioUnitTest ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
AVAudioEngine eng = new AVAudioEngine();
|
||||
AVAudioIONode node = eng.OutputNode;
|
||||
AUUnit unit = node.AudioUnit;
|
||||
unit.GetElementCount (AudioUnitScopeType.Global);
|
||||
// Make sure this doens't crash.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.AudioUnit;
|
||||
using MonoMac.AVFoundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using AudioUnit;
|
||||
using AVFoundation;
|
||||
using AUUnit = AudioUnit.AudioUnit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AVPlayerLayerTests
|
||||
{
|
||||
[Test]
|
||||
public void AVPlayerLayer_VideoGravity ()
|
||||
{
|
||||
AVPlayerLayer layer = new AVPlayerLayer ();
|
||||
#if XAMCORE_2_0
|
||||
Assert.IsNotNull (layer.VideoGravity);
|
||||
#else
|
||||
Assert.IsNotNull (layer.LayerVideoGravity);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using nfloat = System.Single;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSAppearanceTests
|
||||
{
|
||||
[Test]
|
||||
public void NSAppearanceShouldLoadAppearanceNamed ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var appearance = NSAppearance.GetAppearance (NSAppearance.NameVibrantDark);
|
||||
Assert.IsNotNull (appearance, "NSAppearanceShouldLoadAppearanceNamed - Failed to initialize appearance VibrantDark");
|
||||
Assert.AreEqual (appearance.Name, NSAppearance.NameVibrantDark.ToString (), "NSAppearanceShouldLoadAppearanceNamed - Appearance initialized with incorrect name.");
|
||||
}
|
||||
|
||||
#if FALSE // Test failing, exception doesn't appear to be thrown during test, throw correctly running in an app.
|
||||
[Test]
|
||||
public void NSAppearanceConstructorShouldFailWithInvalidName ()
|
||||
{
|
||||
bool exceptionHit = false;
|
||||
|
||||
try {
|
||||
var appearance = new NSAppearance ("InvalidNameTest", null);
|
||||
} catch (ArgumentException e) {
|
||||
exceptionHit = true;
|
||||
}
|
||||
|
||||
Assert.IsTrue (exceptionHit, "NSAppearanceConstructorShouldFailWithInvalidName - No exception thrown while initializing appearance with invalid name.");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void NSAppearanceShouldChangeCurrentAppearance ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var appearance = NSAppearance.CurrentAppearance;
|
||||
|
||||
NSAppearance.CurrentAppearance = NSAppearance.GetAppearance (NSAppearance.NameVibrantDark);
|
||||
|
||||
Assert.AreNotEqual (appearance, NSAppearance.CurrentAppearance, "NSAppearanceShouldChangeCurrentAppearance - Failed to change appearance.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSApplicationTests
|
||||
{
|
||||
[Test]
|
||||
public void NSApplication_SendActionNullTest ()
|
||||
{
|
||||
NSApplication.SharedApplication.SendAction(new Selector("undo:"), null, new NSObject ());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoMacFixtures.AppKit
|
||||
{
|
||||
[TestFixture]
|
||||
public class CellTest
|
||||
{
|
||||
[Test]
|
||||
public void CopyTest ()
|
||||
{
|
||||
using (var cell = new CustomCell ())
|
||||
Check (cell.Handle);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyDerivedTest ()
|
||||
{
|
||||
using (var cell = new DerivedCell ())
|
||||
Check (cell.Handle);
|
||||
}
|
||||
|
||||
void Check (IntPtr cell_handle)
|
||||
{
|
||||
var clone_ptr = IntPtr_objc_msgSend (cell_handle, Selector.GetHandle ("copyWithZone:"), IntPtr.Zero);
|
||||
// Console.WriteLine ("Created cell 0x{0} (GCHandle: 0x{2}) with clone 0x{1} (GCHandle: 0x{3})", cell_handle.ToString ("x"), clone_ptr.ToString ("x"), GetGCHandle (cell_handle).ToString ("x"), GetGCHandle (clone_ptr).ToString ("x"));
|
||||
|
||||
Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #1");
|
||||
CustomCell.expectedHandle = cell_handle;
|
||||
objc_msgSend (Class.GetHandle (typeof (CustomCell)), Selector.GetHandle ("foo:"), cell_handle);
|
||||
|
||||
Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #2");
|
||||
CustomCell.expectedHandle = clone_ptr;
|
||||
objc_msgSend (Class.GetHandle (typeof (CustomCell)), Selector.GetHandle ("foo:"), clone_ptr);
|
||||
|
||||
Assert.AreNotEqual (GetGCHandle (cell_handle), GetGCHandle (clone_ptr), "gchandle #3");
|
||||
|
||||
objc_msgSend (clone_ptr, Selector.GetHandle ("release"));
|
||||
}
|
||||
|
||||
[DllImport ("__Internal", EntryPoint = "xamarin_get_gchandle")]
|
||||
extern static int GetGCHandle (IntPtr ptr);
|
||||
|
||||
const string LIBOBJC_DYLIB = "/usr/lib/libobjc.dylib";
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector, IntPtr p1);
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static void objc_msgSend (IntPtr receiver, IntPtr selector, IntPtr p1);
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static void objc_msgSend (IntPtr receiver, IntPtr selector);
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB)]
|
||||
internal extern static IntPtr object_getInstanceVariable (IntPtr cls, string name, out IntPtr value);
|
||||
}
|
||||
|
||||
class CustomCell : NSCell {
|
||||
public static IntPtr expectedHandle;
|
||||
|
||||
public CustomCell (IntPtr ptr) : base (ptr) { }
|
||||
public CustomCell () { }
|
||||
|
||||
[Export ("foo:")]
|
||||
public static void Foo (CustomCell mySelf)
|
||||
{
|
||||
Assert.AreEqual (expectedHandle, mySelf.Handle, "Handle");
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedCell : CustomCell
|
||||
{
|
||||
public DerivedCell (IntPtr ptr) : base (ptr) { }
|
||||
public DerivedCell () { }
|
||||
|
||||
public override NSObject Copy (NSZone zone)
|
||||
{
|
||||
return base.Copy (zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSClipViewTests
|
||||
{
|
||||
[Test]
|
||||
public void NSClipViewConstrainBoundsRect ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
|
||||
var clipView = new NSClipView (new CGRect (0, 0, 50, 50));
|
||||
var rect = clipView.ConstrainBoundsRect (new CGRect (10, 10, 30, 30));
|
||||
|
||||
Assert.IsTrue (rect.X == 0, "NSClipViewConstrainBoundsRect - X value was not 0");
|
||||
Assert.IsTrue (rect.Y == 0, "NSClipViewConstrainBoundsRect - Y value was not 0");
|
||||
Assert.IsTrue (rect.Width == 30, "NSClipViewConstrainBoundsRect - Width value was not 30");
|
||||
Assert.IsTrue (rect.Height == 30, "NSClipViewConstrainBoundsRect - Height value was not 30");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using nfloat = System.Single;
|
||||
#else
|
||||
using AppKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSColorTests
|
||||
{
|
||||
[Test]
|
||||
public void NSColor_ComponentTests ()
|
||||
{
|
||||
NSColor c = NSColor.Blue;
|
||||
nfloat [] components;
|
||||
c.GetComponents (out components);
|
||||
Assert.IsTrue (0f == components[0], "Red");
|
||||
Assert.IsTrue (0f == components[1], "Green");
|
||||
Assert.IsTrue (1f == components[2], "Blue");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SingleComponents ()
|
||||
{
|
||||
var c = NSColor.Red;
|
||||
nfloat[] components;
|
||||
c.GetComponents (out components);
|
||||
Assert.AreEqual (c.RedComponent, components [0], "Red");
|
||||
Assert.AreEqual (c.GreenComponent, components [1], "Green");
|
||||
Assert.AreEqual (c.BlueComponent, components [2], "Blue");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSControlTests
|
||||
{
|
||||
[Test]
|
||||
public void NSControlShouldChangeControlSize ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
var control = new NSButton ();
|
||||
var size = control.ControlSize;
|
||||
control.ControlSize = NSControlSize.Mini;
|
||||
|
||||
Assert.IsFalse (size == control.ControlSize);
|
||||
Assert.IsTrue (control.ControlSize == NSControlSize.Mini);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSControlShouldChangeHighlighted ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSButton ();
|
||||
var highlighted = control.Highlighted;
|
||||
control.Highlighted = !highlighted;
|
||||
|
||||
Assert.IsFalse (highlighted == control.Highlighted);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSControlShouldChangeLineBreakMode ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSButton ();
|
||||
var lineBreak = control.LineBreakMode;
|
||||
control.LineBreakMode = NSLineBreakMode.Clipping;
|
||||
|
||||
Assert.IsTrue (control.LineBreakMode == NSLineBreakMode.Clipping);
|
||||
Assert.IsFalse (lineBreak == control.LineBreakMode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSControlShouldAddMultipleActivatedEventHandlers ()
|
||||
{
|
||||
var control = new NSButton ();
|
||||
|
||||
int firstHitCount = 0;
|
||||
int secondHitCount = 0;
|
||||
|
||||
control.Activated += (sender, e) => firstHitCount++;
|
||||
control.Activated += (sender, e) => secondHitCount++;
|
||||
|
||||
control.PerformClick (control);
|
||||
|
||||
Assert.IsTrue (firstHitCount == 1, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call first EventHandler");
|
||||
Assert.IsTrue (secondHitCount == 1, "NSControlShouldAddMultipleActivatedEventHandlers - Did not call second EventHandler");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSControlShouldRemoveAndAddActivatedEventHandlers ()
|
||||
{
|
||||
var control = new NSButton ();
|
||||
|
||||
int firstHitCount = 0;
|
||||
int secondHitCount = 0;
|
||||
|
||||
EventHandler firstDelegate = (object sender, EventArgs e) => firstHitCount++;
|
||||
|
||||
control.Activated += firstDelegate;
|
||||
control.Activated -= firstDelegate;
|
||||
control.Activated += (sender, e) => secondHitCount++;
|
||||
|
||||
control.PerformClick (control);
|
||||
|
||||
Assert.IsTrue (firstHitCount == 0, "NSControlShouldRemoveAndAddActivatedEventHandlers - Called first EventHandler after it was removed");
|
||||
Assert.IsTrue (secondHitCount == 1, "NSControlShouldRemoveAndAddActivatedEventHandlers - Did not call second EventHandler");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSDraggingItemTests
|
||||
{
|
||||
[Test]
|
||||
public void NSDraggingItemConstructorTests ()
|
||||
{
|
||||
#pragma warning disable 0219
|
||||
NSDraggingItem item = new NSDraggingItem ((NSString)"Testing");
|
||||
item = new NSDraggingItem (new MyPasteboard ());
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
|
||||
class MyPasteboard : NSPasteboardWriting
|
||||
{
|
||||
public override NSObject GetPasteboardPropertyListForType (string type)
|
||||
{
|
||||
return new NSObject ();
|
||||
}
|
||||
|
||||
public override string[] GetWritableTypesForPasteboard (NSPasteboard pasteboard)
|
||||
{
|
||||
return new string [] {};
|
||||
}
|
||||
|
||||
public override NSPasteboardWritingOptions GetWritingOptionsForType (string type, NSPasteboard pasteboard)
|
||||
{
|
||||
return NSPasteboardWritingOptions.WritingPromised;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using nfloat = System.Single;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSGradientTests
|
||||
{
|
||||
[Test]
|
||||
public void NSGradientConstructorTests ()
|
||||
{
|
||||
NSColorSpace colorSpace = NSColorSpace.GenericRGBColorSpace;
|
||||
NSGradient g = new NSGradient (new[] { NSColor.Black, NSColor.White, NSColor.Black }, new[] { 0f, .5f, 1.0f }, colorSpace);
|
||||
Assert.IsNotNull (g);
|
||||
Assert.AreEqual (colorSpace, g.ColorSpace);
|
||||
Assert.AreEqual (3, g.ColorStopsCount);
|
||||
|
||||
// Since we are asking for colors on a gradient, there will be some color blending, even with just black and white.
|
||||
const float closeEnough = .05f;
|
||||
NSColor black = NSColor.Black.UsingColorSpace (NSColorSpace.CalibratedRGB);
|
||||
NSColor white = NSColor.White.UsingColorSpace (NSColorSpace.CalibratedRGB);
|
||||
|
||||
NSColor color;
|
||||
nfloat location;
|
||||
|
||||
g.GetColor (out color, out location, 0);
|
||||
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
|
||||
Assert.IsTrue (black.RedComponent - color.RedComponent < closeEnough);
|
||||
Assert.IsTrue (black.BlueComponent - color.BlueComponent < closeEnough);
|
||||
Assert.IsTrue (black.GreenComponent - color.GreenComponent < closeEnough);
|
||||
Assert.AreEqual (0.0f, (float)location);
|
||||
|
||||
g.GetColor (out color, out location, 1);
|
||||
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
|
||||
Assert.IsTrue (white.RedComponent - color.RedComponent < closeEnough);
|
||||
Assert.IsTrue (white.BlueComponent - color.BlueComponent < closeEnough);
|
||||
Assert.IsTrue (white.GreenComponent - color.GreenComponent < closeEnough);
|
||||
Assert.AreEqual (0.5f, (float)location);
|
||||
|
||||
g.GetColor (out color, out location, 2);
|
||||
color = color.UsingColorSpace (NSColorSpace.CalibratedRGB);
|
||||
Assert.IsTrue (black.RedComponent - color.RedComponent < closeEnough);
|
||||
Assert.IsTrue (black.BlueComponent - color.BlueComponent < closeEnough);
|
||||
Assert.IsTrue (black.GreenComponent - color.GreenComponent < closeEnough);
|
||||
Assert.AreEqual (1.0f, (float)location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using CGSize = System.Drawing.SizeF;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSImageTests
|
||||
{
|
||||
[Test]
|
||||
public void ImageWithSize ()
|
||||
{
|
||||
Asserts.EnsureMountainLion ();
|
||||
var image = NSImage.ImageWithSize (new CGSize (50, 50), false, rect => {
|
||||
return true;
|
||||
});
|
||||
Assert.IsNotNull (image);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSImageCapInsets ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var image = new NSImage ();
|
||||
image.CapInsets = new NSEdgeInsets (5f, 6f, 7f, 8f);
|
||||
|
||||
Assert.IsNotNull (image.CapInsets);
|
||||
Assert.IsTrue (image.CapInsets.Top == 5f, "NSImageCapInsets - Top value was not 5");
|
||||
Assert.IsTrue (image.CapInsets.Left == 6f, "NSImageCapInsets - Left value was not 6");
|
||||
Assert.IsTrue (image.CapInsets.Bottom == 7f, "NSImageCapInsets - Bottom value was not 7");
|
||||
Assert.IsTrue (image.CapInsets.Right == 8f, "NSImageCapInsets - Right value was not 8");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSImageResizingModeShouldChange ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var image = new NSImage ();
|
||||
image.ResizingMode = NSImageResizingMode.Stretch;
|
||||
Assert.AreEqual (image.ResizingMode, NSImageResizingMode.Stretch, "NSImageResizingMode - Was not equal to Stretch");
|
||||
Assert.AreNotEqual (image.ResizingMode, NSImageResizingMode.Tile, "NSImageResizingMode - Was incorrectly equal to Tile");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using CGPoint = System.Drawing.PointF;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSLayoutManagerTests
|
||||
{
|
||||
NSLayoutManager manager;
|
||||
|
||||
[SetUp]
|
||||
public void CreateManager ()
|
||||
{
|
||||
// This sets up the global context so our drawing doesn't produce error messages
|
||||
NSBitmapImageRep bitmap = new NSBitmapImageRep (IntPtr.Zero, 1000, 1000, 16, 4, true, false, NSColorSpace.DeviceRGB, 0, 0);
|
||||
NSGraphicsContext.CurrentContext = NSGraphicsContext.FromBitmap (bitmap);
|
||||
|
||||
NSTextStorage storage = new NSTextStorage ("Hello World");
|
||||
NSTextContainer container = new NSTextContainer ();
|
||||
manager = new NSLayoutManager ();
|
||||
|
||||
manager.AddTextContainer (container);
|
||||
storage.AddLayoutManager (manager);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSLayoutManager_DrawBackgroundForGlyphRange ()
|
||||
{
|
||||
manager.DrawBackgroundForGlyphRange (new NSRange (0, 4), new CGPoint (10, 10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSLayoutManager_DrawGlyphsForGlyphRange ()
|
||||
{
|
||||
manager.DrawGlyphsForGlyphRange (new NSRange (0, 4), new CGPoint (10, 10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSLayoutManager_CharacterRangeForGlyphRange ()
|
||||
{
|
||||
NSRange pnt;
|
||||
NSRange range = manager.CharacterRangeForGlyphRange (new NSRange (0, 4), out pnt);
|
||||
Assert.IsNotNull (range);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSLayoutManager_GlyphRangeForCharacterRange ()
|
||||
{
|
||||
NSRange pnt;
|
||||
NSRange range = manager.GlyphRangeForCharacterRange (new NSRange (0, 4), out pnt);
|
||||
Assert.IsNotNull (range);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSOutlineViewTests
|
||||
{
|
||||
[Test]
|
||||
public void NSOutlineView_InsertNull ()
|
||||
{
|
||||
NSOutlineView v = new NSOutlineView ();
|
||||
v.BeginUpdates (); // We do this to prevent a crash: Insert/remove/move only works within a -beginUpdates/-endUpdates block or a View Based TableView
|
||||
#if !XAMCORE_2_0
|
||||
v.InsertItems (new NSIndexSet (0), null, NSTableViewAnimationOptions.EffectFade);
|
||||
#else
|
||||
v.InsertItems (new NSIndexSet (0), null, NSTableViewAnimation.None);
|
||||
#endif
|
||||
v.EndUpdates ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSOutlineView_DelegateDataSourceNull ()
|
||||
{
|
||||
NSOutlineView v = new NSOutlineView ();
|
||||
v.WeakDelegate = null;
|
||||
v.Delegate = null;
|
||||
v.WeakDataSource = null;
|
||||
v.DataSource = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSPasteboardTests
|
||||
{
|
||||
[Test]
|
||||
public void NSPasteboardTests_WriteObjectTests ()
|
||||
{
|
||||
NSPasteboard b = NSPasteboard.CreateWithUniqueName();
|
||||
b.WriteObjects (new INSPasteboardWriting [] { (NSString)"asfd" });
|
||||
b.WriteObjects (new NSPasteboardWriting [] { new MyPasteboard () });
|
||||
#if !XAMCORE_2_0
|
||||
// Awesome backwards compat API
|
||||
b.WriteObjects (new NSPasteboardReading [] { new MyPasteboard2 () });
|
||||
#endif
|
||||
}
|
||||
|
||||
class MyPasteboard2 : NSPasteboardReading
|
||||
{
|
||||
public override NSObject InitWithPasteboardPropertyList (NSObject propertyList, string type)
|
||||
{
|
||||
return new NSObject ();
|
||||
}
|
||||
}
|
||||
|
||||
class MyPasteboard : NSPasteboardWriting
|
||||
{
|
||||
public override NSObject GetPasteboardPropertyListForType (string type)
|
||||
{
|
||||
return new NSObject ();
|
||||
}
|
||||
|
||||
public override string[] GetWritableTypesForPasteboard (NSPasteboard pasteboard)
|
||||
{
|
||||
return new string [] {};
|
||||
}
|
||||
|
||||
public override NSPasteboardWritingOptions GetWritingOptionsForType (string type, NSPasteboard pasteboard)
|
||||
{
|
||||
return NSPasteboardWritingOptions.WritingPromised;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSPathControlTests
|
||||
{
|
||||
[Test]
|
||||
public void NSPathControlShouldSetEditable ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSPathControl ();
|
||||
var editable = control.Editable;
|
||||
control.Editable = !editable;
|
||||
|
||||
Assert.IsTrue (control.Editable != editable, "NSPathControlShouldSetEditable - Failed to change the Editable property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlShouldSetAllowedTypes ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSPathControl ();
|
||||
var allowedTypes = control.AllowedTypes;
|
||||
control.AllowedTypes = new [] { (NSString)"exe", (NSString)"jpg" };
|
||||
|
||||
Assert.IsTrue (control.AllowedTypes != allowedTypes, "NSPathControlShouldSetAllowedTypes - Failed to change AllowedTypes property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlShouldSetPlaceholderString ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSPathControl ();
|
||||
var placeholderString = control.PlaceholderString;
|
||||
control.PlaceholderString = "Test Placeholder";
|
||||
|
||||
Assert.IsTrue (control.PlaceholderString != placeholderString, "NSPathControlShouldSetPlaceholderString - Failed to change PlaceholderString property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlShouldSetPlaceholderAttributedString ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSPathControl ();
|
||||
var placeholderAttributedString = control.PlaceholderAttributedString;
|
||||
control.PlaceholderAttributedString = new NSAttributedString ("Test Placeholder");
|
||||
|
||||
Assert.IsTrue (control.PlaceholderAttributedString != placeholderAttributedString, "NSPathControlShouldSetPlaceholderAttributedString - Failed to change PlaceholderAttributedString property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlShouldSetPathItems ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var control = new NSPathControl ();
|
||||
var pathItems = control.PathItems;
|
||||
control.PathItems = new [] { new NSPathControlItem () };
|
||||
|
||||
Assert.IsTrue (control.PathItems != pathItems, "NSPathControlShouldSetPathItems - Failed to set PathItems property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSPathControlItemTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlItemShouldSetTitle ()
|
||||
{
|
||||
var item = new NSPathControlItem ();
|
||||
var title = item.Title;
|
||||
item.Title = "Test";
|
||||
|
||||
Assert.IsTrue (item.Title != title, "NSPathControlShouldSetTitle - Title value did not change.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlItemShouldSetAttributedTitle ()
|
||||
{
|
||||
var item = new NSPathControlItem ();
|
||||
var attributedTitle = item.AttributedTitle;
|
||||
item.AttributedTitle = new NSAttributedString ("Test");
|
||||
|
||||
Assert.IsTrue (item.AttributedTitle != attributedTitle, "NSPathControlShouldSetAttributedTitle - AttributedTitle value did not change.");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSPathControlItemShouldSetImage ()
|
||||
{
|
||||
var item = new NSPathControlItem ();
|
||||
Assert.IsTrue (item.Image == null, "NSPathControlItemShouldSetImage - Image did not start as null");
|
||||
|
||||
item.Image = new NSImage ();
|
||||
Assert.IsTrue (item.Image != null, "NSPathControlItemShouldSetImage - Failed to set Image property");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSSearchFieldTests
|
||||
{
|
||||
[Test]
|
||||
public void NSSearchFieldShouldSetSearchMenuTemplate ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
|
||||
return;
|
||||
|
||||
var searchField = new NSSearchField ();
|
||||
var searchMenuTemplate = searchField.SearchMenuTemplate;
|
||||
searchField.SearchMenuTemplate = new NSMenu ("Test");
|
||||
|
||||
Assert.IsTrue (searchField.SearchMenuTemplate != searchMenuTemplate, "NSSearchFieldShouldSetSearchMenuTemplate - Failed to set the SearchMenuTemplate property.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSearchFieldShouldSetSendsWholeSearchString ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
|
||||
return;
|
||||
|
||||
var searchField = new NSSearchField ();
|
||||
var sendsWholeSearchString = searchField.SendsWholeSearchString;
|
||||
searchField.SendsWholeSearchString = !sendsWholeSearchString;
|
||||
|
||||
Assert.IsTrue (searchField.SendsWholeSearchString != sendsWholeSearchString, "NSSearchFieldShouldSetSendsWholeSearchString - Failed to set the SendsWholeSearchString property.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSearchFieldShouldSetMaximumRecents ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
|
||||
return;
|
||||
|
||||
var searchField = new NSSearchField ();
|
||||
var maximumRecents = searchField.MaximumRecents;
|
||||
searchField.MaximumRecents = maximumRecents + 3;
|
||||
|
||||
Assert.IsTrue (searchField.MaximumRecents != maximumRecents, "NSSearchFieldShouldSetMaximumRecents - Failed to set the MaximumRecents property.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSearchFieldShouldSetSendsSearchStringImmediately ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
|
||||
return;
|
||||
|
||||
var searchField = new NSSearchField ();
|
||||
var sendsSearchStringImmediately = searchField.SendsSearchStringImmediately;
|
||||
searchField.SendsSearchStringImmediately = !sendsSearchStringImmediately;
|
||||
|
||||
Assert.IsTrue (searchField.SendsSearchStringImmediately != sendsSearchStringImmediately, "NSSearchFieldShouldSetSendsSearchStringImmediately - Failed to set the SendsSearchStringImmediately property.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using System.Drawing;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSSplitViewControllerTests
|
||||
{
|
||||
NSSplitViewController controller;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
controller = new NSSplitViewController ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldChangeSplitView ()
|
||||
{
|
||||
var splitView = controller.SplitView;
|
||||
controller.SplitView = new NSSplitView ();
|
||||
|
||||
Assert.IsFalse (controller.SplitView == splitView, "NSSplitViewControllerShouldChangeSplitView - Failed to set the SplitView property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldChangeSplitViewItems ()
|
||||
{
|
||||
var items = controller.SplitViewItems;
|
||||
controller.SplitViewItems = new NSSplitViewItem [] { new NSSplitViewItem { ViewController = new NSViewController () } };
|
||||
|
||||
Assert.IsFalse (controller.SplitViewItems == items, "NSSplitViewControllerShouldChangeSplitViewItems - Failed to set the SplitViewItems property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldAddSplitViewItem ()
|
||||
{
|
||||
var item = new NSSplitViewItem { ViewController = new NSViewController () };
|
||||
controller.AddSplitViewItem (item);
|
||||
|
||||
Assert.IsTrue (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldAddSplitViewItem - Failed to add item");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldRemoveSplitViewItem ()
|
||||
{
|
||||
var item = new NSSplitViewItem { ViewController = new NSViewController () };
|
||||
controller.AddSplitViewItem (item);
|
||||
|
||||
Assert.IsTrue (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to add item");
|
||||
|
||||
controller.RemoveSplitViewItem (item);
|
||||
|
||||
Assert.IsFalse (controller.SplitViewItems.Contains (item), "NSSplitViewControllerShouldRemoveSplitViewItem - Failed to remove item");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldInsertSplitViewItem ()
|
||||
{
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
var item = new NSSplitViewItem { ViewController = new NSViewController () };
|
||||
controller.InsertSplitViewItem (item, 1);
|
||||
|
||||
Assert.IsTrue (controller.SplitViewItems [1] == item, "NSSplitViewControllerShouldInsertSplitViewItem - Failed to insert the item at the given position.");
|
||||
Assert.IsFalse (controller.SplitViewItems [0] == item, "NSSplitViewControllerShouldInsertSplitViewItem - Inserted the item in the wrong position.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewControllerShouldGetSplitViewItem ()
|
||||
{
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
controller.AddSplitViewItem (new NSSplitViewItem { ViewController = new NSViewController () });
|
||||
var viewController = new NSViewController ();
|
||||
var item = new NSSplitViewItem { ViewController = viewController };
|
||||
controller.InsertSplitViewItem (item, 1);
|
||||
|
||||
var retrievedItem = controller.GetSplitViewItem (viewController);
|
||||
|
||||
Assert.IsTrue (retrievedItem == item, "NSSplitViewControllerShouldGetSplitViewItem - Failed to get SplitViewItem from ViewController");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using System.Drawing;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSSplitViewItemTests
|
||||
{
|
||||
NSSplitViewItem item;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
item = new NSSplitViewItem ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewItemShouldCreateFromViewController ()
|
||||
{
|
||||
var viewController = new NSViewController ();
|
||||
var splitViewItem = NSSplitViewItem.FromViewController (viewController);
|
||||
|
||||
Assert.IsFalse (splitViewItem == null, "NSSplitViewItemShouldCreateFromViewController - Returned null");
|
||||
Assert.IsTrue (splitViewItem.ViewController == viewController, "NSSplitViewItemShouldCreateFromViewController - ViewController property not set correctly");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewItemShouldChangeViewController ()
|
||||
{
|
||||
var viewController = item.ViewController;
|
||||
item.ViewController = new NSViewController ();
|
||||
|
||||
Assert.IsFalse (item.ViewController == viewController, "NSSplitViewItemShouldChangeViewController - Failed to set the ViewController property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewItemShouldChangeCollapsed ()
|
||||
{
|
||||
var collapsed = item.Collapsed;
|
||||
item.Collapsed = !collapsed;
|
||||
|
||||
Assert.IsFalse (item.Collapsed == collapsed, "NSSplitViewItemShouldChangeCollapsed - Failed to set the Collapsed property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewItemShouldChangeCanCollapse ()
|
||||
{
|
||||
var canCollapse = item.CanCollapse;
|
||||
item.CanCollapse = !canCollapse;
|
||||
|
||||
Assert.IsFalse (item.CanCollapse == canCollapse, "NSSplitViewItemShouldChangeCanCollapse - Failed to set the CanCollapse property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSSplitViewItemShouldChangeHoldingPriority ()
|
||||
{
|
||||
var holdingPriority = item.HoldingPriority;
|
||||
item.HoldingPriority = 0.35f;
|
||||
|
||||
Assert.IsFalse (item.HoldingPriority == holdingPriority, "NSSplitViewItemShouldChangeHoldingPriority - Failed to set the HoldingPriority property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSStackViewTests
|
||||
{
|
||||
NSStackView view;
|
||||
NSView first;
|
||||
NSView second;
|
||||
NSView third;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
|
||||
view = new NSStackView ();
|
||||
|
||||
first = new NSView ();
|
||||
second = new NSView ();
|
||||
third = new NSView ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldCreateWithEmptyConstructor ()
|
||||
{
|
||||
Assert.IsNotNull (view, "NSStackViewCreateWithEmptyConstructor - Failed to create view");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldCreateWithViews ()
|
||||
{
|
||||
view = NSStackView.FromViews (new [] { first, second });
|
||||
|
||||
Assert.IsNotNull (view, "NSStackViewCreateWithViews - Failed to create view");
|
||||
Assert.IsTrue (view.Views.Length == 2, "NSStackViewShouldCreateWithViews - StackView does not have 2 views");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldAddView ()
|
||||
{view.AddView (new NSView (), NSStackViewGravity.Bottom);
|
||||
|
||||
Assert.IsTrue (view.Views.Length == 1, "NSStackViewShouldAddView - Failed to add view - length was 0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldInsertView ()
|
||||
{
|
||||
view.AddView (first, NSStackViewGravity.Trailing);
|
||||
view.AddView (second, NSStackViewGravity.Trailing);
|
||||
|
||||
view.InsertView (third, 1, NSStackViewGravity.Trailing);
|
||||
|
||||
Assert.IsTrue (view.Views.Length == 3, "NSStackViewShouldInsertView - Wrong number of views");
|
||||
Assert.IsTrue (view.Views [1] == third, "NSStackViewShouldInsertView - New view not inserted at the correct location");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldRemoveView ()
|
||||
{
|
||||
view = NSStackView.FromViews (new [] { first, second });
|
||||
|
||||
view.RemoveView (second);
|
||||
|
||||
Assert.IsTrue (view.Views.Length == 1, "NSStackViewShouldRemoveView - Failed to remove view");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldSetViews ()
|
||||
{
|
||||
view.SetViews (new [] { first, second }, NSStackViewGravity.Leading);
|
||||
|
||||
Assert.IsTrue (view.Views.Length == 2, "NSStackViewShouldSetViews - Views length was not 0");
|
||||
Assert.IsTrue (view.ViewsInGravity (NSStackViewGravity.Leading).Length == 2, "NSStackViewShouldSetViews - ViewsInGravity Leading was not 2");
|
||||
Assert.IsTrue (view.ViewsInGravity (NSStackViewGravity.Trailing).Length == 0, "NSStackViewShouldSetViews - ViewsInGravity Trailing was not 0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeAlignment ()
|
||||
{
|
||||
var alignment = view.Alignment;
|
||||
view.Alignment = NSLayoutAttribute.Right;
|
||||
|
||||
Assert.IsFalse (view.Alignment == alignment, "NSStackViewShouldChangeAlignment - Failed to change Alignment property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeOrientation ()
|
||||
{
|
||||
var orientation = view.Orientation;
|
||||
view.Orientation = NSUserInterfaceLayoutOrientation.Vertical;
|
||||
|
||||
Assert.IsFalse (view.Orientation == orientation, "NSStackViewShouldChangeOrientation - Failed to change Orientation property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeSpacing ()
|
||||
{
|
||||
var spacing = view.Spacing;
|
||||
view.Spacing = spacing + 3;
|
||||
|
||||
Assert.IsFalse (view.Spacing == spacing, "NSStackViewShouldChangeSpacing - Failed to change Spacing property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeEdgeInsets ()
|
||||
{
|
||||
var edgeInsets = view.EdgeInsets;
|
||||
view.EdgeInsets = new NSEdgeInsets (20, 20, 20, 20);
|
||||
|
||||
Assert.IsFalse (view.EdgeInsets.Left == edgeInsets.Left, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
|
||||
Assert.IsFalse (view.EdgeInsets.Right == edgeInsets.Right, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
|
||||
Assert.IsFalse (view.EdgeInsets.Top == edgeInsets.Top, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
|
||||
Assert.IsFalse (view.EdgeInsets.Bottom == edgeInsets.Bottom, "NSStackViewShouldChangeEdgeInsets - Failed to change EdgeInsets property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeHasEqualSpacing ()
|
||||
{
|
||||
var hasEqualSpacing = view.HasEqualSpacing;
|
||||
view.HasEqualSpacing = !hasEqualSpacing;
|
||||
|
||||
Assert.IsFalse (view.HasEqualSpacing == hasEqualSpacing, "NSStackViewShouldChangeHasEqualSpacing - Failed to change HasEqualSpacing property");
|
||||
}
|
||||
|
||||
// [Test]
|
||||
// public void NSStackViewShouldSetDelegate ()
|
||||
// {
|
||||
// var view = new NSStackView ();
|
||||
// view.Delegate = new NSStackViewDelegate ();
|
||||
//
|
||||
// Assert.IsNotNull (view.Delegate, "NSStackViewShouldSetDelegate - Delegate property returned null");
|
||||
// }
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeClippingResistance ()
|
||||
{
|
||||
var clippingResistance = view.ClippingResistancePriorityForOrientation (NSLayoutConstraintOrientation.Vertical);
|
||||
view.SetClippingResistancePriority (clippingResistance + 3, NSLayoutConstraintOrientation.Vertical);
|
||||
|
||||
Assert.IsFalse (view.ClippingResistancePriorityForOrientation (NSLayoutConstraintOrientation.Vertical) == clippingResistance,
|
||||
"NSStackViewShouldChangeClippingResistance - Failed to set ClippingResistance");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeHuggingPriority ()
|
||||
{
|
||||
var huggingPriority = view.HuggingPriority (NSLayoutConstraintOrientation.Horizontal);
|
||||
view.SetHuggingPriority (huggingPriority + 10, NSLayoutConstraintOrientation.Horizontal);
|
||||
|
||||
Assert.IsFalse (view.HuggingPriority (NSLayoutConstraintOrientation.Horizontal) == huggingPriority,
|
||||
"NSStackViewShouldChangeHuggingPriority - Failed to set HuggingPriority");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeCustomSpacing ()
|
||||
{
|
||||
view.AddView (first, NSStackViewGravity.Trailing);
|
||||
view.AddView (second, NSStackViewGravity.Trailing);
|
||||
|
||||
var customSpacing = view.CustomSpacingAfterView (first);
|
||||
view.SetCustomSpacing (10, first);
|
||||
|
||||
Assert.IsFalse (view.CustomSpacingAfterView (first) == customSpacing,
|
||||
"NSStackViewShouldChangeCustomSpacing - Failed to set CustomSpacing");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStackViewShouldChangeVisibilityPriority ()
|
||||
{
|
||||
view.AddView (first, NSStackViewGravity.Trailing);
|
||||
view.AddView (second, NSStackViewGravity.Trailing);
|
||||
|
||||
var visibilityPriority = view.VisibilityPriority (first);
|
||||
view.SetVisibilityPriority (10, first);
|
||||
|
||||
Assert.IsFalse (view.VisibilityPriority (first) == visibilityPriority,
|
||||
"NSStackViewShouldChangeVisibilityPriority - Failed to set VisibilityPriority");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
#else
|
||||
using AppKit;
|
||||
#endif
|
||||
|
||||
namespace apitest
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSStepperCellTests
|
||||
{
|
||||
NSStepperCell cell;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
cell = new NSStepperCell ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStepperCell_ShouldSetMinValue ()
|
||||
{
|
||||
var minValue = cell.MinValue;
|
||||
cell.MinValue = 3.14159;
|
||||
|
||||
Assert.IsTrue (cell.MinValue != minValue, "NSStepperCell_ShouldSetMinValue - Failed to set the MinValue property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStepperCell_ShouldSetMaxValue ()
|
||||
{
|
||||
var maxValue = cell.MaxValue;
|
||||
cell.MaxValue = 3.14159;
|
||||
|
||||
Assert.IsTrue (cell.MinValue != maxValue, "NSStepperCell_ShouldSetMaxValue - Failed to set the MaxValue property");
|
||||
}
|
||||
[Test]
|
||||
public void NSStepperCell_ShouldSetIncrement ()
|
||||
{
|
||||
var increment = cell.Increment;
|
||||
cell.Increment = 3.14159;
|
||||
|
||||
Assert.IsTrue (cell.Increment != increment, "NSStepperCell_ShouldSetIncrement - Failed to set the Increment property");
|
||||
}
|
||||
[Test]
|
||||
public void NSStepperCell_ShouldSetValueWraps ()
|
||||
{
|
||||
var valueWraps = cell.ValueWraps;
|
||||
cell.ValueWraps = !valueWraps;
|
||||
|
||||
Assert.IsTrue (cell.ValueWraps != valueWraps, "NSStepperCell_ShouldSetValueWraps - Failed to set the ValueWraps property");
|
||||
}
|
||||
[Test]
|
||||
public void NSStepperCell_ShouldSetAutoRepeat ()
|
||||
{
|
||||
var autoRepeat = cell.Autorepeat;
|
||||
cell.Autorepeat = !autoRepeat;
|
||||
|
||||
Assert.IsTrue (cell.Autorepeat != autoRepeat, "NSStepperCell_ShouldSetAutoRepeat - Failed to set the Autorepeat property");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSStoryboardSegueTests
|
||||
{
|
||||
NSStoryboardSegue segue;
|
||||
NSViewController source;
|
||||
NSViewController destination;
|
||||
|
||||
[SetUp]
|
||||
public void Setup ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
source = new NSViewController ();
|
||||
destination = new NSViewController ();
|
||||
segue = new NSStoryboardSegue ("Test", source, destination);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStoryboardSegueShouldCreateSegueWithConstructor ()
|
||||
{
|
||||
Assert.IsNotNull (segue, "NSStoryboardSegueShouldCreateSegueWithConstructor - Failed to create segue, value is null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStoryboardSegueShouldGetIdentifier ()
|
||||
{
|
||||
Assert.IsFalse (string.IsNullOrEmpty (segue.Identifier), "NSStoryboardSegueShouldGetIdentifier - Identifier property was empty or null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStoryboardSegueShouldGetSourceController ()
|
||||
{
|
||||
Assert.IsNotNull (segue.SourceController, "NSStoryboardSegueShouldGetSourceController - Source controller was null");
|
||||
Assert.IsTrue (segue.SourceController == source, "NSStoryboardSegueShouldGetSourceController - Source controller did not match the source controller passed into the segue.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSStoryboardSegueShouldGetDestinationController ()
|
||||
{
|
||||
Assert.IsNotNull (segue.DestinationController, "NSStoryboardSegueShouldGetDestinationController - Destination controller was null");
|
||||
Assert.IsTrue (segue.DestinationController == destination, "NSStoryboardSegueShouldGetDestinationController - Destination controller did not mass the destination controller passed into the segue.");
|
||||
}
|
||||
|
||||
#if false // Crashes when run in test from command line, works from an actual app
|
||||
[Test]
|
||||
public void NSStoryboardSegueShouldCreateSegueWithStaticMethod ()
|
||||
{
|
||||
var segue = NSStoryboardSegue.FromIdentifier ("Test", new NSViewController (), new NSViewController (), () => {
|
||||
});
|
||||
Assert.IsNotNull (segue);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using System.Drawing;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTabViewControllerTests
|
||||
{
|
||||
NSTabViewController controller;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
controller = new NSTabViewController ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeTabStyle ()
|
||||
{
|
||||
var tabStyle = controller.TabStyle;
|
||||
controller.TabStyle = NSTabViewControllerTabStyle.Toolbar;
|
||||
|
||||
Assert.IsFalse (controller.TabStyle == tabStyle, "NSTabViewControllerShouldChangeTabStyle - Failed to set the TabStyle property");
|
||||
}
|
||||
|
||||
// [Test]
|
||||
// public void NSTabViewControllerShouldChangeTabView ()
|
||||
// {
|
||||
// var tabView = controller.TabView;
|
||||
// controller.TabView = new NSTabView ();
|
||||
//
|
||||
// Assert.IsFalse (controller.TabView == tabView, "NSTabViewControllerShouldChangeTabView - Failed to set the TabView property");
|
||||
// }
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeSegmentedControl ()
|
||||
{
|
||||
// This API was removed in 10.11
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_11)
|
||||
return;
|
||||
|
||||
var segmentedControl = controller.SegmentedControl;
|
||||
controller.SegmentedControl = new NSSegmentedControl ();
|
||||
|
||||
Assert.IsFalse (controller.SegmentedControl == segmentedControl, "NSTabViewControllerShouldChangeSegmentedControl - Failed to set the SegmentedControl property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeTransitionOptions ()
|
||||
{
|
||||
var options = controller.TransitionOptions;
|
||||
controller.TransitionOptions = NSViewControllerTransitionOptions.Crossfade | NSViewControllerTransitionOptions.SlideRight;
|
||||
|
||||
Assert.IsFalse (controller.TransitionOptions == options, "NSTabViewControllerShouldChangeTransitionOptions - Failed to set the TransitionOptions property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeCanPropagateSelectedChildViewControllerTitle ()
|
||||
{
|
||||
var canPropogate = controller.CanPropagateSelectedChildViewControllerTitle;
|
||||
controller.CanPropagateSelectedChildViewControllerTitle = !canPropogate;
|
||||
|
||||
Assert.IsFalse (controller.CanPropagateSelectedChildViewControllerTitle == canPropogate, "NSTabViewControllerShouldChangeCanPropagateSelectedChildViewControllerTitle - Failed to set the CanPropagateSelectedChildViewControllerTitle property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeTabViewItems ()
|
||||
{
|
||||
var items = controller.TabViewItems;
|
||||
controller.TabViewItems = new NSTabViewItem [] { new NSTabViewItem { ViewController = new NSViewController () } };
|
||||
|
||||
Assert.IsFalse (controller.TabViewItems == items, "NSTabViewControllerShouldChangeTabViewItems - Failed to set the TabViewItems property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldChangeSelectedTabViewItemIndex ()
|
||||
{
|
||||
controller.TabViewItems = new NSTabViewItem [] {
|
||||
new NSTabViewItem { ViewController = new NSViewController () },
|
||||
new NSTabViewItem { ViewController = new NSViewController () },
|
||||
new NSTabViewItem { ViewController = new NSViewController () }
|
||||
};
|
||||
|
||||
var index = controller.SelectedTabViewItemIndex;
|
||||
controller.SelectedTabViewItemIndex = (index + 1) % 3;
|
||||
|
||||
Assert.IsFalse (controller.SelectedTabViewItemIndex == index, "NSTabViewControllerShouldChangeSelectedTabViewItemIndex - Failed to set the SelectedTabViewItemIndex property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldAddTabViewItem ()
|
||||
{
|
||||
var item = new NSTabViewItem { ViewController = new NSViewController () };
|
||||
controller.AddTabViewItem (item);
|
||||
|
||||
Assert.IsTrue (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldAddTabViewItem - Failed to add TabViewItem");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldRemoveTabViewItem ()
|
||||
{
|
||||
var item = new NSTabViewItem { ViewController = new NSViewController () };
|
||||
controller.AddTabViewItem (item);
|
||||
|
||||
Assert.IsTrue (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldRemoveTabViewItem - Failed to add item");
|
||||
|
||||
controller.RemoveTabViewItem (item);
|
||||
|
||||
Assert.IsFalse (controller.TabViewItems.Contains (item), "NSTabViewControllerShouldRemoveTabViewItem - Failed to remove item");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldInsertTabViewItem ()
|
||||
{
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
var item = new NSTabViewItem { ViewController = new NSViewController () };
|
||||
controller.InsertTabViewItem (item, 1);
|
||||
|
||||
Assert.IsTrue (controller.TabViewItems [1] == item, "NSTabViewControllerShouldInsertTabViewItem - Failed to insert the item at the given position.");
|
||||
Assert.IsFalse (controller.TabViewItems [0] == item, "NSTabViewControllerShouldInsertTabViewItem - Inserted the item in the wrong position.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewControllerShouldGetTabViewItem ()
|
||||
{
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
controller.AddTabViewItem (new NSTabViewItem { ViewController = new NSViewController () });
|
||||
var viewController = new NSViewController ();
|
||||
var item = new NSTabViewItem { ViewController = viewController };
|
||||
controller.InsertTabViewItem (item, 1);
|
||||
|
||||
var retrievedItem = controller.GetTabViewItem (viewController);
|
||||
|
||||
Assert.IsTrue (retrievedItem == item, "NSTabViewControllerShouldGetTabViewItem - Failed to get TabViewItem from ViewController");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTabViewItemTests
|
||||
{
|
||||
NSTabViewItem item;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
item = new NSTabViewItem ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewItemShouldChangeImage ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var image = item.Image;
|
||||
item.Image = new NSImage ();
|
||||
|
||||
Assert.IsFalse (item.Image == image, "NSTabViewItemShouldChangeImage - Failed to set the Image property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTabViewItemShouldChangeViewController ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var vc = item.ViewController;
|
||||
item.ViewController = new NSViewController ();
|
||||
|
||||
Assert.IsFalse (item.ViewController == vc, "NSTabViewItemShouldChangeViewController - Failed to set the ViewController property");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTableColumnTests
|
||||
{
|
||||
NSTableColumn column;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
column = new NSTableColumn ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTableColumnShouldChangeTitle ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var title = column.Title;
|
||||
column.Title = "Test";
|
||||
|
||||
Assert.IsFalse (column.Title == title, "NSTableColumnShouldChangeTitle - Failed to set the Title property");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTableRowViewTests
|
||||
{
|
||||
NSTableRowView view;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
view = new NSTableRowView ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTableRowViewShouldChangePreviousRowSelected ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var selected = view.PreviousRowSelected;
|
||||
view.PreviousRowSelected = !selected;
|
||||
|
||||
Assert.IsFalse (view.PreviousRowSelected == selected, "NSTableRowViewShouldChangePreviousRowSelected - Failed to set the PreviousRowSelected property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTableRowViewShouldChangeNextRowSelected ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var selected = view.NextRowSelected;
|
||||
view.NextRowSelected = !selected;
|
||||
|
||||
Assert.IsFalse (view.NextRowSelected == selected, "NSTableRowViewShouldChangeNextRowSelected - Failed to set the NextRowSelected property");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSTableViewTests
|
||||
{
|
||||
[Test]
|
||||
public void NSTableView_DelegateDataSourceNull ()
|
||||
{
|
||||
NSTableView v = new NSTableView ();
|
||||
v.WeakDelegate = null;
|
||||
v.Delegate = null;
|
||||
v.WeakDataSource = null;
|
||||
v.DataSource = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTextFieldTests
|
||||
{
|
||||
NSTextField textField;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
textField = new NSTextField ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextFieldShouldChangePlaceholderString ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var placeholder = textField.PlaceholderString;
|
||||
textField.PlaceholderString = "Test";
|
||||
|
||||
Assert.IsFalse (textField.PlaceholderString == placeholder, "NSTextFieldShouldChangePlaceholderString - Failed to set the PlaceholderString property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextFieldShouldChangePlaceholderAttributedString ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var placeholder = textField.PlaceholderAttributedString;
|
||||
textField.PlaceholderAttributedString = new NSAttributedString ("Test");
|
||||
|
||||
Assert.IsFalse (textField.PlaceholderAttributedString == placeholder, "NSTextFieldShouldChangePlaceholderAttributedString - Failed to set the PlaceholderAttributedString property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.AudioUnit;
|
||||
using MonoMac.AudioToolbox;
|
||||
using MonoMac.Foundation;
|
||||
using nuint = System.UInt32;
|
||||
#else
|
||||
using AppKit;
|
||||
using AudioUnit;
|
||||
using AudioToolbox;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSTextFinderTests
|
||||
{
|
||||
[Test]
|
||||
public void NSTextFinderConstructor ()
|
||||
{
|
||||
NSTextFinder f = new NSTextFinder ();
|
||||
Assert.IsNotNull (f);
|
||||
|
||||
FinderClient client = new FinderClient ();
|
||||
f.Client = client;
|
||||
}
|
||||
|
||||
class FinderClient : NSTextFinderClient
|
||||
{
|
||||
public override bool AllowsMultipleSelection { get { return true; } }
|
||||
|
||||
public override bool Editable { get { return true; } }
|
||||
|
||||
public override string String { get { return "Testing One Two Three"; } }
|
||||
|
||||
public override NSRange FirstSelectedRange { get { return new NSRange(); } }
|
||||
|
||||
public override NSArray SelectedRanges { get; set; }
|
||||
|
||||
public override NSArray VisibleCharacterRanges { get { return new NSArray(); } }
|
||||
|
||||
public override bool Selectable { get { return true; } }
|
||||
|
||||
public override string StringAtIndexeffectiveRangeendsWithSearchBoundary (nuint characterIndex, ref NSRange outRange, bool outFlag)
|
||||
{
|
||||
return String;
|
||||
}
|
||||
|
||||
public override nuint StringLength ()
|
||||
{
|
||||
return (nuint)String.Length;
|
||||
}
|
||||
|
||||
public override void ScrollRangeToVisible (NSRange range)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ShouldReplaceCharactersInRangeswithStrings (NSArray ranges, NSArray strings)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ReplaceCharactersInRangewithString (NSRange range, string str)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DidReplaceCharacters ()
|
||||
{
|
||||
}
|
||||
|
||||
public override NSView ContentViewAtIndexeffectiveCharacterRange (nuint index, ref NSRange outRange)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override NSArray RectsForCharacterRange (NSRange range)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void DrawCharactersInRangeforContentView (NSRange range, NSView view)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using CGPoint = System.Drawing.PointF;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace apitest
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSTextInputClient
|
||||
{
|
||||
NSTextView textView;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
textView = new NSTextView (new CGRect (0, 0, 37, 120));
|
||||
textView.Value = "This is a new string";
|
||||
Assert.AreEqual (textView.Value, "This is a new string", "NSTextInputClientSetup - Failed to set value");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldInsertText ()
|
||||
{
|
||||
textView.InsertText ((NSString)"Test", new NSRange (5, 4));
|
||||
|
||||
Assert.AreEqual (textView.Value, "This Test new string", "NSTextInputClient_ShouldInsertText - Failed to insert text");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldMarkText ()
|
||||
{
|
||||
textView.SetMarkedText ((NSString)"Testing", new NSRange (0, 10), new NSRange (5, 4));
|
||||
|
||||
Assert.IsTrue (textView.HasMarkedText, "NSTextInputClient_ShouldMarkText - Failed to mark text");
|
||||
Assert.AreEqual (textView.MarkedRange, new NSRange (5, 7));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetValidAttributesForMarkedText ()
|
||||
{
|
||||
Assert.IsTrue (textView.ValidAttributesForMarkedText.Length > 0, "NSTextInputClient_ShouldGetValidAttributesForMarkedTExt - No valid attributes");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldUnmarkText ()
|
||||
{
|
||||
textView.SetMarkedText ((NSString)"Testing", new NSRange (0, 10), new NSRange (5, 4));
|
||||
|
||||
Assert.IsTrue (textView.HasMarkedText, "NSTextInputClient_ShouldUnMarkText - Failed to mark text");
|
||||
|
||||
textView.UnmarkText ();
|
||||
|
||||
Assert.IsFalse (textView.HasMarkedText, "NSTextInputClient_ShouldUnmarkText - Failed to Unmark text");
|
||||
Assert.IsTrue (textView.MarkedRange.Length == 0, "NSTextInputClient_ShouldUnmarkText - MarkedRange is not 0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetAttributedSubstring ()
|
||||
{
|
||||
NSRange range;
|
||||
var attributedString = textView.GetAttributedSubstring (new NSRange (10, 15), out range);
|
||||
|
||||
Assert.AreEqual (attributedString.Value, "new string", "NSTextInputClient_ShouldGetAttributedSubstring - Failed to get the correct string");
|
||||
Assert.AreEqual (range, new NSRange (10, 10), "NSTextInputClient_ShouldGetAttributedSubstring - Wrong range value returned");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetFirstRect ()
|
||||
{
|
||||
NSRange range;
|
||||
var rect = textView.GetFirstRect (new NSRange (12, 18), out range);
|
||||
|
||||
Assert.AreEqual (rect, new CGRect (0, 0, 12, 14), "NSTextInputClient_ShouldGetFirstRect - Returned wrong rect");
|
||||
Assert.AreEqual (range, new NSRange (10, 4), "NSTextInputClient_ShouldGetFirstRect - Returned wrong Range");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetAttributedString ()
|
||||
{
|
||||
Assert.AreEqual (textView.AttributedString.Value, "This is a new string", "NSTextInputClient_ShouldGetAttributedString - Returned the wrong attributed string");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph ()
|
||||
{
|
||||
Assert.IsTrue (textView.GetFractionOfDistanceThroughGlyph (new CGPoint (1, 2)) == 0, "NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph - Returned wrong fraaction value");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetBaselineDelta ()
|
||||
{
|
||||
Assert.IsTrue (textView.GetBaselineDelta (4) == 11, "NSTextInputClient_ShouldGetBaselineDelta - Returned wrong baseline delta value");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetDrawsVertically ()
|
||||
{
|
||||
Assert.IsFalse (textView.DrawsVertically (4), "NSTextInputClient_ShouldGetDrawsVertically - Returned wrong value");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextInputClient_ShouldGetWindowLevel ()
|
||||
{
|
||||
Assert.AreEqual (textView.WindowLevel, NSWindowLevel.Normal, "NSTextInputClient_ShouldGetWindowLevel - WindowLevel returned the wrong value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSTextViewTests
|
||||
{
|
||||
NSTextView view;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
view = new NSTextView ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSTextViewShouldChangeUsesRolloverButtonForSelection ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var usesRollover = view.UsesRolloverButtonForSelection;
|
||||
view.UsesRolloverButtonForSelection = !usesRollover;
|
||||
|
||||
Assert.IsFalse (view.UsesRolloverButtonForSelection == usesRollover, "NSTextViewShouldChangeUsesRolloverButtonForSelection - Failed to set the UsesRolloverButtonForSelection property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSToolbarTests
|
||||
{
|
||||
NSToolbar toolbar;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
toolbar = new NSToolbar (NSToolbar.NSToolbarSeparatorItemIdentifier);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSToolbarShouldChangeAllowsExtensionItems ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var allows = toolbar.AllowsExtensionItems;
|
||||
toolbar.AllowsExtensionItems = !allows;
|
||||
|
||||
Assert.IsFalse (toolbar.AllowsExtensionItems == allows, "NSToolbarShouldChangeAllowsExtensionItems - Failed to set the AllowsExtensionItems property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSUserDefaultsControllerTests
|
||||
{
|
||||
NSUserDefaultsController controller;
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldGetSharedController ()
|
||||
{
|
||||
controller = NSUserDefaultsController.SharedUserDefaultsController;
|
||||
|
||||
Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldGetDefaultController - SharedUserDefaultsController returned null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldCreateNewControllerWithDefaultConstructor ()
|
||||
{
|
||||
controller = new NSUserDefaultsController ();
|
||||
|
||||
Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithDefaultConstructor - Constructor returned null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldCreateNewControllerWithNullParameters ()
|
||||
{
|
||||
controller = new NSUserDefaultsController (null, null);
|
||||
|
||||
Assert.IsTrue (controller.Defaults == NSUserDefaults.StandardUserDefaults);
|
||||
Assert.IsTrue (controller.InitialValues == null);
|
||||
Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithNullParameters - Constructor returned null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldCreateNewControllerWithParameters ()
|
||||
{
|
||||
var initialValues = new NSDictionary ();
|
||||
controller = new NSUserDefaultsController (NSUserDefaults.StandardUserDefaults, initialValues);
|
||||
|
||||
Assert.IsTrue (controller.Defaults == NSUserDefaults.StandardUserDefaults);
|
||||
Assert.IsTrue (controller.InitialValues == initialValues);
|
||||
Assert.IsNotNull (controller, "NSUserDefaultsControllerShouldCreateNewControllerWithParameters - Constructor returned null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldChangeInitialValues ()
|
||||
{
|
||||
controller = new NSUserDefaultsController (NSUserDefaults.StandardUserDefaults, null);
|
||||
var initialValues = controller.InitialValues;
|
||||
controller.InitialValues = new NSDictionary ();
|
||||
|
||||
Assert.IsFalse (controller.InitialValues == initialValues, "NSUserDefaultsControllerShouldChangeInitialValues - Failed to set the InitialValues property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSUserDefaultsControllerShouldChangeAppliesImmediately ()
|
||||
{
|
||||
controller = new NSUserDefaultsController (NSUserDefaults.StandardUserDefaults, null);
|
||||
var appliesImmediately = controller.AppliesImmediately;
|
||||
controller.AppliesImmediately = !appliesImmediately;
|
||||
|
||||
Assert.IsFalse (controller.AppliesImmediately == appliesImmediately, "NSUserDefaultsControllerShouldChangeAppliesImmediately - Failed to set the AppliesImmediately property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSViewTests
|
||||
{
|
||||
NSView view;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
view = new NSView ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewShouldAddGestureRecognizer ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var length = 0;
|
||||
if (view.GestureRecognizers != null)
|
||||
length = view.GestureRecognizers.Length;
|
||||
view.AddGestureRecognizer (new NSGestureRecognizer ());
|
||||
|
||||
Assert.IsTrue (view.GestureRecognizers.Length == length + 1, "NSViewShouldAddGestureRecognizer - Failed to add recognizer, count didn't change.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewShouldRemoveGestureRecognizer ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var recognizer = new NSClickGestureRecognizer ();
|
||||
view.AddGestureRecognizer (recognizer);
|
||||
|
||||
Assert.IsTrue (view.GestureRecognizers.Length != 0, "NSViewShouldRemoveGestureRecognizer - Failed to add gesture recognizer");
|
||||
|
||||
view.RemoveGestureRecognizer (recognizer);
|
||||
|
||||
Assert.IsTrue (view.GestureRecognizers.Length == 0, "NSViewShouldRemoveGestureRecognizer - Failed to remove gesture recognizer");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewShouldChangeGestureRecognizers ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var recognizers = view.GestureRecognizers;
|
||||
view.GestureRecognizers = new NSGestureRecognizer [] { new NSClickGestureRecognizer (), new NSPanGestureRecognizer () };
|
||||
|
||||
Assert.IsFalse (view.GestureRecognizers == recognizers);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AllItemsWithNSMenuShouldAllowNull ()
|
||||
{
|
||||
// Can't test typeof (NSResponder) since it is abstract
|
||||
List <Type> types = new List<Type> { typeof (NSCell), typeof (NSMenuItem), typeof (NSPathControl),
|
||||
typeof (NSPopUpButton), typeof (NSPopUpButtonCell) };
|
||||
if (IntPtr.Size == 4)
|
||||
types.Add (typeof (NSMenuView)); // NSMenuView is 32-bit only
|
||||
|
||||
foreach (Type t in types) {
|
||||
object o = Activator.CreateInstance (t);
|
||||
PropertyInfo prop = t.GetProperty("Menu", BindingFlags.Public | BindingFlags.Instance);
|
||||
prop.SetValue (o, null, null);
|
||||
}
|
||||
|
||||
// NSStateBarItem can't be created via default constructor
|
||||
NSStatusBar.SystemStatusBar.CreateStatusItem (10).Menu = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using System.Drawing;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSViewControllerTests
|
||||
{
|
||||
NSViewController controller;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
controller = new NSViewController ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewControllerShouldAddChildViewController ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var child = new NSViewController ();
|
||||
controller.AddChildViewController (child);
|
||||
|
||||
Assert.IsTrue (controller.ChildViewControllers.Length == 1, "NSViewControllerShouldAddChildViewControllers - Failed to add child view controller");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewControllerShouldRemoveChildViewController ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
var child = new NSViewController ();
|
||||
controller.AddChildViewController (child);
|
||||
|
||||
Assert.IsTrue (controller.ChildViewControllers.Length == 1, "NSViewControllerShouldRemoveChildViewControllers - Failed to add child view controller");
|
||||
|
||||
controller.RemoveChildViewController (0);
|
||||
|
||||
Assert.IsTrue (controller.ChildViewControllers.Length == 0, "NSViewControllerShouldRemoveChildViewController - Failed to remove child view controller");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSViewControllerShouldInsertChildViewController ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
controller.AddChildViewController (new NSViewController ());
|
||||
controller.AddChildViewController (new NSViewController ());
|
||||
|
||||
Assert.IsTrue (controller.ChildViewControllers.Length == 2, "NSViewControllerShouldInsertChildViewController - Failed to add child view controller");
|
||||
|
||||
var child = new NSViewController ();
|
||||
controller.InsertChildViewController (child, 1);
|
||||
|
||||
Assert.IsTrue (controller.ChildViewControllers.Length == 3, "NSViewControllerShouldInsertChildViewController - Failed to insert child view controller");
|
||||
Assert.IsTrue (controller.ChildViewControllers [1] == child, "NSViewControllerShouldInsertChildViewController - Inserted child view controller at the wrong index.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSVisualEffectViewTests
|
||||
{
|
||||
NSVisualEffectView view;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
view = new NSVisualEffectView ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSVisualEffectViewShouldChangeMaterial ()
|
||||
{
|
||||
var material = view.Material;
|
||||
view.Material = NSVisualEffectMaterial.Titlebar;
|
||||
|
||||
Assert.IsFalse (view.Material == material, "NSVisualEffectViewShouldChangeMaterial - Failed to set the Material property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSVisualEffectViewShouldChangeBlendingMode ()
|
||||
{
|
||||
var blendingMode = view.BlendingMode;
|
||||
view.BlendingMode = NSVisualEffectBlendingMode.WithinWindow;
|
||||
|
||||
Assert.IsFalse (view.BlendingMode == blendingMode, "NSVisualEffectViewShouldChangeBlendingMode - Failed to set the BlendingMode property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSVisualEffectViewShouldChangeState ()
|
||||
{
|
||||
var state = view.State;
|
||||
view.State = NSVisualEffectState.Inactive;
|
||||
|
||||
Assert.IsFalse (view.State == state, "NSVisualEffectViewShouldChangeState - Failed to set the State property");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSVisualEffectViewShouldChangeMaskImage ()
|
||||
{
|
||||
var image = view.MaskImage;
|
||||
view.MaskImage = new NSImage ();
|
||||
|
||||
Assert.IsFalse (view.MaskImage == image, "NSVisualEffectViewShouldChangeMaskImage - Failed to set the MaskImage property");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public class NSWindowControllerTests
|
||||
{
|
||||
[Test]
|
||||
public void NSWindowController_ShowWindowTest ()
|
||||
{
|
||||
NSWindowController c = new NSWindowController ();
|
||||
c.ShowWindow (null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSWorkspaceTests
|
||||
{
|
||||
[Test]
|
||||
public void NSWorkspaceConstantTests ()
|
||||
{
|
||||
Assert.IsNotNull (NSWorkspace.LaunchConfigurationAppleEvent);
|
||||
Assert.IsNotNull (NSWorkspace.LaunchConfigurationArguments);
|
||||
Assert.IsNotNull (NSWorkspace.LaunchConfigurationEnvironment);
|
||||
Assert.IsNotNull (NSWorkspace.LaunchConfigurationArchitecture);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
using NUnit.Framework;
|
||||
using TouchUnit.Bindings;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
public static class Asserts
|
||||
{
|
||||
public static bool IsAtLeastYosemite {
|
||||
get {
|
||||
return PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_10;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsAtLeastElCapitan {
|
||||
get {
|
||||
return PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_11;
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnsureYosemite ()
|
||||
{
|
||||
if (!IsAtLeastYosemite)
|
||||
Assert.Pass ("This test requires Yosemite. Skipping");
|
||||
}
|
||||
|
||||
public static void EnsureMavericks ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_9)
|
||||
Assert.Pass ("This test requires Mavericks. Skipping");
|
||||
}
|
||||
|
||||
public static void EnsureMountainLion ()
|
||||
{
|
||||
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_8)
|
||||
Assert.Pass ("This test requires Mountain Lion. Skipping");
|
||||
}
|
||||
|
||||
public static void Ensure64Bit ()
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
Assert.Pass ("This test requires 64-bit. Skipping");
|
||||
}
|
||||
|
||||
public static bool SkipDueToAvailabilityAttribute (ICustomAttributeProvider member)
|
||||
{
|
||||
if (member == null)
|
||||
return false;
|
||||
return !member.IsAvailableOnHostPlatform ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.AudioUnit;
|
||||
using MonoMac.AudioToolbox;
|
||||
#else
|
||||
using AppKit;
|
||||
using AudioUnit;
|
||||
using AudioToolbox;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AUGraphTests
|
||||
{
|
||||
int graphRenderCallbackCount = 0;
|
||||
int mixerRenderCallbackCount = 0;
|
||||
AUGraph graph;
|
||||
#if XAMCORE_2_0
|
||||
AudioUnit.AudioUnit mMixer;
|
||||
#else
|
||||
AudioUnit mMixer;
|
||||
#endif
|
||||
|
||||
void SetupAUGraph ()
|
||||
{
|
||||
graph = new AUGraph ();
|
||||
|
||||
AudioComponentDescription mixerDescription = new AudioComponentDescription ();
|
||||
mixerDescription.ComponentType = AudioComponentType.Mixer;
|
||||
mixerDescription.ComponentSubType = (int)AudioTypeMixer.MultiChannel;
|
||||
mixerDescription.ComponentFlags = 0;
|
||||
mixerDescription.ComponentFlagsMask = 0;
|
||||
mixerDescription.ComponentManufacturer = AudioComponentManufacturerType.Apple;
|
||||
|
||||
AudioComponentDescription outputDesciption = new AudioComponentDescription ();
|
||||
outputDesciption.ComponentType = AudioComponentType.Output;
|
||||
outputDesciption.ComponentSubType = (int)AudioTypeOutput.System;
|
||||
outputDesciption.ComponentFlags = 0;
|
||||
outputDesciption.ComponentFlagsMask = 0;
|
||||
outputDesciption.ComponentManufacturer = AudioComponentManufacturerType.Apple;
|
||||
|
||||
int mixerNode = graph.AddNode (mixerDescription);
|
||||
int outputNode = graph.AddNode (outputDesciption);
|
||||
|
||||
AUGraphError error = graph.ConnnectNodeInput (mixerNode, 0, outputNode, 0);
|
||||
Assert.AreEqual (AUGraphError.OK, error);
|
||||
|
||||
graph.Open ();
|
||||
|
||||
mMixer = graph.GetNodeInfo (mixerNode);
|
||||
|
||||
AudioUnitStatus status = mMixer.SetElementCount (AudioUnitScopeType.Input, 0);
|
||||
Assert.AreEqual (AudioUnitStatus.OK, status);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task DoTest ()
|
||||
{
|
||||
SetupAUGraph ();
|
||||
|
||||
// One of these has to be commented out depending on old\new build
|
||||
graph.AddRenderNotify (GraphRenderCallback);
|
||||
//graph.RenderCallback += HandleRenderCallback;
|
||||
|
||||
AudioUnitStatus status = mMixer.SetRenderCallback (MixerRenderCallback);
|
||||
Assert.AreEqual (AudioUnitStatus.OK, status );
|
||||
|
||||
await WaitOnGraphAndMixerCallbacks ();
|
||||
}
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
#pragma warning disable 0612
|
||||
void HandleRenderCallback (object sender, AudioGraphEventArgs e)
|
||||
{
|
||||
graphRenderCallbackCount++;
|
||||
}
|
||||
#pragma warning restore 0612
|
||||
#endif
|
||||
|
||||
AudioUnitStatus GraphRenderCallback (AudioUnitRenderActionFlags actionFlags, AudioTimeStamp timeStamp, uint busNumber, uint numberFrames, AudioBuffers data)
|
||||
{
|
||||
graphRenderCallbackCount++;
|
||||
return AudioUnitStatus.NoError;
|
||||
}
|
||||
|
||||
AudioUnitStatus MixerRenderCallback (AudioUnitRenderActionFlags actionFlags, AudioTimeStamp timeStamp, uint busNumber, uint numberFrames, AudioBuffers data)
|
||||
{
|
||||
mixerRenderCallbackCount++;
|
||||
return AudioUnitStatus.NoError;
|
||||
}
|
||||
|
||||
async Task WaitOnGraphAndMixerCallbacks ()
|
||||
{
|
||||
graph.Initialize ();
|
||||
graph.Start ();
|
||||
|
||||
// Wait for 1 second, then give up
|
||||
try {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
if (graphRenderCallbackCount > 0 && mixerRenderCallbackCount > 0)
|
||||
return;
|
||||
await Task.Delay (10);
|
||||
}
|
||||
Assert.Fail ("Did not see events after 1 second");
|
||||
}
|
||||
finally {
|
||||
graph.Stop ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.AudioUnit;
|
||||
using theUnit = MonoMac.AudioUnit.AudioUnit; // Namespace fun
|
||||
#else
|
||||
using AppKit;
|
||||
using AudioUnit;
|
||||
using theUnit = AudioUnit.AudioUnit;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AudioUnitTests
|
||||
{
|
||||
theUnit GetAudioUnitForTest ()
|
||||
{
|
||||
AudioComponentDescription desc = new AudioComponentDescription ();
|
||||
desc.ComponentType = AudioComponentType.Output;
|
||||
desc.ComponentSubType = 1634230636; // 'ahal'
|
||||
desc.ComponentFlags = 0;
|
||||
desc.ComponentFlagsMask = 0;
|
||||
desc.ComponentManufacturer = AudioComponentManufacturerType.Apple;
|
||||
|
||||
AudioComponent comp = AudioComponent.FindNextComponent (null, ref desc);
|
||||
theUnit unit = new theUnit (comp);
|
||||
return unit;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCurrentDevice_Test ()
|
||||
{
|
||||
theUnit unit = GetAudioUnitForTest ();
|
||||
|
||||
uint device = unit.GetCurrentDevice (AudioUnitScopeType.Global);
|
||||
Assert.IsTrue (device != 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AudioObjectPropertySelector4CCTest ()
|
||||
{
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.Devices), Is.EqualTo ("dev#"), "dev#");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.DefaultInputDevice), Is.EqualTo ("dIn "), "dIn ");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.DefaultOutputDevice), Is.EqualTo ("dOut"), "dOut");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.DefaultSystemOutputDevice), Is.EqualTo ("sOut"), "sOut");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.TranslateUIDToDevice), Is.EqualTo ("uidd"), "uidd");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.MixStereoToMono), Is.EqualTo ("stmo"), "stmo");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.PlugInList), Is.EqualTo ("plg#"), "plg#");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.TranslateBundleIDToPlugIn), Is.EqualTo ("bidp"), "bidp");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.TransportManagerList), Is.EqualTo ("tmg#"), "tmg#");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.TranslateBundleIDToTransportManager), Is.EqualTo ("tmbi"), "tmbi");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.BoxList), Is.EqualTo ("box#"), "box#");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.TranslateUIDToBox), Is.EqualTo ("uidb"), "uidb");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.ProcessIsMaster), Is.EqualTo ("mast"), "mast");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.IsInitingOrExiting), Is.EqualTo ("inot"), "inot");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.UserIDChanged), Is.EqualTo ("euid"), "euid");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.ProcessIsAudible), Is.EqualTo ("pmut"), "pmut");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.SleepingIsAllowed), Is.EqualTo ("slep"), "slep");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.UnloadingIsAllowed), Is.EqualTo ("unld"), "unld");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.HogModeIsAllowed), Is.EqualTo ("hogr"), "hogr");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.UserSessionIsActiveOrHeadless), Is.EqualTo ("user"), "user");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.ServiceRestarted), Is.EqualTo ("srst"), "srst");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertySelector.PowerHint), Is.EqualTo ("powh"), "powh");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AudioObjectPropertyScope4CCTest ()
|
||||
{
|
||||
Assert.That (FourCC ((int) AudioObjectPropertyScope.Global), Is.EqualTo ("glob"), "glob");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertyScope.Input), Is.EqualTo ("inpt"), "inpt");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertyScope.Output), Is.EqualTo ("outp"), "outp");
|
||||
Assert.That (FourCC ((int) AudioObjectPropertyScope.PlayThrough), Is.EqualTo ("ptru"), "ptru");
|
||||
}
|
||||
|
||||
string FourCC (int value)
|
||||
{
|
||||
return new string (new char [] {
|
||||
(char) (byte) (value >> 24),
|
||||
(char) (byte) (value >> 16),
|
||||
(char) (byte) (value >> 8),
|
||||
(char) (byte) value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.CoreGraphics;
|
||||
using MonoMac.Foundation;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CABasicAnimationTests
|
||||
{
|
||||
[Test]
|
||||
public void CABasicAnimation_FromToBy_INativeTests ()
|
||||
{
|
||||
CABasicAnimation test = CABasicAnimation.FromKeyPath ("bounds");
|
||||
NSNumber number = new NSNumber (10);
|
||||
test.From = number;
|
||||
Assert.AreEqual (test.From, number, "NSObject from");
|
||||
test.To = number;
|
||||
Assert.AreEqual (test.To, number, "NSObject to");
|
||||
test.By = number;
|
||||
Assert.AreEqual (test.By, number, "NSObject by");
|
||||
|
||||
CGColor color = new CGColor (.5f, .5f, .5f);
|
||||
test = CABasicAnimation.FromKeyPath ("color");
|
||||
test.SetFrom (color);
|
||||
Assert.AreEqual (test.GetFromAs<CGColor> (), color, "INativeObject from");
|
||||
test.SetTo (color);
|
||||
Assert.AreEqual (test.GetToAs<CGColor> (), color, "INativeObject to");
|
||||
test.SetBy (color);
|
||||
Assert.AreEqual (test.GetByAs<CGColor> (), color, "INativeObject by");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.CoreGraphics;
|
||||
using MonoMac.Foundation;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CAKeyFrameAnimationTests
|
||||
{
|
||||
[Test]
|
||||
public void CAKeyFrameAnimation_ValuesTests ()
|
||||
{
|
||||
CAKeyFrameAnimation keyFrameAni = new CAKeyFrameAnimation();
|
||||
keyFrameAni.Values = new NSObject [] { new NSNumber (5) };
|
||||
Assert.AreEqual (1, keyFrameAni.Values.Length);
|
||||
NSNumber arrayNumber = (NSNumber)keyFrameAni.Values[0];
|
||||
Assert.AreEqual (5, arrayNumber.Int32Value);
|
||||
|
||||
CGRect frame = new CGRect (10, 10, 0, 0);
|
||||
CGImage image = CGImage.ScreenImage (0, frame);
|
||||
|
||||
keyFrameAni.SetValues (new CGImage [] {image, image});
|
||||
Assert.AreEqual (2, keyFrameAni.Values.Length);
|
||||
CGImage arrayImage = (CGImage)keyFrameAni.GetValuesAs<CGImage> ()[1];
|
||||
Assert.AreEqual (image.Handle, arrayImage.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.CoreGraphics;
|
||||
using MonoMac.Foundation;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CALayerTests
|
||||
{
|
||||
[Test]
|
||||
public void CALayer_ValuesTests ()
|
||||
{
|
||||
CALayer layer = new CALayer ();
|
||||
CGRect frame = new CGRect (10, 10, 0, 0);
|
||||
CGImage image = CGImage.ScreenImage (0, frame);
|
||||
NSImage NSImage = new NSImage ();
|
||||
|
||||
layer.Contents = image;
|
||||
CGImage arrayImage = layer.Contents;
|
||||
Assert.AreEqual (image.Handle, arrayImage.Handle);
|
||||
|
||||
layer.SetContents (NSImage);
|
||||
NSImage arrayNSImage = layer.GetContentsAs<NSImage> ();
|
||||
Assert.AreEqual (NSImage.Handle, arrayNSImage.Handle);
|
||||
|
||||
layer.SetContents (null); // Should not throw
|
||||
layer.Contents = null; // Should not throw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.OpenGL;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using OpenGL;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CAOpenGLLayerTest
|
||||
{
|
||||
[Test]
|
||||
public void SubclassedTest ()
|
||||
{
|
||||
using (var layer = new OpenGLLayer ()) {
|
||||
Messaging.IntPtr_objc_msgSend (layer.Handle, Selector.GetHandle ("copyCGLPixelFormatForDisplayMask:"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class OpenGLLayer : CAOpenGLLayer
|
||||
{
|
||||
public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
|
||||
{
|
||||
var attribs = new object [] {
|
||||
CGLPixelFormatAttribute.Accelerated,
|
||||
CGLPixelFormatAttribute.DoubleBuffer,
|
||||
CGLPixelFormatAttribute.ColorSize, 24,
|
||||
CGLPixelFormatAttribute.DepthSize, 16 };
|
||||
|
||||
CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs);
|
||||
return pixelFormat;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.CoreImage;
|
||||
using MonoMac.CoreGraphics;
|
||||
using CGSize = System.Drawing.SizeF;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using CoreImage;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CIFilterTests
|
||||
{
|
||||
[Test]
|
||||
public void CIFilterOutputImageTest ()
|
||||
{
|
||||
NSImage nsImg = new NSImage (new CGSize (400, 400));
|
||||
nsImg.LockFocus ();
|
||||
NSColor.Red.SetFill ();
|
||||
NSBezierPath.FillRect (new CGRect (0, 0, 400, 400));
|
||||
nsImg.UnlockFocus ();
|
||||
|
||||
CIImage img = CIImage.FromCGImage (nsImg.CGImage);
|
||||
var gloom = new CIGloom () {
|
||||
Image = img,
|
||||
Intensity = 5,
|
||||
Radius = 1
|
||||
};
|
||||
var output = gloom.OutputImage;
|
||||
Assert.IsNotNull (output, "CIFilterOutputImageTest - output was null");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using Foundation;
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
static class TypeExtension {
|
||||
public static PropertyInfo GetMostDerivedProperty (this Type t, string name)
|
||||
{
|
||||
while (t != null && t != t.BaseType) {
|
||||
var rv = t.GetProperty (name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
|
||||
if (rv != null)
|
||||
return rv;
|
||||
t = t.BaseType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class DelegateAndDataSourceTest
|
||||
{
|
||||
[Test]
|
||||
public void DelegateAndDataSourceAllowsNull ()
|
||||
{
|
||||
var failingTypes = new Dictionary<Type, string> ();
|
||||
|
||||
// Get our binding assembly
|
||||
var xamMac = typeof (NSObject).Assembly;
|
||||
|
||||
// Walk all non abstract types, looking for things with zero param constructors
|
||||
foreach (Type t in xamMac.GetTypes ().Where (t => !t.IsAbstract)) {
|
||||
// Check availability attributes.
|
||||
if (Asserts.SkipDueToAvailabilityAttribute (t) || skip (t))
|
||||
continue;
|
||||
|
||||
var ctor = t.GetConstructor (BindingFlags.Instance | BindingFlags.Public, null, new Type[0], null);
|
||||
|
||||
// If they have one of the properites we are testing
|
||||
if (ctor != null) {
|
||||
PropertyInfo weakDelegate = t.GetMostDerivedProperty("WeakDelegate");
|
||||
PropertyInfo del = t.GetMostDerivedProperty("Delegate");
|
||||
PropertyInfo weakDataSource = t.GetMostDerivedProperty("WeakDataSource");
|
||||
PropertyInfo dataSource = t.GetMostDerivedProperty("DataSource");
|
||||
if (isValidToTest (weakDelegate) || isValidToTest (del) ||
|
||||
isValidToTest (weakDataSource) || isValidToTest (dataSource) ) {
|
||||
try {
|
||||
// Create an instance and try to set null
|
||||
using (var instance = (IDisposable) ctor.Invoke (null)) {
|
||||
if (isValidToTest (weakDelegate)) {
|
||||
weakDelegate.SetValue (instance, null, null);
|
||||
}
|
||||
if (isValidToTest (del)) {
|
||||
del.SetValue (instance, null, null);
|
||||
}
|
||||
if (isValidToTest (weakDataSource)) {
|
||||
weakDataSource.SetValue (instance, null, null);
|
||||
}
|
||||
if (isValidToTest (dataSource)) {
|
||||
dataSource.SetValue (instance, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (TargetInvocationException e) {
|
||||
failingTypes.Add (t, e.InnerException.Message);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assert.Fail ("Unexpected exception {0} while testing {1}", e, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GC.Collect (2); // Flush out random failures. Some classes only act badly when disposed
|
||||
if (failingTypes.Count > 0) {
|
||||
Console.WriteLine ("{0} failing types:", failingTypes.Count);
|
||||
foreach (var kvp in failingTypes)
|
||||
Console.WriteLine ("{0}: {1}", kvp.Key, kvp.Value);
|
||||
Assert.Fail ("{0} failing types", failingTypes.Count);
|
||||
}
|
||||
}
|
||||
|
||||
bool skip (Type t)
|
||||
{
|
||||
switch (t.Name) {
|
||||
case "AVAssetResourceLoader":
|
||||
case "AVAssetResourceLoadingRequest":
|
||||
case "AVAssetResourceLoadingContentInformationRequest":
|
||||
case "SCNRenderer":
|
||||
case "NSStream":
|
||||
case "NSSharingServicePicker":
|
||||
case "NSCache":
|
||||
case "NSToolbar":
|
||||
case "NSComboBox":
|
||||
case "NSComboBoxCell":
|
||||
case "IKScannerDeviceView":
|
||||
case "NSUserActivity":
|
||||
case "NSFontPanel":
|
||||
case "AVAudioRecorder":
|
||||
case "MKMapView":
|
||||
case "SKScene":
|
||||
case "NSSpeechRecognizer":
|
||||
case "NSClickGestureRecognizer":
|
||||
// These classes don't do well when you instance them without support
|
||||
return true;
|
||||
case "SCNLayer":
|
||||
case "SCNProgram":
|
||||
if (Asserts.IsAtLeastElCapitan && IntPtr.Size == 4)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Based on bug 28505 - NSTabView wasn't holding a reference to the Delegate property under new ref count.
|
||||
// An ArgumentSemantic (Strong, Retain, etc) is required to keep the reference around so the app doesn't crash after a GC.
|
||||
// This test scans all bindings looking for instances where bindings don't have the correct ArgumentSemantic
|
||||
[Test]
|
||||
public void DelegateAndDataSourceHaveArgumentSemanticAttribute ()
|
||||
{
|
||||
var failingTypes = new Dictionary<Type, string> ();
|
||||
|
||||
// Get our binding assembly
|
||||
var xamMac = typeof (NSObject).Assembly;
|
||||
|
||||
foreach (Type t in xamMac.GetTypes ().Where (t => !t.IsAbstract)) {
|
||||
// Check availability attributes.
|
||||
if (Asserts.SkipDueToAvailabilityAttribute (t))
|
||||
continue;
|
||||
|
||||
PropertyInfo weakDelegate = t.GetMostDerivedProperty ("WeakDelegate");
|
||||
PropertyInfo del = t.GetMostDerivedProperty ("Delegate");
|
||||
|
||||
MethodInfo[] accessors = null;
|
||||
|
||||
if (del != null) {
|
||||
if (weakDelegate != null) {
|
||||
if (!weakDelegate.CanWrite)
|
||||
continue;
|
||||
|
||||
accessors = weakDelegate.GetAccessors ();
|
||||
} else {
|
||||
if (!del.CanWrite)
|
||||
continue;
|
||||
|
||||
accessors = del.GetAccessors ();
|
||||
}
|
||||
|
||||
foreach (var accessor in accessors) {
|
||||
var attr = accessor.GetCustomAttributes <ExportAttribute> ().FirstOrDefault (a => a.Selector == "delegate");
|
||||
if (attr == null)
|
||||
continue;
|
||||
|
||||
if (attr.ArgumentSemantic == ArgumentSemantic.None) {
|
||||
failingTypes.Add (t, "Delegate has no ArgumentSemantic set");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertyInfo weakDataSource = t.GetMostDerivedProperty ("WeakDataSource");
|
||||
PropertyInfo dataSource = t.GetMostDerivedProperty ("DataSource");
|
||||
|
||||
if (dataSource != null) {
|
||||
accessors = null;
|
||||
if (weakDataSource != null) {
|
||||
if (!weakDataSource.CanWrite)
|
||||
continue;
|
||||
|
||||
accessors = weakDataSource.GetAccessors ();
|
||||
} else {
|
||||
if (!dataSource.CanWrite)
|
||||
continue;
|
||||
|
||||
accessors = dataSource.GetAccessors ();
|
||||
}
|
||||
|
||||
foreach (var accessor in accessors) {
|
||||
var attr = accessor.GetCustomAttributes <ExportAttribute> ().FirstOrDefault (a => a.Selector == "dataSource");
|
||||
if (attr == null)
|
||||
continue;
|
||||
|
||||
if (attr.ArgumentSemantic == ArgumentSemantic.None) {
|
||||
failingTypes.Add (t, "Data Source has no ArgumentSemantic set");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (failingTypes.Count > 0) {
|
||||
Console.WriteLine ("{0} failing types:", failingTypes.Count);
|
||||
foreach (var kvp in failingTypes)
|
||||
Console.WriteLine ("{0}: {1}", kvp.Key, kvp.Value);
|
||||
Assert.Fail ("{0} failing types", failingTypes.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TargetArgumentSemanticAttribute ()
|
||||
{
|
||||
var failingTypes = new Dictionary<Type, string> ();
|
||||
|
||||
// Get our binding assembly
|
||||
var xamMac = typeof (NSObject).Assembly;
|
||||
|
||||
foreach (Type t in xamMac.GetTypes ().Where (t => !t.IsAbstract)) {
|
||||
// Check availability attributes.
|
||||
if (Asserts.SkipDueToAvailabilityAttribute (t))
|
||||
continue;
|
||||
|
||||
PropertyInfo target = t.GetMostDerivedProperty ("Target");
|
||||
if (target != null && target.PropertyType == typeof (NSObject)) {
|
||||
MethodInfo[] accessors = target.GetAccessors ();
|
||||
foreach (var accessor in accessors) {
|
||||
var attr = accessor.GetCustomAttributes <ExportAttribute> ().FirstOrDefault (a => a.Selector == "target");
|
||||
if (attr == null)
|
||||
continue;
|
||||
|
||||
if (attr.ArgumentSemantic == ArgumentSemantic.None) {
|
||||
failingTypes.Add (t, "Target has no ArgumentSemantic set");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (failingTypes.Count > 0) {
|
||||
Console.WriteLine ("{0} failing types:", failingTypes.Count);
|
||||
foreach (var kvp in failingTypes)
|
||||
Console.WriteLine ("{0}: {1}", kvp.Key, kvp.Value);
|
||||
Assert.Fail ("{0} failing types", failingTypes.Count);
|
||||
}
|
||||
}
|
||||
|
||||
bool isValidToTest (PropertyInfo p)
|
||||
{
|
||||
return p != null && p.CanWrite && !Asserts.SkipDueToAvailabilityAttribute (p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
#if XAMCORE_2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Foundation;
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class DerivedEventTest
|
||||
{
|
||||
[Test]
|
||||
public void DerivedEvents_DontStompEachOther ()
|
||||
{
|
||||
NSComboBox b = new NSComboBox (new CGRect (0, 0, 200, 25));
|
||||
|
||||
b.SelectionChanged += (sender, e) => Console.WriteLine ("Change");
|
||||
TestDelegates (b);
|
||||
b.EditingEnded += (sender, e) => Console.WriteLine ("Edit");
|
||||
TestDelegates (b);
|
||||
b.Delegate = null;
|
||||
|
||||
b.EditingEnded += (sender, e) => Console.WriteLine ("Edit");
|
||||
TestDelegates (b);
|
||||
b.SelectionChanged += (sender, e) => Console.WriteLine ("Change");
|
||||
TestDelegates (b);
|
||||
}
|
||||
|
||||
void TestDelegates (NSComboBox b)
|
||||
{
|
||||
NSTextField f = (NSTextField)b;
|
||||
Assert.IsNotNull (b.Delegate, "NSComboBox delegate null");
|
||||
Assert.IsNotNull (f.Delegate, "NSTextField delegate null");
|
||||
Assert.AreEqual (b.Delegate.GetHashCode (), f.Delegate.GetHashCode (), "Delegates are not equal");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DerivedEvents_OverwriteThrows ()
|
||||
{
|
||||
TestOverrideThrow (false, true);
|
||||
TestOverrideThrow (true, true);
|
||||
#if MONOMAC
|
||||
NSApplication.CheckForEventAndDelegateMismatches = false;
|
||||
#else
|
||||
UIApplication.CheckForEventAndDelegateMismatches = false;
|
||||
#endif
|
||||
TestOverrideThrow (false, false);
|
||||
TestOverrideThrow (true, false);
|
||||
}
|
||||
|
||||
void TestOverrideThrow (bool eventFirst, bool shouldThrow)
|
||||
{
|
||||
NSComboBox b = new NSComboBox (new CGRect (0, 0, 200, 25));
|
||||
if (eventFirst)
|
||||
b.SelectionChanged += (sender, e) => Console.WriteLine ("Change");
|
||||
else
|
||||
b.Delegate = new NSComboBoxDelegate ();
|
||||
|
||||
bool didThrow = false;
|
||||
try {
|
||||
if (eventFirst)
|
||||
b.Delegate = new NSComboBoxDelegate ();
|
||||
else
|
||||
b.SelectionChanged += (sender, e) => Console.WriteLine ("Change");
|
||||
}
|
||||
catch (System.InvalidOperationException) {
|
||||
didThrow = true;
|
||||
}
|
||||
if (shouldThrow != didThrow)
|
||||
Assert.Fail ("TestOverrideThrow ({0}, {1}) did not have expected thrown status", eventFirst, shouldThrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac;
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class EveryFrameworkSmokeTests
|
||||
{
|
||||
enum LoadStatus { FailTest, Acceptable };
|
||||
|
||||
LoadStatus CheckLoadFailure (string libraryName, string path)
|
||||
{
|
||||
// Easy pass if the library doesn't even exist on the system...
|
||||
if (!File.Exists (path))
|
||||
return LoadStatus.Acceptable;
|
||||
|
||||
// No bindings for any of these yet
|
||||
switch (libraryName) {
|
||||
case "CryptoTokenKitLibrary":
|
||||
case "FinderSyncLibrary":
|
||||
case "HypervisorLibrary":
|
||||
return LoadStatus.Acceptable;
|
||||
}
|
||||
|
||||
// These libraries only have 64-bit version
|
||||
bool is64Bit = IntPtr.Size == 8;
|
||||
if (!is64Bit) {
|
||||
switch (libraryName) {
|
||||
case "AVKitLibrary":
|
||||
case "AccountsLibrary":
|
||||
case "CloudKitLibrary":
|
||||
case "ContactsLibrary":
|
||||
case "ContactsUILibrary":
|
||||
case "CryptoTokenKitLibrary":
|
||||
case "EventKitLibrary":
|
||||
case "FinderSyncLibrary":
|
||||
case "GLKitLibrary":
|
||||
case "GameControllerLibrary":
|
||||
case "GameplayKitLibrary":
|
||||
case "HypervisorLibrary":
|
||||
case "LocalAuthenticationLibrary":
|
||||
case "MapKitLibrary":
|
||||
case "MediaLibraryLibrary":
|
||||
case "MetalKitLibrary":
|
||||
case "ModelIOLibrary":
|
||||
case "MultipeerConnectivityLibrary":
|
||||
case "NetworkExtensionLibrary":
|
||||
case "NotificationCenterLibrary":
|
||||
case "SceneKitLibrary":
|
||||
case "SocialLibrary":
|
||||
case "SpriteKitLibrary":
|
||||
return LoadStatus.Acceptable;
|
||||
}
|
||||
}
|
||||
|
||||
return LoadStatus.FailTest;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExpectedLibrariesAreLoaded ()
|
||||
{
|
||||
List<string> failures = new List<string> ();
|
||||
|
||||
// In the past, we've missed frameworks in NSObject.mac.cs and shipped brokeness
|
||||
// This test tries to verify every framework listed in Constants either is loaded or expected to not be
|
||||
foreach (FieldInfo info in typeof(Constants).GetFields ().Where (x => x.Name.EndsWith ("Library")) ) {
|
||||
string path = (string)info.GetRawConstantValue ();
|
||||
// Use RTLD_NOLOAD (0x10) so we don't load, just check to see if it is in memory
|
||||
IntPtr handle = Dlfcn.dlopen (path, 0x10);
|
||||
if (handle == IntPtr.Zero && CheckLoadFailure (info.Name, path) == LoadStatus.FailTest)
|
||||
failures.Add (string.Format ("{0} ({1}) failed to load but this was not expected", info.Name, path));
|
||||
}
|
||||
|
||||
if (failures.Count > 0)
|
||||
Assert.Fail (string.Join ("\n", failures));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AppleScriptTests
|
||||
{
|
||||
[Test]
|
||||
public void AppleScript_BasicTest ()
|
||||
{
|
||||
#pragma warning disable 0219
|
||||
const string script = @"tell application ""Finder""
|
||||
end tell";
|
||||
NSAppleScript s = new NSAppleScript (script);
|
||||
|
||||
NSDictionary errorInfo;
|
||||
bool success = s.CompileAndReturnError(out errorInfo);
|
||||
Assert.IsTrue (success);
|
||||
Assert.IsNull (errorInfo);
|
||||
Assert.IsTrue (s.Compiled);
|
||||
|
||||
NSAppleEventDescriptor descriptor = s.ExecuteAndReturnError (out errorInfo);
|
||||
Assert.IsNull (errorInfo);
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.AppKit;
|
||||
#else
|
||||
using Foundation;
|
||||
using AppKit;
|
||||
#endif
|
||||
|
||||
namespace apitest
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSFormatterTests
|
||||
{
|
||||
NSNumberFormatter formatter;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
formatter = new NSNumberFormatter ();
|
||||
formatter.NumberStyle = NSNumberFormatterStyle.Currency;
|
||||
formatter.Locale = NSLocale.FromLocaleIdentifier ("en-US");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSFormatter_ShouldGetString ()
|
||||
{
|
||||
var str = formatter.StringFor (NSNumber.FromFloat (0.12f));
|
||||
|
||||
Assert.AreEqual (str, "$0.12");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSFormatter_ShouldGetAttributedString ()
|
||||
{
|
||||
var str = formatter.GetAttributedString (NSNumber.FromFloat (3.21f), new NSStringAttributes () { Font = NSFont.SystemFontOfSize (8) });
|
||||
|
||||
Assert.AreEqual (str.Value, "$3.21");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSFormatter_ShouldGetEditingString ()
|
||||
{
|
||||
var str = formatter.EditingStringFor (NSNumber.FromInt32 (14));
|
||||
|
||||
Assert.AreEqual (str, "$14.00");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSFormatter_IsPartialStringValid ()
|
||||
{
|
||||
string newstr;
|
||||
NSString error;
|
||||
formatter.PartialStringValidationEnabled = true;
|
||||
var valid = formatter.IsPartialStringValid ("valid string", out newstr, out error);
|
||||
|
||||
Assert.IsTrue (valid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using nint = System.Int32;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSIndexSetTests
|
||||
{
|
||||
[Test]
|
||||
public void NSIndexSet_ConstructorTest ()
|
||||
{
|
||||
#pragma warning disable 0219
|
||||
NSIndexSet a = new NSIndexSet ((int)5);
|
||||
#if XAMCORE_2_0
|
||||
NSIndexSet b = new NSIndexSet ((uint)5);
|
||||
NSIndexSet c = new NSIndexSet ((nint)5);
|
||||
#endif
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSIndexSet_EmptyToList ()
|
||||
{
|
||||
NSIndexSet a = new NSIndexSet ();
|
||||
#pragma warning disable 0219
|
||||
var b = a.ToList ();
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSIndexSet_EmptyToArray ()
|
||||
{
|
||||
NSIndexSet a = new NSIndexSet ();
|
||||
#pragma warning disable 0219
|
||||
var b = a.ToArray ();
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
#else
|
||||
using AppKit;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSLayoutConstraintTest
|
||||
{
|
||||
[Test]
|
||||
public void FromVisualFormat ()
|
||||
{
|
||||
using (var testView = new TestView ()) {
|
||||
var constraints = NSLayoutConstraint.FromVisualFormat ("[firstLabel]-[secondLabel]-|",
|
||||
NSLayoutFormatOptions.DirectionLeadingToTrailing,
|
||||
"firstLabel", testView.FirstLabel,
|
||||
"secondLabel", testView.SecondLabel
|
||||
);
|
||||
|
||||
const int expectedNumberOfConstraints = 2;
|
||||
|
||||
Assert.That (constraints != null,
|
||||
"'NSLayoutConstraint.FromVisualFormat' method returned no constraints");
|
||||
|
||||
Assert.That (constraints.Length == expectedNumberOfConstraints,
|
||||
string.Format ("Expected number of constraints is {0}. Actual number is {1}", expectedNumberOfConstraints, constraints.Length));
|
||||
|
||||
Assert.That (constraints [0].FirstItem == testView.SecondLabel,
|
||||
"First item of constraints[0] is not testView.SecondLabel");
|
||||
Assert.That (constraints [0].SecondItem == testView.FirstLabel,
|
||||
"Second item of constraints[0] is not testView.FirstLabel");
|
||||
Assert.That (constraints [0].Relation == NSLayoutRelation.Equal,
|
||||
string.Format ("Relation between views of constraints[0] must be `NSLayoutRelation.Equal`. Actual realtion is {0}", constraints [0].Relation));
|
||||
|
||||
Assert.That (constraints [1].FirstItem == testView,
|
||||
"First item of constraints[1] is not testView");
|
||||
Assert.That (constraints [1].SecondItem == testView.SecondLabel,
|
||||
"Second item of constraints[1] is not testView.SecondLabel");
|
||||
Assert.That (constraints [1].Relation == NSLayoutRelation.Equal,
|
||||
string.Format ("Relation between views of constraints[1] must be `NSLayoutRelation.Equal`. Actual realtion is {0}", constraints [1].Relation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestView : NSView
|
||||
{
|
||||
public NSTextView FirstLabel { get; private set; }
|
||||
|
||||
public NSTextView SecondLabel { get; private set; }
|
||||
|
||||
public TestView ()
|
||||
{
|
||||
FirstLabel = new NSTextView {
|
||||
TranslatesAutoresizingMaskIntoConstraints = false
|
||||
};
|
||||
|
||||
AddSubview (FirstLabel);
|
||||
|
||||
SecondLabel = new NSTextView {
|
||||
TranslatesAutoresizingMaskIntoConstraints = false
|
||||
};
|
||||
|
||||
AddSubview (SecondLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using nint = System.Int32;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSObjectTests
|
||||
{
|
||||
[Test]
|
||||
async public Task NSObjectTests_InvokeTest ()
|
||||
{
|
||||
bool hit = false;
|
||||
NSApplication.SharedApplication.Invoke (() => hit = true, 1);
|
||||
// Wait for 10 second, then give up
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
if (hit)
|
||||
return;
|
||||
await Task.Delay (10);
|
||||
}
|
||||
Assert.Fail ("Did not see events after 10 second");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
// Copyright 2015 Xamarin, Inc.
|
||||
|
||||
using System;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.Foundation {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class NSScriptCommandArgumentDescriptionKeysTest {
|
||||
[Test]
|
||||
public void TestAppleEventCodeKey ()
|
||||
{
|
||||
Assert.IsNotNull (NSScriptCommandArgumentDescriptionKeys.AppleEventCodeKey);
|
||||
Assert.AreEqual ("AppleEventCode", NSScriptCommandArgumentDescriptionKeys.AppleEventCodeKey?.ToString ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTypeKey ()
|
||||
{
|
||||
Assert.AreEqual ("Type", NSScriptCommandArgumentDescriptionKeys.TypeKey.ToString ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOptionalKey ()
|
||||
{
|
||||
Assert.AreEqual ("Optional", NSScriptCommandArgumentDescriptionKeys.OptionalKey.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class NSScriptCommandArgumentDescriptionTest {
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestConstructorNameNullOrEmpty (string name)
|
||||
{
|
||||
new NSScriptCommandArgumentDescription (name, "eeee", "NSString", false);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestConstructorEventCodeNullOrEmpty (string eventCode)
|
||||
{
|
||||
new NSScriptCommandArgumentDescription ("name", eventCode, "NSString", false);
|
||||
}
|
||||
|
||||
[TestCase ("srf")]
|
||||
[TestCase ("TooLong")]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestConstructorEventCodeWrongLength (string eventCode)
|
||||
{
|
||||
new NSScriptCommandArgumentDescription ("name", eventCode, "NSString", false);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestConstructorTypeNullOrEmpty (string type)
|
||||
{
|
||||
new NSScriptCommandArgumentDescription ("name", "****", type, false);
|
||||
}
|
||||
|
||||
[TestCase ("name", "cdfd", "NSString", true)]
|
||||
[TestCase ("name", "cdfd", "NSNumber", false)]
|
||||
[TestCase ("name", "****", "NSNumber", true)]
|
||||
[TestCase ("otherName", "****", "NSNumber", false)]
|
||||
public void TestDescription (string name, string code, string type, bool isOptional)
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription (name, code, type, isOptional);
|
||||
var description = arg.Dictionary;
|
||||
|
||||
Assert.AreEqual (code, description [new NSString ("AppleEventCode")].ToString ());
|
||||
Assert.AreEqual (type, description [new NSString ("Type")].ToString ());
|
||||
Assert.AreEqual (isOptional? "Yes" : "No", description [ new NSString ("Optional")].ToString ());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,212 @@
|
|||
// Copyright 2015 Xamarin, Inc.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.Foundation {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class NSScriptCommandDescriptionTest {
|
||||
|
||||
NSScriptCommandDescription scriptDescription = null;
|
||||
Dictionary<string, NSScriptCommandArgumentDescription> args;
|
||||
NSScriptCommandDescriptionDictionary dict = null;
|
||||
string suiteName, commandName, cmdClass, eventCode, eventClass, returnType, resultAppleEvent = null;
|
||||
|
||||
[SetUp]
|
||||
public void Init ()
|
||||
{
|
||||
args = new Dictionary<string, NSScriptCommandArgumentDescription> {
|
||||
{"firstArg", new NSScriptCommandArgumentDescription {Name="firstArg", AppleEventCode="fArg", Type="integer", IsOptional=true}},
|
||||
{"secondArg", new NSScriptCommandArgumentDescription {Name="secondArg", AppleEventCode="sArg", Type="NSNumber"}},
|
||||
{"thirdArg", new NSScriptCommandArgumentDescription {Name="thirdArg", AppleEventCode="tArg", Type="integer"}}
|
||||
};
|
||||
|
||||
suiteName = "Chromium Suite";
|
||||
commandName = "Exec Python";
|
||||
cmdClass = "NSScriptCommand";
|
||||
eventCode = "ExPy";
|
||||
eventClass = "CrSu";
|
||||
returnType = "NSString";
|
||||
resultAppleEvent = "text";
|
||||
dict = new NSScriptCommandDescriptionDictionary {
|
||||
CommandClass = cmdClass,
|
||||
AppleEventCode = eventCode,
|
||||
AppleEventClassCode = eventClass,
|
||||
Type = returnType,
|
||||
ResultAppleEventCode = resultAppleEvent
|
||||
};
|
||||
|
||||
foreach(var arg in args.Values) {
|
||||
dict.Add (arg);
|
||||
}
|
||||
scriptDescription = NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Dispose ()
|
||||
{
|
||||
if (scriptDescription != null)
|
||||
scriptDescription.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateWithDictWrongArgDescription ()
|
||||
{
|
||||
var description = new NSScriptCommandDescriptionDictionary ();
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, description);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateWithDictNullOrEmptySuitName (string code)
|
||||
{
|
||||
var description = new NSScriptCommandDescriptionDictionary ();
|
||||
NSScriptCommandDescription.Create (code, commandName, description);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateWithDictNullOrEmptyCommandName (string code)
|
||||
{
|
||||
var description = new NSScriptCommandDescriptionDictionary ();
|
||||
NSScriptCommandDescription.Create (suiteName, code, description);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void TestCreateWithDictNullDict ()
|
||||
{
|
||||
NSScriptCommandDescriptionDictionary dict = null;
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateSuiteNameNullOrEmpty (string code)
|
||||
{
|
||||
NSScriptCommandDescription.Create (code, commandName, dict);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateCommandNameNullOrEmpty (string code)
|
||||
{
|
||||
NSScriptCommandDescription.Create (suiteName, code, dict);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateCmdClassNullOrEmpty (string code)
|
||||
{
|
||||
dict.CommandClass = code;
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[TestCase ("")]
|
||||
[TestCase (null)]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateEventCodeNullOrEmpty (string code)
|
||||
{
|
||||
dict.AppleEventCode = code;
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[TestCase ("TooLong")]
|
||||
[TestCase ("srt")]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateEventCodeWrongLength (string code)
|
||||
{
|
||||
dict.AppleEventCode = code;
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[TestCase ("TooLong")]
|
||||
[TestCase ("srt")]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestCreateResultAppleEventWrongLength (string code)
|
||||
{
|
||||
dict.ResultAppleEventCode = code;
|
||||
NSScriptCommandDescription.Create (suiteName, commandName, dict);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClassName ()
|
||||
{
|
||||
Assert.AreEqual (cmdClass, scriptDescription.ClassName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestName ()
|
||||
{
|
||||
Assert.AreEqual (commandName, scriptDescription.Name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSuiteName ()
|
||||
{
|
||||
Assert.AreEqual (suiteName, scriptDescription.SuitName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestArgumentsNames ()
|
||||
{
|
||||
Assert.AreEqual (args.Keys.Count, scriptDescription.ArgumentNames.Length);
|
||||
foreach (var argName in scriptDescription.ArgumentNames) {
|
||||
Assert.IsTrue (args.Keys.Contains (argName), "Arg {0} is missing", argName);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAppleEventClassCode ()
|
||||
{
|
||||
Assert.AreEqual (eventClass, scriptDescription.AppleEventClassCode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAppleEventCode ()
|
||||
{
|
||||
Assert.AreEqual (eventCode, scriptDescription.AppleEventCode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsOptionalArgument ()
|
||||
{
|
||||
foreach (KeyValuePair<string, NSScriptCommandArgumentDescription> kvp in args) {
|
||||
Assert.AreEqual (kvp.Value.IsOptional, scriptDescription.IsOptionalArgument (kvp.Key),
|
||||
"Wrong apple event code for arg {0}", kvp.Key);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAppleEventCodeForArgument ()
|
||||
{
|
||||
foreach (KeyValuePair<string, NSScriptCommandArgumentDescription> kvp in args) {
|
||||
Assert.AreEqual (kvp.Value.AppleEventCode, scriptDescription.GetAppleEventCodeForArgument (kvp.Key),
|
||||
"Wrong apple event code for arg {0}", kvp.Key);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReturnType ()
|
||||
{
|
||||
Assert.AreEqual (returnType, scriptDescription.ReturnType);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using nuint = System.UInt32;
|
||||
using nint = System.Int32;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
using CGSize = System.Drawing.SizeF;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSStringTests
|
||||
{
|
||||
[Test]
|
||||
public void NSString_LineRangeForRange ()
|
||||
{
|
||||
// Test from http://stackoverflow.com/questions/1085524/how-to-count-the-number-of-lines-in-an-objective-c-string-nsstring
|
||||
NSString input = new NSString("Hey\nHow\nYou\nDoing");
|
||||
int stringLength = (int)input.Length;
|
||||
int numberOfLines = 0;
|
||||
for (int index = 0 ; index < stringLength ; numberOfLines++) {
|
||||
NSRange range = input.LineRangeForRange (new NSRange(index, 0));
|
||||
index = (int)(range.Location + range.Length);
|
||||
}
|
||||
Assert.AreEqual (4, numberOfLines);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSString_GetLineStart ()
|
||||
{
|
||||
NSString input = new NSString("Hey\nHow\nYou\nDoing");
|
||||
nuint start, lineEnd, contentsEnd;
|
||||
input.GetLineStart (out start, out lineEnd, out contentsEnd, new NSRange (5, 11));
|
||||
Assert.AreEqual (4, start);
|
||||
Assert.AreEqual (17, lineEnd);
|
||||
Assert.AreEqual (17, contentsEnd);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSString_BoundingRectWithSize ()
|
||||
{
|
||||
NSString input = new NSString("Hey\nHow\nYou\nDoing");
|
||||
CGRect rect = input.BoundingRectWithSize (new CGSize (20, 30), NSStringDrawingOptions.UsesLineFragmentOrigin | NSStringDrawingOptions.UsesFontLeading, new NSDictionary ());
|
||||
Assert.IsTrue (rect.Width > 0);
|
||||
Assert.IsTrue (rect.Height > 0);
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class NSAttributedStringTests
|
||||
{
|
||||
[Test]
|
||||
public void NSAttributedString_BoundingRectWithSize ()
|
||||
{
|
||||
NSFont font = NSFont.FromFontName ("Arial", 40);
|
||||
NSAttributedString str = new NSAttributedString("Hello World", font);
|
||||
CGRect rect = str.BoundingRectWithSize (new CGSize (20, 30), NSStringDrawingOptions.UsesLineFragmentOrigin | NSStringDrawingOptions.UsesFontLeading);
|
||||
Assert.IsTrue (rect.Width > 0);
|
||||
Assert.IsTrue (rect.Height > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NSAttributedString_GetUrl ()
|
||||
{
|
||||
NSRange range;
|
||||
var str = new NSAttributedString ("Test string with url: http://www.google.com");
|
||||
var url = str.GetUrl (42, out range);
|
||||
|
||||
Assert.IsNotNull (url);
|
||||
Assert.IsTrue (url.AbsoluteString == "http://www.google.com");
|
||||
Assert.IsTrue (range.Location == 22);
|
||||
Assert.IsTrue (range.Length == 21);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.ObjCRuntime;
|
||||
using MonoMac.Foundation;
|
||||
using nint = System.Int32;
|
||||
#else
|
||||
using AppKit;
|
||||
using ObjCRuntime;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class NSThreadTests
|
||||
{
|
||||
[Test]
|
||||
public void NSThread_CallStack_Test()
|
||||
{
|
||||
string [] stack = NSThread.NativeCallStack;
|
||||
Assert.IsNotNull (stack);
|
||||
Assert.IsTrue (stack.Length > 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Unit tests for the assembly itself
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2013 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoMacFixtures {
|
||||
|
||||
[TestFixture]
|
||||
public class AssemblyTest {
|
||||
|
||||
static byte[] pkt = { 0x84, 0xe0, 0x4f, 0xf9, 0xcf, 0xb7, 0x90, 0x65 };
|
||||
|
||||
[Test]
|
||||
public void PublicKeyToken ()
|
||||
{
|
||||
Assert.AreEqual (pkt, typeof (NSObject).Assembly.GetName ().GetPublicKeyToken (), "GetPublicKeyToken");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
//
|
||||
// Unit tests for CBUUID
|
||||
//
|
||||
// Authors:
|
||||
// Aaron Bockover <abock@xamarin.com>
|
||||
//
|
||||
// Copyright 2013 Xamarin, Inc.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using CoreBluetooth;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreBluetooth;
|
||||
#endif
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoMacFixtures.CoreBluetooth
|
||||
{
|
||||
[TestFixture]
|
||||
public class CBUUIDTest
|
||||
{
|
||||
[Test]
|
||||
public void Roundtrip_16bits ()
|
||||
{
|
||||
using (CBUUID uuid = CBUUID.FromString ("1234")) {
|
||||
Assert.That (uuid.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
|
||||
Assert.IsNotNull (uuid.Data, "Data");
|
||||
Assert.That (uuid.Description, Is.EqualTo ("Unknown (<1234>)"), "Description");
|
||||
Assert.That (uuid.ToString (false), Is.EqualTo ("1234"), "ToString(false)");
|
||||
Assert.That (uuid.ToString (true), Is.EqualTo ("00001234-0000-1000-8000-00805f9b34fb"), "ToString(true)");
|
||||
using (CBUUID u2 = CBUUID.FromString (uuid.ToString ())) {
|
||||
Assert.That (u2.ToString (), Is.EqualTo (uuid.ToString ()), "Roundtrip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Roundtrip_128bits ()
|
||||
{
|
||||
using (CBUUID uuid = CBUUID.FromString ("12345678-90AB-CDEF-cafe-c80c20443d0b")) {
|
||||
Assert.That (uuid.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");
|
||||
Assert.IsNotNull (uuid.Data, "Data");
|
||||
Assert.That (uuid.Description, Is.EqualTo ("Unknown (<12345678 90abcdef cafec80c 20443d0b>)"), "Description");
|
||||
Assert.That (uuid.ToString (false), Is.EqualTo (uuid.ToString (true)), "ToString");
|
||||
using (CBUUID u2 = CBUUID.FromString (uuid.ToString ())) {
|
||||
Assert.That (u2.ToString (), Is.EqualTo (uuid.ToString ()), "Roundtrip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static CBUUID MakeFull (byte a, byte b)
|
||||
{
|
||||
return MakeFull (0, 0, a, b);
|
||||
}
|
||||
|
||||
static CBUUID MakeFull (byte a, byte b, byte c, byte d)
|
||||
{
|
||||
return CBUUID.FromBytes (new byte [] {
|
||||
a, b, c, d, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Null ()
|
||||
{
|
||||
Assert.That (null as CBUUID, Is.Null);
|
||||
Assert.That (null as CBUUID, Is.EqualTo (null as CBUUID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FullRandomEquals ()
|
||||
{
|
||||
var guid = Guid.NewGuid ();
|
||||
Assert.That (CBUUID.FromBytes (guid.ToByteArray ()),
|
||||
Is.EqualTo (CBUUID.FromBytes (guid.ToByteArray ())));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FullRandomNotEqual ()
|
||||
{
|
||||
Assert.That (CBUUID.FromBytes (Guid.NewGuid ().ToByteArray ()),
|
||||
Is.Not.EqualTo (CBUUID.FromBytes (Guid.NewGuid ().ToByteArray ())));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PartialEquals ()
|
||||
{
|
||||
var guid = new byte [] { 0xaa, 0xbb };
|
||||
Assert.That (CBUUID.FromBytes (guid),
|
||||
Is.EqualTo (CBUUID.FromBytes (guid)));
|
||||
|
||||
// ObjC exception: Data <aabbccdd> does not represent a valid UUID
|
||||
// guid = new byte [] { 0xaa, 0xbb, 0xcc, 0xdd };
|
||||
// Assert.That (CBUUID.FromBytes (guid),
|
||||
// Is.EqualTo (CBUUID.FromBytes (guid)));
|
||||
|
||||
Assert.That (CBUUID.FromPartial (0x1234),
|
||||
Is.EqualTo (CBUUID.FromPartial (0x1234)));
|
||||
|
||||
Assert.That (CBUUID.FromString ("1234"),
|
||||
Is.EqualTo (CBUUID.FromBytes (new byte [] { 0x12, 0x34 })));
|
||||
|
||||
// ObjC exception: Data <12345678> does not represent a valid UUID
|
||||
// Assert.That (CBUUID.FromString ("12345678"),
|
||||
// Is.EqualTo (CBUUID.FromBytes (new byte [] { 0x12, 0x34, 0x56, 0x78 })));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PartialEqualsFull ()
|
||||
{
|
||||
Assert.That (CBUUID.FromPartial (0x0127), Is.EqualTo (MakeFull (0x01, 0x27)));
|
||||
|
||||
// ObjC exception: Data <abcdef12> does not represent a valid UUID
|
||||
// Assert.That (CBUUID.FromBytes (new byte [] { 0xab, 0xcd, 0xef, 0x12 }),
|
||||
// Is.EqualTo (MakeFull (0xab, 0xcd, 0xef, 0x12)));
|
||||
|
||||
Assert.That (CBUUID.FromString ("1234"),
|
||||
Is.EqualTo (CBUUID.FromString ("00001234-0000-1000-8000-00805f9b34fb")));
|
||||
|
||||
// ObjC exception: Data <12345678> does not represent a valid UUID
|
||||
// Assert.That (CBUUID.FromString ("12345678"),
|
||||
// Is.EqualTo (CBUUID.FromString ("12345678-0000-1000-8000-00805f9b34fb")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PartialsOfDifferentSizeNotEqual ()
|
||||
{
|
||||
// ObjC exception: Data <12345678> does not represent a valid UUID
|
||||
Assert.That (CBUUID.FromPartial (0x1234), Is.Not.EqualTo (
|
||||
CBUUID.FromString ("12345678-0000-1000-8000-00805f9b34fb")));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
|
||||
// Copyright 2015 Xamarin, Inc.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.Foundation {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class NSScriptCommandDescriptionDictionaryTest {
|
||||
[Test]
|
||||
public void TestAddNullArgument ()
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription () { AppleEventCode="frgt", Type="text", Name="Foo"};
|
||||
var desc = new NSScriptCommandDescriptionDictionary ();
|
||||
// no exception should happen
|
||||
desc.Add (arg);
|
||||
using (var argKey = new NSString ("Arguments"))
|
||||
using (var nsName = new NSString (arg.Name)) {
|
||||
Assert.IsTrue (desc.Dictionary.ContainsKey (argKey));
|
||||
var argDict = desc.Dictionary [argKey] as NSDictionary;
|
||||
Assert.IsNotNull (argDict);
|
||||
Assert.IsTrue (argDict.ContainsKey (nsName));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddArgument ()
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription () { AppleEventCode="frgt", Type="text", Name="Foo"};
|
||||
var desc = new NSScriptCommandDescriptionDictionary () {Arguments = new NSMutableDictionary ()};
|
||||
// no exception should happen
|
||||
desc.Add (arg);
|
||||
using (var argKey = new NSString ("Arguments"))
|
||||
using (var nsName = new NSString (arg.Name)) {
|
||||
Assert.IsTrue (desc.Dictionary.ContainsKey (argKey));
|
||||
var argDict = desc.Dictionary [argKey] as NSDictionary;
|
||||
Assert.IsNotNull (argDict);
|
||||
Assert.IsTrue (argDict.ContainsKey (nsName));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRemoveNoArguments ()
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription () { AppleEventCode="frgt", Type="text", Name="Foo"};
|
||||
var desc = new NSScriptCommandDescriptionDictionary ();
|
||||
// no exception should happen
|
||||
Assert.IsFalse (desc.Remove (arg));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRemoveMissingArgument ()
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription () { AppleEventCode="frgt", Type="text", Name="Foo"};
|
||||
var desc = new NSScriptCommandDescriptionDictionary () {Arguments = new NSMutableDictionary ()};
|
||||
// no exception should happen
|
||||
Assert.IsFalse (desc.Remove (arg));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveArgument ()
|
||||
{
|
||||
var arg = new NSScriptCommandArgumentDescription () { AppleEventCode="frgt", Type="text", Name="Foo"};
|
||||
var desc = new NSScriptCommandDescriptionDictionary () {Arguments = new NSMutableDictionary ()};
|
||||
// no exception should happen
|
||||
desc.Add (arg);
|
||||
using (var argKey = new NSString ("Arguments"))
|
||||
using (var nsName = new NSString (arg.Name)) {
|
||||
Assert.IsTrue (desc.Dictionary.ContainsKey (argKey));
|
||||
var argDict = desc.Dictionary [argKey] as NSDictionary;
|
||||
Assert.IsNotNull (argDict);
|
||||
Assert.IsTrue (argDict.ContainsKey (nsName));
|
||||
}
|
||||
desc.Remove (arg);
|
||||
using (var argKey = new NSString ("Arguments"))
|
||||
using (var nsName = new NSString (arg.Name)) {
|
||||
Assert.IsTrue (desc.Dictionary.ContainsKey (argKey));
|
||||
var argDict = desc.Dictionary [argKey] as NSDictionary;
|
||||
Assert.IsNotNull (argDict);
|
||||
Assert.IsFalse (argDict.ContainsKey (nsName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Unit tests for Class
|
||||
//
|
||||
// Authors:
|
||||
// Rolf Bjarne Kvinge <rolf@xamarin.com>
|
||||
//
|
||||
// Copyright 2013 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoMacFixtures.ObjCRuntime {
|
||||
|
||||
[TestFixture]
|
||||
public class ClassTest {
|
||||
[Test]
|
||||
public void ThrowOnMissingNativeClassTest ()
|
||||
{
|
||||
bool saved = Class.ThrowOnInitFailure;
|
||||
|
||||
Class.ThrowOnInitFailure = true;
|
||||
try {
|
||||
new InexistentClass ();
|
||||
Assert.Fail ("a");
|
||||
} catch {
|
||||
// OK
|
||||
} finally {
|
||||
Class.ThrowOnInitFailure = saved;
|
||||
}
|
||||
}
|
||||
|
||||
[Register ("Inexistent", true)]
|
||||
public class InexistentClass : NSObject {
|
||||
public override IntPtr ClassHandle {
|
||||
get {
|
||||
return Class.GetHandle (GetType ().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class Messaging
|
||||
{
|
||||
const string LIBOBJC_DYLIB = "/usr/lib/libobjc.dylib";
|
||||
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static bool bool_objc_msgSend_IntPtr (IntPtr receiver, IntPtr selector, IntPtr p1);
|
||||
|
||||
[DllImport (LIBOBJC_DYLIB, EntryPoint="objc_msgSend")]
|
||||
public extern static void void_objc_msgSend (IntPtr receiver, IntPtr selector);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.SceneKit;
|
||||
#else
|
||||
using Foundation;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNGeometrySourceTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNGeometrySourceSemanticTest ()
|
||||
{
|
||||
Asserts.EnsureMountainLion ();
|
||||
Assert.IsNotNull (SCNGeometrySourceSemantic.Color, "Color");
|
||||
}
|
||||
|
||||
private bool isValidEnumForPlatform (SCNGeometrySourceSemantics value)
|
||||
{
|
||||
if (Asserts.IsAtLeastYosemite)
|
||||
return true;
|
||||
|
||||
switch (value) {
|
||||
case SCNGeometrySourceSemantics.Color:
|
||||
case SCNGeometrySourceSemantics.Normal:
|
||||
case SCNGeometrySourceSemantics.Texcoord:
|
||||
case SCNGeometrySourceSemantics.Vertex:
|
||||
return true;
|
||||
|
||||
case SCNGeometrySourceSemantics.BoneIndices:
|
||||
case SCNGeometrySourceSemantics.BoneWeights:
|
||||
case SCNGeometrySourceSemantics.EdgeCrease:
|
||||
case SCNGeometrySourceSemantics.VertexCrease:
|
||||
default: // this might need updating with 10.11
|
||||
return Asserts.IsAtLeastYosemite;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNGeometrySource_FromDataTest ()
|
||||
{
|
||||
Asserts.EnsureMountainLion ();
|
||||
#pragma warning disable 0219
|
||||
SCNGeometrySource d = SCNGeometrySource.FromData (new NSData (), SCNGeometrySourceSemantic.Color, 1, false, 1, 1, 1, 1);
|
||||
foreach (SCNGeometrySourceSemantics s in Enum.GetValues (typeof (SCNGeometrySourceSemantics))) {
|
||||
if (!isValidEnumForPlatform (s))
|
||||
continue;
|
||||
d = SCNGeometrySource.FromData (new NSData (), s, 1, false, 1, 1, 1, 1);
|
||||
}
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNGeometrySource_BoneStringTests () // These were radar://17782603
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
#pragma warning disable 0219
|
||||
SCNGeometrySource d = SCNGeometrySource.FromData (new NSData (), SCNGeometrySourceSemantic.BoneWeights, 1, false, 1, 1, 1, 1);
|
||||
d = SCNGeometrySource.FromData (new NSData (), SCNGeometrySourceSemantic.BoneIndices, 1, false, 1, 1, 1, 1);
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.SceneKit;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNMaterialTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNMaterial_ShaderModifierTest_Weak ()
|
||||
{
|
||||
if (IntPtr.Size == 8) // API is 64-bit only
|
||||
{
|
||||
SCNMaterial m = new SCNMaterial ();
|
||||
m.WeakShaderModifiers = new NSDictionary ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNMaterial_ShaderModifierTest ()
|
||||
{
|
||||
if (IntPtr.Size == 8) // API is 64-bit only
|
||||
{
|
||||
SCNMaterial m = new SCNMaterial ();
|
||||
m.ShaderModifiers = new SCNShaderModifiers ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.SceneKit;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNNodeTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNNode_AddAnimation ()
|
||||
{
|
||||
SCNNode c = new SCNNode ();
|
||||
CABasicAnimation a = CABasicAnimation.FromKeyPath ("hidden");
|
||||
NSString key = new NSString("MyKey");
|
||||
c.AddAnimation (a, key);
|
||||
CAPropertyAnimation cur = (CAPropertyAnimation)c.GetAnimation (key);
|
||||
Assert.IsNotNull (cur);
|
||||
Assert.AreEqual (cur.KeyPath, "hidden");
|
||||
c.RemoveAnimation (key);
|
||||
cur = (CAPropertyAnimation)c.GetAnimation (key);
|
||||
Assert.IsNull (cur);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNNode_SetPhysicsBodyTest ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
// Create a new empty scene
|
||||
var Scene = new SCNScene ();
|
||||
|
||||
var floorNode = SCNNode.Create ();
|
||||
Scene.RootNode.AddChildNode (floorNode);
|
||||
|
||||
floorNode.PhysicsBody = SCNPhysicsBody.CreateStaticBody ();
|
||||
Scene.PhysicsWorld.Speed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNNode_GeometryNullTest ()
|
||||
{
|
||||
var floorNode = SCNNode.Create ();
|
||||
floorNode.Geometry = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.SceneKit;
|
||||
|
||||
#else
|
||||
using Foundation;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNSceneTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNSceneLoadingOptions_AnimationImportPolicyTest ()
|
||||
{
|
||||
SCNSceneLoadingOptions o = new SCNSceneLoadingOptions ();
|
||||
RoundTrip (o, SCNAnimationImportPolicy.Play);
|
||||
RoundTrip (o, SCNAnimationImportPolicy.PlayRepeatedly);
|
||||
RoundTrip (o, SCNAnimationImportPolicy.DoNotPlay);
|
||||
RoundTrip (o, SCNAnimationImportPolicy.PlayUsingSceneTimeBase);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNSceneLoadingOptions_AnimationImportPolicyTestKeysNonNull ()
|
||||
{
|
||||
Assert.IsNotNull (SCNSceneSourceLoading.AnimationImportPolicyPlay);
|
||||
Assert.IsNotNull (SCNSceneSourceLoading.AnimationImportPolicyPlayRepeatedly);
|
||||
Assert.IsNotNull (SCNSceneSourceLoading.AnimationImportPolicyDoNotPlay);
|
||||
Assert.IsNotNull (SCNSceneSourceLoading.AnimationImportPolicyPlayUsingSceneTimeBase);
|
||||
}
|
||||
|
||||
void RoundTrip (SCNSceneLoadingOptions o, SCNAnimationImportPolicy policy)
|
||||
{
|
||||
o.AnimationImportPolicy = policy;
|
||||
Assert.IsTrue (o.AnimationImportPolicy == policy);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.SceneKit;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNViewTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNView_TechniqueSetterTest ()
|
||||
{
|
||||
SCNView v = new SCNView (new CGRect (), (NSDictionary) null);
|
||||
SCNTechnique t = SCNTechnique.Create (new NSDictionary ());
|
||||
v.Technique = t;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.SceneKit;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SCNWorldTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNNode_BackfaceCulling ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
Assert.IsNotNull (SCNPhysicsTestKeys.BackfaceCullingKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.CoreAnimation;
|
||||
using MonoMac.SceneKit;
|
||||
using CGRect = System.Drawing.RectangleF;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using SceneKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SceneKitTests // Generic one off tests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureYosemite ();
|
||||
if (Asserts.IsAtLeastElCapitan)
|
||||
Asserts.Ensure64Bit ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNGeometrySourceSemantic_ColorKeyTest ()
|
||||
{
|
||||
NSString s = SCNGeometrySourceSemantic.Color;
|
||||
Assert.IsTrue (s != null && s != (NSString)(string.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNPhysicsTestKeys_SearchModeKeyTest ()
|
||||
{
|
||||
NSString s = SCNPhysicsTestKeys.SearchModeKey;
|
||||
Assert.IsTrue (s != null && s != (NSString)(string.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SCNSceneSourceLoading_AnimationImportPolicyKeyTest ()
|
||||
{
|
||||
NSString s = SCNSceneSourceLoading.AnimationImportPolicyKey;
|
||||
Assert.IsTrue (s != null && s != (NSString)(string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using SearchKit;
|
||||
|
||||
namespace apitest {
|
||||
|
||||
[TestFixture]
|
||||
public class SearchKitTests {
|
||||
string path = "/tmp/my.index";
|
||||
|
||||
[SetUp]
|
||||
public void Setup ()
|
||||
{
|
||||
SKIndex.LoadDefaultExtractorPlugIns ();
|
||||
if (File.Exists (path))
|
||||
File.Delete (path);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreate ()
|
||||
{
|
||||
var idx = SKIndex.CreateWithUrl (new NSUrl ("file://" + path), "myIndex", SKIndexType.InvertedVector, null);
|
||||
if (idx == null)
|
||||
throw new Exception ();
|
||||
|
||||
|
||||
var d1 = new SKDocument (new NSUrl ("file:///etc/passwd"));
|
||||
var d2 = new SKDocument (new NSUrl ("file:///etc/fstab"));
|
||||
idx.AddDocument (d1, "text/plain", true);
|
||||
|
||||
idx.AddDocumentWithText (d2, "This file contains some text like an Apple and an Orange", true);
|
||||
|
||||
const int max = 10;
|
||||
nint [] ids = new nint [max];
|
||||
float[] scores = new float[max];
|
||||
nint nfound;
|
||||
bool more;
|
||||
|
||||
using (var search = idx.Search ("some", SKSearchOptions.SpaceMeansOr)) {
|
||||
more = search.FindMatches (max, ref ids, ref scores, 1, out nfound);
|
||||
Assert.IsFalse (more);
|
||||
|
||||
for (nint i = 0; i < nfound; i++) {
|
||||
var doc = idx.GetDocument (ids [i]);
|
||||
Assert.IsNotNull (doc, "TestCreate - GetDocument returned null");
|
||||
}
|
||||
}
|
||||
|
||||
using (var search = idx.Search ("some", SKSearchOptions.SpaceMeansOr)) {
|
||||
more = search.FindMatches (max, ref ids, 1, out nfound);
|
||||
for (nint i = 0; i < nfound; i++) {
|
||||
var doc = idx.GetDocument (ids [i]);
|
||||
Console.WriteLine ("Got {0}", doc);
|
||||
}
|
||||
}
|
||||
|
||||
idx.Compact ();
|
||||
idx.Flush ();
|
||||
idx.Close ();
|
||||
|
||||
// Now open
|
||||
idx = SKIndex.FromUrl (new NSUrl ("file://" + path), "myIndex", true);
|
||||
Assert.NotNull (idx);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInMemory ()
|
||||
{
|
||||
var m = new NSMutableData ();
|
||||
var idx = SKIndex.CreateWithMutableData (m, "indexName", SKIndexType.Inverted, null);
|
||||
Assert.NotNull (idx);
|
||||
idx.AddDocumentWithText (new SKDocument (new NSUrl ("file:///etc/passwd")), "These are the contents of the passwd file, well, not really", true);
|
||||
idx.Flush ();
|
||||
idx.Compact ();
|
||||
idx.Close ();
|
||||
|
||||
idx = SKIndex.FromMutableData (m, "indexName");
|
||||
Assert.NotNull (idx);
|
||||
idx.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTextAnalysis ()
|
||||
{
|
||||
var m = new NSMutableData ();
|
||||
var properties = new SKTextAnalysis () {
|
||||
StartTermChars = "",
|
||||
EndTermChars = "",
|
||||
TermChars = "\"-_@.'",
|
||||
MinTermLength = 3,
|
||||
StopWords = new NSSet ("all", "and", "its", "it's", "the")
|
||||
};
|
||||
|
||||
var idx = SKIndex.CreateWithMutableData (m, "indexName", SKIndexType.Inverted, properties);
|
||||
Assert.NotNull (idx);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSummary ()
|
||||
{
|
||||
var sum = SKSummary.Create (
|
||||
"Once upon a time, there was a dog that loved to take long walks in the park and enjoyed jumping all around (maybe more so on hot days).\n\n" +
|
||||
"One day he ran into a solid rock in the park and was puzzled by it.\n\n" +
|
||||
"If I cook this rock enough, it will be soft and tasty. I might even get lucky and find some salt.");
|
||||
|
||||
Assert.NotNull (sum);
|
||||
var rankOrder = new nint[10];
|
||||
var sentenceIndex = new nint[10];
|
||||
var paragraphIndex = new nint [10];
|
||||
|
||||
nint n;
|
||||
n = sum.GetSentenceSummaryInfo (10, rankOrder, sentenceIndex, paragraphIndex);
|
||||
Assert.AreEqual (4, n);
|
||||
Assert.AreEqual (2, paragraphIndex[3]); // 4th sentence (index 3) is on the 3rd (index 2) paragraph
|
||||
n = sum.GetSentenceSummaryInfo (10, null, sentenceIndex, paragraphIndex);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, rankOrder, null, paragraphIndex);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, rankOrder, sentenceIndex, null);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, null, null, paragraphIndex);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, null, sentenceIndex, null);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, rankOrder, null, null);
|
||||
Assert.AreEqual (4, n);
|
||||
n = sum.GetSentenceSummaryInfo (10, null, null, null);
|
||||
Assert.AreEqual (4, n);
|
||||
|
||||
n = sum.GetParagraphSummaryInfo (10, rankOrder, paragraphIndex);
|
||||
n = sum.GetParagraphSummaryInfo (10, null, paragraphIndex);
|
||||
n = sum.GetParagraphSummaryInfo (10, rankOrder, null);
|
||||
n = sum.GetParagraphSummaryInfo (10, null, null);
|
||||
var sentence = sum.GetSentence (3);
|
||||
Assert.AreEqual ("I might even get lucky and find some salt.", sentence);
|
||||
var par = sum.GetParagraph (1);
|
||||
Assert.AreEqual ("One day he ran into a solid rock in the park and was puzzled by it.\n", par);
|
||||
var ssum = sum.GetSentenceSummary (1);
|
||||
Assert.NotNull (ssum);
|
||||
var psum = sum.GetParagraphSummary (1);
|
||||
Assert.NotNull (psum);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if !XAMCORE_2_0
|
||||
using MonoMac.AppKit;
|
||||
using MonoMac.Foundation;
|
||||
using MonoMac.StoreKit;
|
||||
using nuint = System.UInt32;
|
||||
#else
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using StoreKit;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SKPaymentTests
|
||||
{
|
||||
[Test]
|
||||
public void SKPayment_PaymentWithProduct ()
|
||||
{
|
||||
SKProduct product = new SKProduct();
|
||||
SKPayment payment = SKPayment.PaymentWithProduct (product);
|
||||
Assert.IsNotNull (payment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#if XAMCORE_2_0
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using CoreGraphics;
|
||||
using SpriteKit;
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SKSceneTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp ()
|
||||
{
|
||||
Asserts.EnsureMavericks ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SKScene_InitWithSize ()
|
||||
{
|
||||
if (IntPtr.Size != 8) // SpriteKit is 64-bit only on mac
|
||||
return;
|
||||
|
||||
SKNode c = new SKNode ();
|
||||
//SKScene c = new SKScene (new CGSize (50, 50));
|
||||
Assert.IsNotNull (c);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SKScene_InitWithSizeSuper ()
|
||||
{
|
||||
if (IntPtr.Size != 8) // SpriteKit is 64-bit only on mac
|
||||
return;
|
||||
|
||||
MyScene c = new MyScene (new CGSize (50, 50));
|
||||
Assert.IsNotNull (c);
|
||||
}
|
||||
|
||||
class MyScene : SKScene
|
||||
{
|
||||
public MyScene (CGSize size) : base (size)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
*/*.csproj
|
||||
*/*.sln
|
||||
*.exe
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
#else
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.UIKit;
|
||||
#endif
|
||||
using MonoTouch.NUnit.UI;
|
||||
using NUnit.Framework.Internal.Filters;
|
||||
|
||||
#if !__WATCHOS__
|
||||
|
||||
namespace BCL.Tests
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
UIWindow window;
|
||||
TouchRunner runner;
|
||||
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
|
||||
{
|
||||
// create a new window instance based on the screen size
|
||||
window = new UIWindow (UIScreen.MainScreen.Bounds);
|
||||
runner = new TouchRunner (window);
|
||||
runner.Filter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingInterpreter").Filter);
|
||||
|
||||
// register every tests included in the main application/assembly
|
||||
runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
|
||||
|
||||
window.RootViewController = new UINavigationController (runner.GetViewController ());
|
||||
|
||||
// make the window visible
|
||||
window.MakeKeyAndVisible ();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !__WATCHOS__
|
|
@ -0,0 +1,31 @@
|
|||
<?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>BclTest</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.bcl-test</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>5.1.1</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
#else
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.UIKit;
|
||||
using MonoTouch.ObjCRuntime;
|
||||
#endif
|
||||
|
||||
namespace BCL.Tests
|
||||
{
|
||||
#if !__WATCHOS__
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public class TestRuntime
|
||||
{
|
||||
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
|
||||
static extern IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
|
||||
|
||||
[DllImport ("/usr/lib/system/libdyld.dylib")]
|
||||
static extern int dyld_get_program_sdk_version ();
|
||||
|
||||
public const string BuildVersion_iOS7_DP3 = "11D5134c";
|
||||
public const string BuildVersion_iOS8_Beta1 = "12A4265u";
|
||||
|
||||
public static string GetiOSBuildVersion ()
|
||||
{
|
||||
#if __WATCHOS__
|
||||
throw new Exception ("Can't get iOS build version on watchOS");
|
||||
#else
|
||||
return NSString.FromHandle (IntPtr_objc_msgSend (UIDevice.CurrentDevice.Handle, Selector.GetHandle ("buildVersion")));
|
||||
#endif
|
||||
}
|
||||
|
||||
public static Version GetSDKVersion ()
|
||||
{
|
||||
var v = dyld_get_program_sdk_version ();
|
||||
var major = v >> 16;
|
||||
var minor = (v >> 8) & 0xFF;
|
||||
var build = v & 0xFF;
|
||||
return new Version (major, minor, build);
|
||||
}
|
||||
|
||||
// This method returns true if:
|
||||
// system version >= specified version
|
||||
// AND
|
||||
// sdk version >= specified version
|
||||
public static bool CheckSystemAndSDKVersion (int major, int minor)
|
||||
{
|
||||
#if __WATCHOS__
|
||||
throw new Exception ("Can't get iOS System/SDK version on watchOS");
|
||||
#else
|
||||
if (!UIDevice.CurrentDevice.CheckSystemVersion (major, minor))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Check if the SDK version we're built includes the version we're checking for
|
||||
// We don't want to execute iOS7 tests on an iOS7 device when built with the iOS6 SDK.
|
||||
return CheckSDKVersion (major, minor);
|
||||
}
|
||||
|
||||
public static bool CheckSystemVersion (int major, int minor)
|
||||
{
|
||||
#if __WATCHOS__
|
||||
throw new Exception ("Can't get iOS System/SDK version on watchOS");
|
||||
#else
|
||||
return UIDevice.CurrentDevice.CheckSystemVersion (major, minor);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool CheckSDKVersion (int major, int minor)
|
||||
{
|
||||
#if __WATCHOS__
|
||||
throw new Exception ("Can't get iOS SDK version on watchOS");
|
||||
#else
|
||||
if (Runtime.Arch == Arch.SIMULATOR || !CheckSystemVersion (6, 0)) {
|
||||
// dyld_get_program_sdk_version was introduced with iOS 6.0, so don't do the SDK check on older deviecs.
|
||||
return true; // dyld_get_program_sdk_version doesn't return what we're looking for on the mac.
|
||||
}
|
||||
#endif
|
||||
|
||||
var sdk = GetSDKVersion ();
|
||||
if (sdk.Major > major)
|
||||
return true;
|
||||
if (sdk.Major == major && sdk.Minor >= minor)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
ifneq ($(RELEASE),)
|
||||
CONFIG=Release
|
||||
else
|
||||
CONFIG=Debug
|
||||
endif
|
||||
|
||||
all: build-dev
|
||||
|
||||
build-dev:
|
||||
$(MAKE) -C ../.. build-ios-devunified-$(LIB)
|
||||
|
||||
clean-dev:
|
||||
$(MAKE) -C ../.. clean-ios-devunified-$(LIB)
|
||||
|
||||
install-dev:
|
||||
$(MAKE) -C ../.. install-ios-devunified-$(LIB)
|
||||
|
||||
exec-dev:
|
||||
$(MAKE) -C ../.. exec-ios-devunified-$(LIB)
|
||||
|
||||
debug-dev:
|
||||
fruitstrap debug --bundle bin/iPhone/$(CONFIG)/$(shell echo $(LIB) | sed 's/-//g' | sed 's/\.//g').app --args "-app-arg:-autostart"
|
||||
|
||||
build: build-dev
|
||||
clean: clean-dev
|
||||
install: install-dev
|
||||
exec: exec-dev
|
||||
run: debug-dev
|
||||
|
||||
logdev:
|
||||
$(MAKE) -C ../.. logdev
|
||||
|
||||
build-%:
|
||||
$(MAKE) -C ../.. $@-$(LIB)
|
||||
run-%:
|
||||
$(MAKE) -C ../.. $@-$(LIB)
|
||||
exec-%:
|
||||
$(MAKE) -C ../.. $@-$(LIB)
|
||||
install-%:
|
||||
$(MAKE) -C ../.. $@-$(LIB)
|
||||
clean-%:
|
||||
$(MAKE) -C ../.. $@-$(LIB)
|
|
@ -0,0 +1,30 @@
|
|||
<?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>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>5.1.1</string>
|
||||
<key>UIApplicationExitsOnSuspend</key>
|
||||
<true/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.monodatasqlitetests</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,140 @@
|
|||
<?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)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{1ADF4F27-7610-4501-A62E-1157273AED7E}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>BCL.Tests</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>MonoDataSqliteTests</AssemblyName>
|
||||
<NoWarn>168,169,219,414,612,618,649,672</NoWarn>
|
||||
<TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchDebug>True</MtouchDebug>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>i386</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants>INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>i386</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>True</MtouchDebug>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchI18n>cjk</MtouchI18n>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants>INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<DefineConstants>INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<MtouchI18n>cjk</MtouchI18n>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<DefineConstants>INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<BuildIpa>True</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<DefineConstants>INSIDE_CORLIB;LIBC;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;MONO_DATACONVERTER_STATIC_METHODS;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
<Reference Include="Mono.Data.Sqlite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Main.cs">
|
||||
<Link>Main.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\AppDelegate.cs">
|
||||
<Link>AppDelegate.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
#FILES#
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\..\external\mono\mcs\class\corlib\Test\resources\Resources.es-ES.resx">
|
||||
<Link>Resources\Resources.es-ES.resx</Link>
|
||||
<LogicalName>Resources.es-ES.resources</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\..\..\external\mono\mcs\class\corlib\Test\resources\Resources.nn-NO.resx">
|
||||
<Link>Resources\Resources.nn-NO.resx</Link>
|
||||
<LogicalName>Resources.nn-NO.resources</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\..\..\external\mono\mcs\class\corlib\Test\resources\Resources.resx">
|
||||
<Link>Resources\Resources.resx</Link>
|
||||
<LogicalName>Resources.resources</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,30 @@
|
|||
<?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>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>5.1.1</string>
|
||||
<key>UIApplicationExitsOnSuspend</key>
|
||||
<true/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.monosecuritytests</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
LIB=Mono.Security
|
||||
|
||||
include ../Make.frag
|
|
@ -0,0 +1,126 @@
|
|||
<?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)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{5023D584-1A32-4917-90C5-A641C800230C}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>BCL.Tests</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>MonoSecurityTests</AssemblyName>
|
||||
<NoWarn>67,168,169,219,414,612,618,649,672</NoWarn>
|
||||
<TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchDebug>True</MtouchDebug>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>i386</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>i386</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>True</MtouchDebug>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<BuildIpa>True</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;NET_2_1;MOBILE;MONOTOUCH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Security" />
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Main.cs">
|
||||
<Link>Main.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\AppDelegate.cs">
|
||||
<Link>AppDelegate.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\common\Assert.cs">
|
||||
<Link>Assert.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
#FILES#
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,30 @@
|
|||
<?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>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>5.1.1</string>
|
||||
<key>UIApplicationExitsOnSuspend</key>
|
||||
<true/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.systemcomponentmodeldataannotationstests</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
LIB=System.ComponentModel.DataAnnotations
|
||||
|
||||
include ../Make.frag
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче