diff --git a/Xamarin.iOS.sln b/Xamarin.iOS.sln index f05d35d41f..517d1a8ae7 100644 --- a/Xamarin.iOS.sln +++ b/Xamarin.iOS.sln @@ -27,6 +27,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link", "tests\linker-i EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-generator", "runtime\bindings-generator.csproj", "{6B616492-49F0-43EF-8390-F9D1B4CCC632}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator", "src\generator.csproj", "{5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}" +EndProject +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -480,6 +483,44 @@ Global {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|x86.Build.0 = Debug|x86 {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|x86.ActiveCfg = Release|x86 {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|x86.Build.0 = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|Any CPU.ActiveCfg = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|Any CPU.Build.0 = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.silverlight_Release|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.winphone_Debug|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.winphone_Release|Any CPU.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|iPhoneSimulator.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|iPhoneSimulator.ActiveCfg = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|iPhoneSimulator.Build.0 = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|iPhone.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|iPhone.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|iPhone.ActiveCfg = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|iPhone.Build.0 = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.DebugStaticRegistrar|iPhone.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|x86.ActiveCfg = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Debug|x86.Build.0 = Debug|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|x86.ActiveCfg = Release|x86 + {5FC1B67F-2F54-478D-8C76-2BD21AF8E3C7}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(NestedProjects) = preSolution {208744BD-504E-47D7-9A98-1CF02454A6DA} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} diff --git a/external/Touch.Unit b/external/Touch.Unit index 69a652402a..93ba518006 160000 --- a/external/Touch.Unit +++ b/external/Touch.Unit @@ -1 +1 @@ -Subproject commit 69a652402ad62fcfd2df5a24ea12047f5f09b1cf +Subproject commit 93ba5180067271f29f69c518610506e78d8150a5 diff --git a/mk/xamarin.mk b/mk/xamarin.mk index d18c24d87f..bb93c3b5e6 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -1,5 +1,5 @@ ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := f3cffa4f96b4a765cc9c572dab258632aea0e7a6 +NEEDED_MACCORE_VERSION := adc51e7ee1e8c699cd36e59f431476c26cab3135 NEEDED_MACCORE_BRANCH := xcode8 MACCORE_DIRECTORY := maccore diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ArchiveTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ArchiveTaskBase.cs index 4258959db2..96f50b6780 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ArchiveTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ArchiveTaskBase.cs @@ -14,6 +14,8 @@ namespace Xamarin.iOS.Tasks { public ITaskItem[] AppExtensionReferences { get; set; } + public ITaskItem[] WatchAppReferences { get; set; } + static bool IsWatchAppExtension (ITaskItem appex, PDictionary plist, out string watchAppBundleDir) { PString expectedBundleIdentifier, bundleIdentifier, extensionPoint; @@ -90,6 +92,31 @@ namespace Xamarin.iOS.Tasks } } + void ArchiveWatchApp (ITaskItem watchApp, string archiveDir) + { + var wk = Path.Combine (watchApp.ItemSpec, "_WatchKitStub", "WK"); + var supportDir = Path.Combine (archiveDir, "WatchKitSupport2"); + + if (File.Exists (wk) && !Directory.Exists (supportDir)) { + Directory.CreateDirectory (supportDir); + File.Copy (wk, Path.Combine (supportDir, "WK"), true); + } + + var dsymDir = watchApp.ItemSpec + ".dSYM"; + + if (Directory.Exists (dsymDir)) { + var destDir = Path.Combine (archiveDir, "dSYMs", Path.GetFileName (dsymDir)); + Ditto (dsymDir, destDir); + } + + var msymDir = watchApp.ItemSpec + ".mSYM"; + + if (Directory.Exists (msymDir)) { + var destDir = Path.Combine (archiveDir, "mSYMs", Path.GetFileName (msymDir)); + Ditto (msymDir, destDir); + } + } + void AddIconPaths (PArray icons, PArray iconFiles, string productsDir) { foreach (var icon in iconFiles.Cast ().Where (p => p.Value != null)) { @@ -126,6 +153,7 @@ namespace Xamarin.iOS.Tasks Log.LogTaskProperty ("ProjectName", ProjectName); Log.LogTaskProperty ("SigningKey", SigningKey); Log.LogTaskProperty ("SolutionPath", SolutionPath); + Log.LogTaskProperty ("WatchAppReferences", WatchAppReferences); var archiveDir = CreateArchiveDirectory (); @@ -168,11 +196,17 @@ namespace Xamarin.iOS.Tasks } if (AppExtensionReferences != null) { - // Archive the dSYMs for each of the referenced App Extensions as well... + // Archive the dSYMs, mSYMs, etc for each of the referenced App Extensions as well... for (int i = 0; i < AppExtensionReferences.Length; i++) ArchiveAppExtension (AppExtensionReferences[i], archiveDir); } + if (WatchAppReferences != null) { + // Archive the dSYMs, mSYMs, etc for each of the referenced WatchOS2 Apps as well... + for (int i = 0; i < WatchAppReferences.Length; i++) + ArchiveWatchApp(WatchAppReferences[i], archiveDir); + } + if (ITunesSourceFiles != null) { // Archive the iTunesMetadata.plist and iTunesArtwork files... var iTunesMetadataDir = Path.Combine (archiveDir, "iTunesMetadata", Path.GetFileName (AppBundleDir.ItemSpec)); diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index 7979c9b1d1..8fb3c846d0 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -84,6 +84,15 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. + + + + $(MSBuildThisFileDirectory)Xamarin.iOS.Analysis.targets + + + + + + $(DeviceSpecificOutputPath)$(_AppBundleName) $([System.DateTime]::Now.ToString('yyyy-MM-dd HH-mm-ss')) + + + $(IpaPackageName).ipa $(_AppBundleName).ipa - $(_IpaOutputDir)$(IpaPackageName) + + + $(IpaPackageDir)\$(IpaPackageName) @@ -1767,6 +1782,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. ProjectName="$(MSBuildProjectName)" SolutionPath="$(SolutionPath)" SigningKey="$(_CodeSigningKey)" + WatchAppReferences="@(_ResolvedWatchAppReferences)" > diff --git a/src/Foundation/NSDictionary_2.cs b/src/Foundation/NSDictionary_2.cs index 7e81479436..d25804b0b8 100644 --- a/src/Foundation/NSDictionary_2.cs +++ b/src/Foundation/NSDictionary_2.cs @@ -147,7 +147,28 @@ namespace XamCore.Foundation { return Runtime.GetNSObject> (_FromObjectsAndKeysInternal (objects.Handle, keys.Handle)); } - public static NSDictionary FromObjectsAndKeys (TKey [] objects, TValue [] keys) + public static NSDictionary FromObjectsAndKeys (TValue [] objects, TKey [] keys, nint count) + { + if (objects == null) + throw new ArgumentNullException (nameof (objects)); + if (keys == null) + throw new ArgumentNullException (nameof (keys)); + if (objects.Length != keys.Length) + throw new ArgumentException (nameof (objects) + " and " + nameof (keys) + " arrays have different sizes"); + if (count < 1 || objects.Length < count) + throw new ArgumentException (nameof (count)); + + using (var no = NSArray.FromNativeObjects (objects, count)) + using (var nk = NSArray.FromNativeObjects (keys, count)) + return GenericFromObjectsAndKeysInternal (no, nk); + } + +#if XAMCORE_4_0 + public static NSDictionary FromObjectsAndKeys (TValue [] objects, TKey [] keys) +#else + [Obsolete ("TKey and TValue are inversed and won't work unless both types are identical. Use the generic overload that takes a count parameter instead")] + public static NSDictionary FromObjectsAndKeys (TKey [] objects, TValue [] keys) +#endif { if (objects == null) throw new ArgumentNullException (nameof (objects)); diff --git a/src/Foundation/NSMutableDictionary_2.cs b/src/Foundation/NSMutableDictionary_2.cs index b8ef073239..a8df846f0e 100644 --- a/src/Foundation/NSMutableDictionary_2.cs +++ b/src/Foundation/NSMutableDictionary_2.cs @@ -211,7 +211,28 @@ namespace XamCore.Foundation { return Runtime.GetNSObject> (_FromObjectsAndKeysInternal (objects.Handle, keys.Handle)); } - public static NSMutableDictionary FromObjectsAndKeys (TKey [] objects, TValue [] keys) + public static NSMutableDictionary FromObjectsAndKeys (TValue [] objects, TKey [] keys, nint count) + { + if (objects == null) + throw new ArgumentNullException (nameof (objects)); + if (keys == null) + throw new ArgumentNullException (nameof (keys)); + if (objects.Length != keys.Length) + throw new ArgumentException (nameof (objects) + " and " + nameof (keys) + " arrays have different sizes"); + if (count < 1 || objects.Length < count) + throw new ArgumentException (nameof (count)); + + using (var no = NSArray.FromNSObjects (objects)) + using (var nk = NSArray.FromNSObjects (keys)) + return GenericFromObjectsAndKeysInternal (no, nk); + } + +#if XAMCORE_4_0 + public static NSMutableDictionary FromObjectsAndKeys (TValue [] objects, TKey [] keys) +#else + [Obsolete ("TKey and TValue are inversed and won't work unless both types are identical. Use the generic overload that takes a count parameter instead")] + public static NSMutableDictionary FromObjectsAndKeys (TKey [] objects, TValue [] keys) +#endif { if (objects == null) throw new ArgumentNullException (nameof (objects)); diff --git a/tests/bindings-framework-test/ApiDefinition.cs b/tests/bindings-framework-test/ApiDefinition.cs index 5322a18e83..f51a486920 100644 --- a/tests/bindings-framework-test/ApiDefinition.cs +++ b/tests/bindings-framework-test/ApiDefinition.cs @@ -1,5 +1,4 @@ using System; -using System.Drawing; #if __UNIFIED__ using ObjCRuntime; diff --git a/tests/common/TestRuntime.cs b/tests/common/TestRuntime.cs new file mode 100644 index 0000000000..6dc6230dce --- /dev/null +++ b/tests/common/TestRuntime.cs @@ -0,0 +1,343 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +#if XAMCORE_2_0 +using Foundation; +#if MONOMAC +using AppKit; +#else +using UIKit; +#endif +using ObjCRuntime; +#else +#if MONOMAC +using MonoMac.ObjCRuntime; +using MonoMac.Foundation; +using MonoMac.AppKit; +#else +using MonoTouch.ObjCRuntime; +using MonoTouch.Foundation; +using MonoTouch.UIKit; +#endif +#endif + +partial class TestRuntime +{ + [DllImport ("/usr/lib/system/libdyld.dylib")] + static extern int dyld_get_program_sdk_version (); + + [DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")] + static extern IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector); + + public const string BuildVersion_iOS9_GM = "13A340"; + + public static string GetiOSBuildVersion () + { +#if __WATCHOS__ + throw new Exception ("Can't get iOS Build version on watchOS."); +#elif MONOMAC + throw new Exception ("Can't get iOS Build version on OSX."); +#else + return NSString.FromHandle (IntPtr_objc_msgSend (UIDevice.CurrentDevice.Handle, Selector.GetHandle ("buildVersion"))); +#endif + } + +#if MONOMAC + const int sys1 = 1937339185; + const int sys2 = 1937339186; + const int sys3 = 1937339187; + + // Deprecated in OSX 10.8 - but no good alternative is (yet) available + [System.Runtime.InteropServices.DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + static extern int Gestalt (int selector, out int result); + + static Version version; + + public static Version OSXVersion { + get { + if (version == null) { + int major, minor, build; + Gestalt (sys1, out major); + Gestalt (sys2, out minor); + Gestalt (sys3, out build); + version = new Version (major, minor, build); + } + return version; + } + } +#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); + } + + public static void AssertXcodeVersion (int major, int minor) + { + if (CheckXcodeVersion (major, minor)) + return; + + NUnit.Framework.Assert.Ignore ("Requires the platform version shipped with Xcode {0}.{1}", major, minor); + } + + public static bool CheckXcodeVersion (int major, int minor, int build = 0) + { + switch (major) { + case 7: + switch (minor) { + case 0: +#if __WATCHOS__ + return CheckWatchOSSystemVersion (2, 0); +#elif __TVOS__ + return ChecktvOSSystemVersion (9, 0); +#elif __IOS__ + return CheckiOSSystemVersion (9, 0); +#elif MONOMAC + return CheckMacSystemVersion (10, 11, 0); +#else + throw new NotImplementedException (); +#endif + case 1: +#if __WATCHOS__ + return CheckWatchOSSystemVersion (2, 0); +#elif __TVOS__ + return ChecktvOSSystemVersion (9, 0); +#elif __IOS__ + return CheckiOSSystemVersion (9, 1); +#elif MONOMAC + return CheckMacSystemVersion (10, 11, 0 /* yep */); +#else + throw new NotImplementedException (); +#endif + case 2: +#if __WATCHOS__ + return CheckWatchOSSystemVersion (2, 1); +#elif __TVOS__ + return ChecktvOSSystemVersion (9, 1); +#elif __IOS__ + return CheckiOSSystemVersion (9, 2); +#elif MONOMAC + return CheckMacSystemVersion (10, 11, 2); +#else + throw new NotImplementedException (); +#endif + case 3: +#if __WATCHOS__ + return CheckWatchOSSystemVersion (2, 2); +#elif __TVOS__ + return ChecktvOSSystemVersion (9, 2); +#elif __IOS__ + return CheckiOSSystemVersion (9, 3); +#elif MONOMAC + return CheckMacSystemVersion (10, 11, 4); +#else + throw new NotImplementedException (); +#endif + default: + throw new NotImplementedException (); + } + case 6: +#if __IOS__ + switch (minor) { + case 0: + return CheckiOSSystemVersion (8, 0); + case 1: + return CheckiOSSystemVersion (8, 1); + case 2: + return CheckiOSSystemVersion (8, 2); + case 3: + return CheckiOSSystemVersion (8, 3); + default: + throw new NotImplementedException (); + } +#elif __TVOS__ || __WATCHOS__ + return true; +#elif MONOMAC + switch (minor) { + case 0: + return CheckMacSystemVersion (10, 9, 0); + case 1: + return CheckMacSystemVersion (10, 10, 0); + case 2: + return CheckMacSystemVersion (10, 10, 0); + case 3: + return CheckMacSystemVersion (10, 10, 0); + default: + throw new NotImplementedException (); + } +#else + throw new NotImplementedException (); +#endif + case 5: +#if __IOS__ + switch (minor) { + case 0: + return CheckiOSSystemVersion (7, 0); + case 1: + return CheckiOSSystemVersion (7, 1); + default: + throw new NotImplementedException (); + } +#elif __TVOS__ || __WATCHOS__ + return true; +#elif MONOMAC + switch (minor) { + case 0: + // Xcode 5.0.1 ships OSX 10.9 SDK + return CheckMacSystemVersion (10, build > 0 ? 9 : 8, 0); + case 1: + return CheckMacSystemVersion (10, 9, 0); + default: + throw new NotImplementedException (); + } +#else + throw new NotImplementedException (); +#endif + case 4: +#if __IOS__ + switch (minor) { + case 5: + return CheckiOSSystemVersion (6, 0); + case 6: + return CheckiOSSystemVersion (6, 1); + default: + throw new NotImplementedException (); + } +#elif __TVOS__ || __WATCHOS__ + return true; +#elif MONOMAC + switch (minor) { + case 5: + case 6: + return CheckMacSystemVersion (10, 8, 0); + default: + throw new NotImplementedException (); + } +#else + throw new NotImplementedException (); +#endif + default: + throw new NotImplementedException (); + } + } + + // This method returns true if: + // system version >= specified version + // AND + // sdk version >= specified version + public static bool CheckiOSSystemVersion (int major, int minor, bool throwIfOtherPlatform = true) + { +#if __IOS__ + return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); +#else + if (throwIfOtherPlatform) + throw new Exception ("Can't get iOS System version on other platforms."); + return true; +#endif + } + + // This method returns true if: + // system version >= specified version + // AND + // sdk version >= specified version + public static bool ChecktvOSSystemVersion (int major, int minor, bool throwIfOtherPlatform = true) + { +#if __TVOS__ + return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); +#else + if (throwIfOtherPlatform) + throw new Exception ("Can't get tvOS System version on other platforms."); + return true; +#endif + } + + // This method returns true if: + // system version >= specified version + // AND + // sdk version >= specified version + public static bool CheckWatchOSSystemVersion (int major, int minor, bool throwIfOtherPlatform = true) + { +#if __WATCHOS__ + return WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion (major, minor); +#else + if (throwIfOtherPlatform) + throw new Exception ("Can't get watchOS System version on iOS/tvOS."); + // This is both iOS and tvOS + return true; +#endif + } + + public static bool CheckMacSystemVersion (int major, int minor, int build = 0, bool throwIfOtherPlatform = true) + { +#if MONOMAC + return OSXVersion >= new Version (major, minor, build); +#else + if (throwIfOtherPlatform) + throw new Exception ("Can't get iOS System version on other platforms."); + return true; +#endif + } + + // 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."); +#elif MONOMAC + if (OSXVersion < new Version (major, minor)) + return false; +#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 CheckSDKVersion (int major, int minor) + { +#if __WATCHOS__ + throw new Exception ("Can't get iOS SDK version on WatchOS."); +#elif !MONOMAC + if (Runtime.Arch == Arch.SIMULATOR || !UIDevice.CurrentDevice.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; + } + + public static void IgnoreOnTVOS () + { +#if __TVOS__ + NUnit.Framework.Assert.Ignore ("This test is disabled on TVOS."); +#endif + } + + public static bool IsTVOS { + get { +#if __TVOS__ + return true; +#else + return false; +#endif + } + } +} diff --git a/tests/introspection/ApiBaseTest.cs b/tests/introspection/ApiBaseTest.cs index da6f2d2dfa..0d980e28a5 100644 --- a/tests/introspection/ApiBaseTest.cs +++ b/tests/introspection/ApiBaseTest.cs @@ -223,55 +223,5 @@ namespace Introspection { return Path.Combine (prefix, libname + ".framework", libname); } - - protected bool IsOSX11OrIOS9 { - get { -#if MONOMAC - return Mac.IsElCapitanOrHigher; -#elif __WATCHOS__ - return false; -#else - return UIDevice.CurrentDevice.CheckSystemVersion (9, 0); -#endif - } - } - - protected bool CheckiOSSystemVersion (int major, int minor) - { -#if __IOS__ - return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); -#else - throw new InvalidOperationException ("Can only check iOS system version on iOS."); -#endif - } - - // This only works for API introduced in the same numeric version in both iOS and tvOS. - protected bool CheckiOSOrTVOSSystemVersion (int major, int minor) - { -#if __IOS__ || __TVOS__ - return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); -#else - throw new InvalidOperationException ("Can only check iOS or tvOS system version on iOS or tvOS."); -#endif - } - - protected bool CheckWatchOSSystemVersion (int major, int minor) - { -#if __WATCHOS__ - throw new NotImplementedException (); -// return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); -#else - throw new InvalidOperationException ("Can only check watchOS system version on watchOS."); -#endif - } - - protected bool CheckTVOSSystemVersion (int major, int minor) - { -#if __TVOS__ - return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); -#else - throw new InvalidOperationException ("Can only check tvOS system version on tvOS."); -#endif - } } } diff --git a/tests/introspection/ApiSignatureTest.cs b/tests/introspection/ApiSignatureTest.cs index 2528023438..54c031034b 100644 --- a/tests/introspection/ApiSignatureTest.cs +++ b/tests/introspection/ApiSignatureTest.cs @@ -140,7 +140,7 @@ namespace Introspection { case "EKSpan": case "EKRecurrenceFrequency": case "EKEventAvailability": - if (!IsOSX11OrIOS9) + if (!TestRuntime.CheckXcodeVersion (7, 0)) return 4; break; case "MDLAxisAlignedBoundingBox": @@ -230,6 +230,11 @@ namespace Introspection { if (exportAttribute == null) continue; string name = exportAttribute.Selector; + + if (exportAttribute.IsVariadic) { + VariadicChecks (m); + continue; + } if (Skip (t, m, name)) continue; @@ -245,6 +250,13 @@ namespace Introspection { } } + void VariadicChecks (MethodBase m) + { + if (m.IsPublic || m.IsFamily || m.IsFamilyOrAssembly) { + AddErrorLine ("Function '{0}.{1}' is exposed and variadic. Variadic methods need custom marshaling, and must not be exposed directly.", m.DeclaringType.FullName, m.Name); + } + } + void BasicChecks (MethodBase m, Type t, ref int n) { int native = 0; @@ -670,7 +682,7 @@ namespace Introspection { case "EventKit.EKSpan": case "EventKit.EKAlarmType": // EventKit.EK* enums are anonymous enums in 10.10 and iOS 8, but an NSInteger in 10.11 and iOS 9. - if (IsOSX11OrIOS9) + if (TestRuntime.CheckXcodeVersion (7, 0)) goto default; return true; default: diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj index 245eea11b0..72d3cf71ff 100644 --- a/tests/introspection/Mac/introspection-mac.csproj +++ b/tests/introspection/Mac/introspection-mac.csproj @@ -113,6 +113,9 @@ Mac.cs + + TestRuntime.cs + diff --git a/tests/introspection/iOS/iOSApiCtorInitTest.cs b/tests/introspection/iOS/iOSApiCtorInitTest.cs index da9e779eb8..f6f10c6ff8 100644 --- a/tests/introspection/iOS/iOSApiCtorInitTest.cs +++ b/tests/introspection/iOS/iOSApiCtorInitTest.cs @@ -58,7 +58,7 @@ namespace Introspection { case "Metal": case "MonoTouch.Metal": // they works with iOS9 beta 4 (but won't work on older simulators) - if ((Runtime.Arch == Arch.SIMULATOR) && !CheckiOSOrTVOSSystemVersion (9,0)) + if ((Runtime.Arch == Arch.SIMULATOR) && !TestRuntime.CheckXcodeVersion (7, 0)) return true; break; #if !__WATCHOS__ @@ -69,7 +69,7 @@ namespace Introspection { if (Runtime.Arch == Arch.SIMULATOR) return true; // some devices don't support metal and that crash some API that does not check that, e.g. #33153 - if (!CheckiOSOrTVOSSystemVersion (9,0) || (MTLDevice.SystemDefault == null)) + if (!TestRuntime.CheckXcodeVersion (7, 0) || (MTLDevice.SystemDefault == null)) return true; break; #endif // !__WATCHOS__ @@ -125,7 +125,7 @@ namespace Introspection { // technically available since 4.1 - however it got a new base class in 6.0 // and that new base class GKGameCenterViewController did not exists before 6.0 // which makes the type unusable in 5.x, ref: https://gist.github.com/spouliot/271b6230a3aa2b58bc6e - return !CheckiOSSystemVersion (6,0); + return !TestRuntime.CheckXcodeVersion (4, 5); // mistake - we should not have exposed those default ctor and now we must live with them case "GCControllerElement": @@ -160,7 +160,7 @@ namespace Introspection { // Started with iOS8 on simulator (always) but it looks like it can happen on devices too // NSInvalidArgumentException Use initWithAccessibilityContainer: case "UIAccessibilityElement": - return CheckiOSSystemVersion (8,0); + return TestRuntime.CheckXcodeVersion (6, 0); #endif // in 8.2 beta 1 this crash the app (simulator) without giving any details in the logs case "WKUserNotificationInterfaceController": @@ -251,7 +251,7 @@ namespace Introspection { return; // iOS9 - the instance was "kind of valid" before case "PKPaymentAuthorizationViewController": - if (CheckiOSSystemVersion (9,0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return; break; } @@ -280,14 +280,14 @@ namespace Introspection { case "AVAssetResourceLoadingRequest": case "GKScoreChallenge": // Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[GKScoreChallenge challengeID]: unrecognized selector sent to instance 0x18acc340 case "GKAchievementChallenge": // Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[GKAchievementChallenge challengeID]: unrecognized selector sent to instance 0x160f4840 - if (CheckiOSOrTVOSSystemVersion (6,0)) + if (TestRuntime.CheckXcodeVersion (4, 5)) return; break; // iOS 9 beta 1 - crash when called case "WKFrameInfo": case "WKNavigation": case "WKNavigationAction": - if (CheckiOSSystemVersion (9,0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return; break; // new iOS 10 beta 1 - crash when calling `description` selector @@ -310,7 +310,7 @@ namespace Introspection { switch (obj.GetType ().Name) { case "NSString": // according to bots `isKindOf (null)` returns true before iOS 8, ref: #36726 - if (!CheckiOSOrTVOSSystemVersion (8, 0)) + if (!TestRuntime.CheckXcodeVersion (6, 0)) return; break; } diff --git a/tests/introspection/iOS/iOSApiFieldTest.cs b/tests/introspection/iOS/iOSApiFieldTest.cs index cd9eb9183e..e09f94045e 100644 --- a/tests/introspection/iOS/iOSApiFieldTest.cs +++ b/tests/introspection/iOS/iOSApiFieldTest.cs @@ -46,7 +46,7 @@ namespace Introspection { case "Metal": case "MonoTouch.Metal": // they works with iOS9 beta 4 (but won't work on older simulators) - if ((Runtime.Arch == Arch.SIMULATOR) && !CheckiOSSystemVersion (9,0)) + if ((Runtime.Arch == Arch.SIMULATOR) && !TestRuntime.CheckXcodeVersion (7, 0)) return true; break; case "MetalKit": @@ -83,13 +83,13 @@ namespace Introspection { case "ExifLensMake": case "ExifLensModel": case "ExifLensSerialNumber": - return !CheckiOSOrTVOSSystemVersion (6,1); + return !TestRuntime.CheckXcodeVersion (4, 6); // ImageIO: new in iOS 8 but returns nil (at least in beta 1) seems fixed in iOS9 case "PNGLoopCount": case "PNGDelayTime": case "PNGUnclampedDelayTime": - return !CheckiOSOrTVOSSystemVersion (9,0); + return !TestRuntime.CheckXcodeVersion (7, 0); // CoreServices.CFHTTPMessage - document in 10.9 but returns null case "_AuthenticationSchemeOAuth1": diff --git a/tests/introspection/iOS/iOSApiProtocolTest.cs b/tests/introspection/iOS/iOSApiProtocolTest.cs index b79280cea4..7b0aec4dbf 100644 --- a/tests/introspection/iOS/iOSApiProtocolTest.cs +++ b/tests/introspection/iOS/iOSApiProtocolTest.cs @@ -57,7 +57,7 @@ namespace Introspection { return true; // Requires iOS 8.2 or later in 32-bit mode - if (!CheckiOSSystemVersion (8, 2) && IntPtr.Size == 4) + if (!TestRuntime.CheckXcodeVersion (6, 2) && IntPtr.Size == 4) return true; break; @@ -75,7 +75,7 @@ namespace Introspection { case "MonoTouch.CoreAudioKit": case "CoreAudioKit": // they works with iOS9 beta 4 (but won't work on older simulators) - if ((Runtime.Arch == Arch.SIMULATOR) && !CheckiOSOrTVOSSystemVersion (9,0)) + if ((Runtime.Arch == Arch.SIMULATOR) && !TestRuntime.CheckXcodeVersion (7, 0)) return true; break; @@ -117,7 +117,7 @@ namespace Introspection { case "GKLocalPlayer": // NSSecureCoding is still undocumented, for iOS, and neither is NSCoding for OSX // and it did not respond before 6.0 (when NSSecureCoding was introduced) - return !CheckiOSOrTVOSSystemVersion (6,0); + return !TestRuntime.CheckXcodeVersion (4, 5); case "UITableViewDataSource": // this is a *protocol( and we do not want to force people to conform to (an // undocumented "requirement") NSCoding - as ObjC do not have to do this @@ -168,6 +168,42 @@ namespace Introspection { case "VSAccountMetadata": case "VSAccountMetadataRequest": return true; +#if __WATCHOS__ + case "CLKComplicationTemplate": + case "CLKComplicationTemplateCircularSmallRingImage": + case "CLKComplicationTemplateCircularSmallRingText": + case "CLKComplicationTemplateCircularSmallSimpleImage": + case "CLKComplicationTemplateCircularSmallSimpleText": + case "CLKComplicationTemplateCircularSmallStackImage": + case "CLKComplicationTemplateCircularSmallStackText": + case "CLKComplicationTemplateModularLargeColumns": + case "CLKComplicationTemplateModularLargeStandardBody": + case "CLKComplicationTemplateModularLargeTable": + case "CLKComplicationTemplateModularLargeTallBody": + case "CLKComplicationTemplateModularSmallColumnsText": + case "CLKComplicationTemplateModularSmallRingImage": + case "CLKComplicationTemplateModularSmallRingText": + case "CLKComplication": + case "CLKComplicationTemplateModularSmallSimpleImage": + case "CLKTextProvider": + case "CLKComplicationTemplateModularSmallSimpleText": + case "CLKTimeIntervalTextProvider": + case "CLKComplicationTemplateModularSmallStackImage": + case "CLKTimeTextProvider": + case "CLKComplicationTemplateModularSmallStackText": + case "CLKComplicationTemplateUtilitarianLargeFlat": + case "CLKComplicationTemplateUtilitarianSmallFlat": + case "CLKComplicationTemplateUtilitarianSmallRingImage": + case "CLKComplicationTemplateUtilitarianSmallRingText": + case "CLKComplicationTemplateUtilitarianSmallSquare": + case "CLKComplicationTimelineEntry": + case "CLKDateTextProvider": + case "CLKImageProvider": + case "CLKRelativeDateTextProvider": + case "CLKSimpleTextProvider": + case "WKAlertAction": + return true; +#endif } break; case "NSSecureCoding": @@ -220,6 +256,42 @@ namespace Introspection { case "VSAccountMetadata": case "VSAccountMetadataRequest": return true; +#if __WATCHOS__ + case "CLKComplicationTemplate": + case "CLKComplicationTemplateCircularSmallRingImage": + case "CLKComplicationTemplateCircularSmallRingText": + case "CLKComplicationTemplateCircularSmallSimpleImage": + case "CLKComplicationTemplateCircularSmallSimpleText": + case "CLKComplicationTemplateCircularSmallStackImage": + case "CLKComplicationTemplateCircularSmallStackText": + case "CLKComplicationTemplateModularLargeColumns": + case "CLKComplicationTemplateModularLargeStandardBody": + case "CLKComplicationTemplateModularLargeTable": + case "CLKComplicationTemplateModularLargeTallBody": + case "CLKComplicationTemplateModularSmallColumnsText": + case "CLKComplicationTemplateModularSmallRingImage": + case "CLKComplicationTemplateModularSmallRingText": + case "CLKComplicationTemplateModularSmallSimpleImage": + case "CLKComplicationTemplateModularSmallSimpleText": + case "CLKComplicationTemplateModularSmallStackImage": + case "CLKComplicationTemplateModularSmallStackText": + case "CLKComplicationTemplateUtilitarianLargeFlat": + case "CLKComplicationTemplateUtilitarianSmallFlat": + case "CLKComplicationTemplateUtilitarianSmallRingImage": + case "CLKComplicationTemplateUtilitarianSmallRingText": + case "CLKComplicationTemplateUtilitarianSmallSquare": + case "CLKComplicationTimelineEntry": + case "CLKDateTextProvider": + case "CLKImageProvider": + case "CLKRelativeDateTextProvider": + case "CLKSimpleTextProvider": + case "CLKTextProvider": + case "CLKTimeIntervalTextProvider": + case "CLKTimeTextProvider": + case "CLKComplication": + case "WKAlertAction": + return true; +#endif } break; case "NSCopying": @@ -250,6 +322,10 @@ namespace Introspection { case "VSAccountMetadata": case "VSAccountMetadataRequest": return true; +#if __WATCHOS__ + case "CLKComplicationTimelineEntry": + return true; +#endif } break; case "UIAccessibilityIdentification": @@ -272,7 +348,7 @@ namespace Introspection { break; case "UITextInputTraits": // UISearchBar conformance fails before 7.1 - reference bug #33333 - if ((type.Name == "UISearchBar") && !CheckiOSOrTVOSSystemVersion (7,1)) + if ((type.Name == "UISearchBar") && !TestRuntime.CheckXcodeVersion (5, 1)) return true; break; #if !XAMCORE_3_0 @@ -286,7 +362,7 @@ namespace Introspection { case "GKSavedGameListener": switch (type.Name) { case "GKLocalPlayerListener": // 37180 - return !CheckiOSOrTVOSSystemVersion (8, 0); + return !TestRuntime.CheckXcodeVersion (6, 0); } break; } @@ -296,8 +372,7 @@ namespace Introspection { [Test] public override void SecureCoding () { - if (!CheckiOSOrTVOSSystemVersion (6,0)) - Assert.Inconclusive ("Requires iOS 6+"); + TestRuntime.AssertXcodeVersion (4, 5); base.SecureCoding (); } @@ -305,8 +380,7 @@ namespace Introspection { [Test] public override void SupportsSecureCoding () { - if (!CheckiOSOrTVOSSystemVersion (6,0)) - Assert.Inconclusive ("Requires iOS 6+"); + TestRuntime.AssertXcodeVersion (4, 5); base.SupportsSecureCoding (); } diff --git a/tests/introspection/iOS/iOSApiSelectorTest.cs b/tests/introspection/iOS/iOSApiSelectorTest.cs index b7c5736426..b098bc3f53 100644 --- a/tests/introspection/iOS/iOSApiSelectorTest.cs +++ b/tests/introspection/iOS/iOSApiSelectorTest.cs @@ -51,7 +51,7 @@ namespace Introspection { case "Metal": case "MonoTouch.Metal": // they works with iOS9 beta 4 (but won't work on older simulators) - if ((Runtime.Arch == Arch.SIMULATOR) && !CheckiOSOrTVOSSystemVersion (9,0)) + if ((Runtime.Arch == Arch.SIMULATOR) && !TestRuntime.CheckXcodeVersion (7, 0)) return true; break; case "MetalKit": @@ -110,7 +110,7 @@ namespace Introspection { case "setSessionDescription:": case "delegate": // does not respond anymore but the properties works (see monotouch-test) - if (CheckiOSOrTVOSSystemVersion (9, 0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return true; break; } @@ -130,7 +130,7 @@ namespace Introspection { case "setTaskDescription:": case "taskIdentifier": // does not respond anymore but the properties works (see monotouch-test) - if (CheckiOSOrTVOSSystemVersion (9, 0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return true; break; } @@ -138,7 +138,7 @@ namespace Introspection { case "NSUrlSessionConfiguration": case "NSUrlSessionStreamTask": // does not respond anymore but the properties works (see monotouch-test for a partial list) - if (CheckiOSOrTVOSSystemVersion (9, 0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return true; break; @@ -147,7 +147,7 @@ namespace Introspection { case "currentRequest": case "originalRequest": case "response": - if (CheckiOSOrTVOSSystemVersion (9, 0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) return true; break; } @@ -159,7 +159,7 @@ namespace Introspection { // https://trello.com/c/pKLOLjVJ/29-24231250-coremotion-api-removal-without-deprecation case "accelerometerDataFromDate:toDate:": case "recordAccelerometerForDuration:": - if (!CheckiOSOrTVOSSystemVersion (9, 3)) + if (!TestRuntime.CheckXcodeVersion (7, 3)) return true; break; } @@ -223,7 +223,7 @@ namespace Introspection { // UITextInputTraits and UITextInputProtocol if (declaredType.Name == "UITextField" || declaredType.Name == "UITextView") return true; - if (CheckiOSOrTVOSSystemVersion (7,1) && declaredType.Name == "UISearchBar") + if (TestRuntime.CheckXcodeVersion (5, 1) && declaredType.Name == "UISearchBar") return true; break; case "keyboardAppearance": @@ -250,7 +250,7 @@ namespace Introspection { if (declaredType.Name == "UITextField" || declaredType.Name == "UITextView") return true; // ignore UISearchBar before iOS8 - it did not really implement UITextInput - if (declaredType.Name == "UISearchBar" && !CheckiOSSystemVersion (8,0)) + if (declaredType.Name == "UISearchBar" && !TestRuntime.CheckXcodeVersion (6, 0)) return true; break; case "dictationRecognitionFailed": @@ -293,16 +293,16 @@ namespace Introspection { case "useApplicationAudioSession": case "setUseApplicationAudioSession:": if (declaredType.Name == "MPMoviePlayerController") - return CheckiOSSystemVersion (6,0); + return TestRuntime.CheckXcodeVersion (4, 5); break; // iOS6 - headers says readwrite but they do not respond case "setUUID:": case "setIsPrimary:": if (declaredType.Name == "CBMutableService") - return CheckiOSSystemVersion (6, 0); + return TestRuntime.CheckXcodeVersion (4, 5); if (declaredType.Name == "CBMutableCharacteristic") - return CheckiOSSystemVersion (9, 0); + return TestRuntime.CheckXcodeVersion (7, 0); break; // documented since 4.0 - but does not answer on an iPad1 with 5.1.1 @@ -405,7 +405,7 @@ namespace Introspection { case "scrollViewWillBeginZooming:withView:": case "scrollViewWillEndDragging:withVelocity:targetContentOffset:": if (declaredType.Name == "UICollectionViewController") - return CheckiOSOrTVOSSystemVersion (6,0); + return TestRuntime.CheckXcodeVersion (4, 5); break; // failing (check why) @@ -414,7 +414,7 @@ namespace Introspection { case "finalLayoutAttributesForDeletedItemAtIndexPath:": case "finalLayoutAttributesForDeletedSupplementaryElementOfKind:atIndexPath:": if (declaredType.Name == "UICollectionViewLayout") - return CheckiOSSystemVersion (6,0); + return TestRuntime.CheckXcodeVersion (4, 5); break; // This is implemented by internal concrete classes of NSFileHandle @@ -499,25 +499,25 @@ namespace Introspection { switch (declaredType.Name) { // not conforming to NSCopying in 5.1 SDK case "UIFont": - return !CheckiOSSystemVersion (6,0); + return !TestRuntime.CheckXcodeVersion (4, 5); // not conforming to NSCopying before 7.0 SDK case "CBPeripheral": - return !CheckiOSSystemVersion (7,0); + return !TestRuntime.CheckXcodeVersion (5, 0); // not conforming to NSCopying before 8.0 SDK case "AVMetadataFaceObject": - return !CheckiOSSystemVersion (8,0); + return !TestRuntime.CheckXcodeVersion (6, 0); // not conforming to NSCopying before 8.2 SDK case "HKUnit": - return !CheckiOSSystemVersion (8,2); + return !TestRuntime.CheckXcodeVersion (6, 2); case "HKBiologicalSexObject": case "HKBloodTypeObject": - return !CheckiOSSystemVersion (9,0); + return !TestRuntime.CheckXcodeVersion (7, 0); } break; // on iOS8.0 this does not work on the simulator (but works on devices) case "language": - if (declaredType.Name == "AVSpeechSynthesisVoice" && CheckiOSSystemVersion (8,0) && Runtime.Arch == Arch.SIMULATOR) + if (declaredType.Name == "AVSpeechSynthesisVoice" && TestRuntime.CheckXcodeVersion (6, 0) && Runtime.Arch == Arch.SIMULATOR) return true; break; @@ -553,11 +553,11 @@ namespace Introspection { switch (declaredType.Name) { // UITextInputMode was added in 4.2 but conformed to NSSecureCoding only from 7.0+ case "UITextInputMode": - return !CheckiOSSystemVersion (7,0); + return !TestRuntime.CheckXcodeVersion (5, 0); // iOS9 case "HKBiologicalSexObject": case "HKBloodTypeObject": - return !CheckiOSSystemVersion (9,0); + return !TestRuntime.CheckXcodeVersion (7, 0); } break; #else @@ -565,7 +565,7 @@ namespace Introspection { // we'll ignore them for compat - but won't provide them in the new assemblies case "backgroundImageForBarMetrics:": case "setBackgroundImage:forBarMetrics:": - if (declaredType.Name == "UISearchBar" && CheckiOSSystemVersion (8,0)) + if (declaredType.Name == "UISearchBar" && TestRuntime.CheckXcodeVersion (6, 0)) return true; break; #endif diff --git a/tests/introspection/iOS/iOSApiSignatureTest.cs b/tests/introspection/iOS/iOSApiSignatureTest.cs index d552c8baab..c805bb3ca1 100644 --- a/tests/introspection/iOS/iOSApiSignatureTest.cs +++ b/tests/introspection/iOS/iOSApiSignatureTest.cs @@ -42,7 +42,7 @@ namespace Introspection { // EventKit.EK* enums are anonymous enums in 10.10 and iOS 8, but an NSInteger in 10.11 and iOS 9. case "EKCalendarChooserSelectionStyle": case "EKCalendarChooserDisplayStyle": - if (!IsOSX11OrIOS9) + if (!TestRuntime.CheckXcodeVersion (7, 0)) return 4; break; } @@ -64,7 +64,7 @@ namespace Introspection { // (they used to return `bool`) case "beginAppearanceTransition:animated:": case "endAppearanceTransition": - if (!CheckiOSOrTVOSSystemVersion (6,0)) + if (!TestRuntime.CheckXcodeVersion (4, 5)) return true; break; } @@ -74,12 +74,12 @@ namespace Introspection { // sadly, and even with a bug report with a few exchanges, this was not fixed before iOS8 GM :-( // 64bits application for iOS 7.x will be uncommon so we prefer to be forward compatible if (selector == "status") - return !CheckiOSSystemVersion (8,0); + return !TestRuntime.CheckXcodeVersion (6, 0); break; case "CMMotionManager": // iOS 8.3 changed CMMotionManager from 4 to 8 bytes on 64bits CPU and we have to follow that breaking // change unless Apple revert that before final. [radar 20295259] - if ((IntPtr.Size == 4) || CheckiOSSystemVersion (8,3)) + if ((IntPtr.Size == 4) || TestRuntime.CheckXcodeVersion (6, 3)) return false; // which means iOS 8.2 (and earlier can't match) switch (selector) { @@ -140,7 +140,7 @@ namespace Introspection { case "MonoTouch.EventKitUI.EKCalendarChooserDisplayStyle": case "EventKitUI.EKCalendarChooserSelectionStyle": case "EventKitUI.EKCalendarChooserDisplayStyle": - return (IntPtr.Size == 4) || !IsOSX11OrIOS9; + return (IntPtr.Size == 4) || !TestRuntime.CheckXcodeVersion (7, 0); case "System.UInt32": // numberOfTouchesRequired was signed before iOS6, unsigned since then return true; diff --git a/tests/introspection/iOS/iOSApiTypoTest.cs b/tests/introspection/iOS/iOSApiTypoTest.cs index c4377e53e4..4fa3a1ba6f 100644 --- a/tests/introspection/iOS/iOSApiTypoTest.cs +++ b/tests/introspection/iOS/iOSApiTypoTest.cs @@ -24,7 +24,7 @@ namespace Introspection { public void SetUp () { #if __WATCHOS__ - Assert.Fail ("Need to find alternative for UITextChecker on WatchOS."); + Assert.Ignore ("Need to find alternative for UITextChecker on WatchOS."); #else // that's slow and there's no value to run it on devices as the API names // being verified won't change from the simulator diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj index 05d52ce049..c56e177b62 100644 --- a/tests/introspection/iOS/introspection-ios.csproj +++ b/tests/introspection/iOS/introspection-ios.csproj @@ -159,6 +159,9 @@ PlatformInfo.cs + + TestRuntime.cs + diff --git a/tests/monotouch-test/Contacts/ContactFetchRequestTest.cs b/tests/monotouch-test/Contacts/ContactFetchRequestTest.cs index 0aa06824d8..de8bd320dd 100644 --- a/tests/monotouch-test/Contacts/ContactFetchRequestTest.cs +++ b/tests/monotouch-test/Contacts/ContactFetchRequestTest.cs @@ -33,8 +33,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/Contacts/ContactFormatterTest.cs b/tests/monotouch-test/Contacts/ContactFormatterTest.cs index 45beaa6f99..a75b34c915 100644 --- a/tests/monotouch-test/Contacts/ContactFormatterTest.cs +++ b/tests/monotouch-test/Contacts/ContactFormatterTest.cs @@ -33,8 +33,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/Contacts/ContactStoreTest.cs b/tests/monotouch-test/Contacts/ContactStoreTest.cs index 81a960ab48..8da3dbeb38 100644 --- a/tests/monotouch-test/Contacts/ContactStoreTest.cs +++ b/tests/monotouch-test/Contacts/ContactStoreTest.cs @@ -32,8 +32,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/Contacts/ContactTest.cs b/tests/monotouch-test/Contacts/ContactTest.cs index 84478d1389..0610d045c8 100644 --- a/tests/monotouch-test/Contacts/ContactTest.cs +++ b/tests/monotouch-test/Contacts/ContactTest.cs @@ -33,8 +33,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/Contacts/ContactVCardSerializationTest.cs b/tests/monotouch-test/Contacts/ContactVCardSerializationTest.cs index c2bdc7e228..990dd2f987 100644 --- a/tests/monotouch-test/Contacts/ContactVCardSerializationTest.cs +++ b/tests/monotouch-test/Contacts/ContactVCardSerializationTest.cs @@ -33,8 +33,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/Contacts/MutableContactTest.cs b/tests/monotouch-test/Contacts/MutableContactTest.cs index 638a4dd67f..2e78fd39d6 100644 --- a/tests/monotouch-test/Contacts/MutableContactTest.cs +++ b/tests/monotouch-test/Contacts/MutableContactTest.cs @@ -34,8 +34,7 @@ namespace MonoTouchFixtures.Contacts { [SetUp] public void MinimumSdkCheck () { - if (!TestRuntime.CheckiOSSystemVersion (9,0)) - Assert.Inconclusive ("Requires 9.0+"); + TestRuntime.AssertXcodeVersion (7, 0); } [Test] diff --git a/tests/monotouch-test/CoreFoundation/BundleTest.cs b/tests/monotouch-test/CoreFoundation/BundleTest.cs index 638591e573..ff4115b966 100644 --- a/tests/monotouch-test/CoreFoundation/BundleTest.cs +++ b/tests/monotouch-test/CoreFoundation/BundleTest.cs @@ -19,6 +19,12 @@ namespace MonoTouchFixtures.CoreFoundation { [Preserve (AllMembers = true)] public class BundleTest { +#if __WATCHOS__ + const string ExpectedAppName = "monotouchtest.appex"; +#else + const string ExpectedAppName = "monotouchtest.app"; +#endif + [Test] public void TestGetAll () { @@ -67,7 +73,12 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestGetMain () { var main = CFBundle.GetMain (); - Assert.AreEqual ("com.xamarin.monotouch-test", main.Identifier); +#if __WATCHOS__ + var expectedBundleId = "com.xamarin.monotouch-test.watchkitapp.watchkitextension"; +#else + var expectedBundleId = "com.xamarin.monotouch-test"; +#endif + Assert.AreEqual (expectedBundleId, main.Identifier); Assert.IsTrue (main.HasLoadedExecutable); } @@ -82,7 +93,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestExecutableUrl () { var main = CFBundle.GetMain (); - Assert.That(main.ExecutableUrl.ToString (), Contains.Substring ("monotouchtest.app/monotouchtest")); + Assert.That(main.ExecutableUrl.ToString (), Contains.Substring (ExpectedAppName + "/monotouchtest")); } [Test] @@ -96,7 +107,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestResourcesDirectoryUrl () { var main = CFBundle.GetMain (); - Assert.That(main.ResourcesDirectoryUrl.ToString (), Contains.Substring ("monotouchtest.app/")); + Assert.That(main.ResourcesDirectoryUrl.ToString (), Contains.Substring (ExpectedAppName + "/")); } [Test] @@ -117,7 +128,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestSupportFilesDirectoryUrl () { var main = CFBundle.GetMain (); - Assert.That(main.SupportFilesDirectoryUrl.ToString (), Contains.Substring ("monotouchtest.app/")); + Assert.That(main.SupportFilesDirectoryUrl.ToString (), Contains.Substring (ExpectedAppName + "/")); } [Test] @@ -131,7 +142,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestUrl () { var main = CFBundle.GetMain (); - Assert.That(main.Url.ToString (), Contains.Substring ("monotouchtest.app/")); + Assert.That(main.Url.ToString (), Contains.Substring (ExpectedAppName + "/")); } [Test] diff --git a/tests/monotouch-test/CoreFoundation/DispatchTests.cs b/tests/monotouch-test/CoreFoundation/DispatchTests.cs index f9a4e9844c..4ba1add391 100644 --- a/tests/monotouch-test/CoreFoundation/DispatchTests.cs +++ b/tests/monotouch-test/CoreFoundation/DispatchTests.cs @@ -115,7 +115,7 @@ namespace MonoTouchFixtures.CoreFoundation { [Test] public void Default () { - var qname = TestRuntime.CheckSystemAndSDKVersion (8, 0) ? "com.apple.root.default-qos" : "com.apple.root.default-priority"; + var qname = TestRuntime.CheckiOSSystemVersion (8, 0, false) ? "com.apple.root.default-qos" : "com.apple.root.default-priority"; Assert.That (DispatchQueue.DefaultGlobalQueue.Label, Is.EqualTo (qname), "Default"); } @@ -165,7 +165,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void GetGlobalQueue_Priority () { string qdefault, qlow, qhigh; - if (TestRuntime.CheckSystemAndSDKVersion (8, 0)) { + if (TestRuntime.CheckiOSSystemVersion (8, 0, false)) { qdefault = "com.apple.root.default-qos"; qlow = "com.apple.root.utility-qos"; qhigh = "com.apple.root.user-initiated-qos"; diff --git a/tests/monotouch-test/CoreFoundation/UrlTest.cs b/tests/monotouch-test/CoreFoundation/UrlTest.cs index 60269c3e50..d4298ad5c5 100644 --- a/tests/monotouch-test/CoreFoundation/UrlTest.cs +++ b/tests/monotouch-test/CoreFoundation/UrlTest.cs @@ -43,7 +43,7 @@ namespace MonoTouchFixtures.CoreFoundation { public void ToString_ () { using (CFUrl url = CFUrl.FromFile ("/")) { - string value = TestRuntime.CheckSystemAndSDKVersion (7, 0) ? "file:///" : "file://localhost/"; + string value = TestRuntime.CheckiOSSystemVersion (7, 0, false) ? "file:///" : "file://localhost/"; Assert.That (url.ToString (), Is.EqualTo (value), "FromFile"); } using (CFUrl url = CFUrl.FromUrlString ("/", null)) { diff --git a/tests/monotouch-test/CoreGraphics/CGImageTest.cs b/tests/monotouch-test/CoreGraphics/CGImageTest.cs index b181a6d632..8243851c8b 100644 --- a/tests/monotouch-test/CoreGraphics/CGImageTest.cs +++ b/tests/monotouch-test/CoreGraphics/CGImageTest.cs @@ -37,7 +37,7 @@ namespace MonoTouchFixtures.CoreGraphics { using (var ui = new UIImage (img, 1.0f, UIImageOrientation.Up)) { Assert.IsNotNull (ui.CGImage, "CGImage"); - if (TestRuntime.CheckiOSSystemVersion (9,0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) Assert.That (img.UTType.ToString (), Is.EqualTo ("public.png"), "UTType"); } } diff --git a/tests/monotouch-test/CoreGraphics/ColorConverterTest.cs b/tests/monotouch-test/CoreGraphics/ColorConverterTest.cs index bd5d2e460b..94284faf25 100644 --- a/tests/monotouch-test/CoreGraphics/ColorConverterTest.cs +++ b/tests/monotouch-test/CoreGraphics/ColorConverterTest.cs @@ -28,8 +28,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateNone () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); Assert.Throws (() => new CGColorConverter (null, null), "null"); Assert.Throws (() => new CGColorConverter (null, new CGColorConverterTriple [0]), "empty"); @@ -38,8 +37,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateSingle () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); var triple = new CGColorConverterTriple () { Space = CGColorSpace.CreateGenericRgb (), @@ -55,8 +53,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateDual () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); var triple = new CGColorConverterTriple () { Space = CGColorSpace.CreateGenericRgb (), @@ -72,8 +69,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateMax () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); var first = new CGColorConverterTriple () { Space = CGColorSpace.CreateGenericRgb (), @@ -99,8 +95,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateTooMany () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); Assert.Throws (() => new CGColorConverter (null, new CGColorConverterTriple [4])); } @@ -108,8 +103,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateSimple () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); using (var from = CGColorSpace.CreateGenericGray ()) using (var to = CGColorSpace.CreateGenericRgb ()) @@ -124,8 +118,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateSimple_GetINativeObject () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); using (var from = CGColorSpace.CreateGenericGray ()) using (var to = CGColorSpace.CreateGenericRgb ()) { @@ -140,8 +133,7 @@ namespace MonoTouchFixtures.CoreGraphics [Test] public void CreateSimple_DeviceColorSpace () { - if (!TestRuntime.CheckSystemAndSDKVersion (9,3)) - Assert.Ignore ("requires iOS 9.3+"); + TestRuntime.AssertXcodeVersion (7, 3); // Requirements: CG color spaces must be calibrated // (no Device{Gray,RGB,CMYK}, Indexed or DeviceN). diff --git a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs index 0fc4ca1714..333cb82874 100644 --- a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs +++ b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs @@ -62,7 +62,7 @@ namespace MonoTouchFixtures.CoreGraphics { // not indexed so no color table Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.Null (cs.GetICCProfile (), "GetICCProfile"); } } @@ -77,7 +77,7 @@ namespace MonoTouchFixtures.CoreGraphics { // not indexed so no color table Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.Null (cs.GetICCProfile (), "GetICCProfile"); } } @@ -92,7 +92,7 @@ namespace MonoTouchFixtures.CoreGraphics { // not indexed so no color table Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.Null (cs.GetICCProfile (), "GetICCProfile"); } } @@ -116,7 +116,7 @@ namespace MonoTouchFixtures.CoreGraphics { var new_table = cs.GetColorTable (); Assert.That (table, Is.EqualTo (new_table), "GetColorTable"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.Null (cs.GetICCProfile (), "GetICCProfile"); } } @@ -136,7 +136,7 @@ namespace MonoTouchFixtures.CoreGraphics { // not indexed so no color table Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "GetColorTable"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var icc_profile = cs.GetICCProfile ()) Assert.That (icc_profile.Length, Is.EqualTo (3284), "GetICCProfile"); } diff --git a/tests/monotouch-test/CoreLocation/LocationTest.cs b/tests/monotouch-test/CoreLocation/LocationTest.cs index ee8ce79bd1..c2f755b291 100644 --- a/tests/monotouch-test/CoreLocation/LocationTest.cs +++ b/tests/monotouch-test/CoreLocation/LocationTest.cs @@ -38,7 +38,7 @@ namespace MonoTouchFixtures.CoreLocation { try { string field = "kCLErrorUserInfoAlternateRegionKey"; var p = Dlfcn.dlsym (lib, field); - if (TestRuntime.CheckiOSSystemVersion (7,1)) + if (TestRuntime.CheckXcodeVersion (5,1)) Assert.That (p, Is.Not.EqualTo (IntPtr.Zero), field); else Assert.That (p, Is.EqualTo (IntPtr.Zero), field); diff --git a/tests/monotouch-test/EventKit/CalendarTest.cs b/tests/monotouch-test/EventKit/CalendarTest.cs index 1ac7797a65..8387bf1a4a 100644 --- a/tests/monotouch-test/EventKit/CalendarTest.cs +++ b/tests/monotouch-test/EventKit/CalendarTest.cs @@ -39,13 +39,21 @@ namespace MonoTouchFixtures.EventKit { EKEventStore store = new EKEventStore (); var c = EKCalendar.FromEventStore (store); // defaults +#if __WATCHOS__ + Assert.False (c.AllowsContentModifications, "AllowsContentModifications"); +#else Assert.True (c.AllowsContentModifications, "AllowsContentModifications"); +#endif Assert.NotNull (c.CalendarIdentifier, "CalendarIdentifier"); Assert.Null (c.CGColor, "CGColor"); - if (TestRuntime.CheckSystemAndSDKVersion (6, 0)) { + if (TestRuntime.CheckXcodeVersion (4, 5)) { // default value changed for iOS 6.0 beta 1 +#if __WATCHOS__ + Assert.True (c.Immutable, "Immutable"); +#else Assert.False (c.Immutable, "Immutable"); +#endif // new in 6.0 Assert.AreEqual (EKEntityMask.Event, c.AllowedEntityTypes, "AllowedEntityTypes"); } else { @@ -62,16 +70,24 @@ namespace MonoTouchFixtures.EventKit { [Test] public void FromEventStoreWithReminder () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) + if (!TestRuntime.CheckXcodeVersion (4, 5)) Assert.Inconclusive ("+[EKCalendar calendarForEntityType:eventStore:]: unrecognized selector before 6.0"); var c = EKCalendar.Create (EKEntityType.Reminder, new EKEventStore ()); // defaults +#if __WATCHOS__ + Assert.False (c.AllowsContentModifications, "AllowsContentModifications"); +#else Assert.True (c.AllowsContentModifications, "AllowsContentModifications"); +#endif Assert.NotNull (c.CalendarIdentifier, "CalendarIdentifier"); Assert.Null (c.CGColor, "CGColor"); +#if __WATCHOS__ + Assert.True (c.Immutable, "Immutable"); +#else Assert.False (c.Immutable, "Immutable"); +#endif Assert.Null (c.Source, "Source"); Assert.False (c.Subscribed, "Subscribed"); Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.None), "SupportedEventAvailabilities"); diff --git a/tests/monotouch-test/EventKit/StructuredLocationTest.cs b/tests/monotouch-test/EventKit/StructuredLocationTest.cs index b05199747e..2a1ec93e8e 100644 --- a/tests/monotouch-test/EventKit/StructuredLocationTest.cs +++ b/tests/monotouch-test/EventKit/StructuredLocationTest.cs @@ -32,7 +32,7 @@ namespace MonoTouchFixtures.EventKit { [Test] public void DefaultValues () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) + if (!TestRuntime.CheckXcodeVersion (4, 5)) Assert.Inconclusive ("EKStructuredLocation is new in 6.0"); var sl = new EKStructuredLocation (); @@ -44,7 +44,7 @@ namespace MonoTouchFixtures.EventKit { [Test] public void FromTitle () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) + if (!TestRuntime.CheckXcodeVersion (4, 5)) Assert.Inconclusive ("EKStructuredLocation is new in 6.0"); var sl = EKStructuredLocation.FromTitle ("my title"); diff --git a/tests/monotouch-test/Foundation/BundleTest.cs b/tests/monotouch-test/Foundation/BundleTest.cs index 1fcf567ec7..570b1aedea 100644 --- a/tests/monotouch-test/Foundation/BundleTest.cs +++ b/tests/monotouch-test/Foundation/BundleTest.cs @@ -132,7 +132,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void AppStoreReceiptURL () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) + if (!TestRuntime.CheckXcodeVersion (5, 0)) Assert.Inconclusive ("Requires iOS7 or later"); // on iOS8 device this now ends with "/StoreKit/sandboxReceipt" diff --git a/tests/monotouch-test/Foundation/CalendarTest.cs b/tests/monotouch-test/Foundation/CalendarTest.cs index c5e0cb036e..3ee944ed6e 100644 --- a/tests/monotouch-test/Foundation/CalendarTest.cs +++ b/tests/monotouch-test/Foundation/CalendarTest.cs @@ -73,8 +73,7 @@ namespace MonoTouchFixtures.Foundation { static void RequiresIos8 () { - if (!TestRuntime.CheckSystemAndSDKVersion (8, 0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); } public NSDate Yesterday { get { return NSDate.FromTimeIntervalSinceNow (-60 * 60 * 24); } } diff --git a/tests/monotouch-test/Foundation/DecimalTest.cs b/tests/monotouch-test/Foundation/DecimalTest.cs index b0719c1d71..f871c269e2 100644 --- a/tests/monotouch-test/Foundation/DecimalTest.cs +++ b/tests/monotouch-test/Foundation/DecimalTest.cs @@ -30,7 +30,7 @@ namespace MonoTouchFixtures.Foundation { // We call NSNumberFormatter to adjust the test according to the iOS (not .NET) culture, // since NSDecimal.ToString () takes culture into account. .NET CultureInfo does not handle cases // like "en-HU" - if (TestRuntime.CheckSystemAndSDKVersion (6, 0) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { + if (TestRuntime.CheckXcodeVersion (4, 5) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { // interestingly the call to `NSDecimal.NSDecimalString (ref this, NSLocale.CurrentLocale.Handle);` does not consider the current locale on iOS 5.1 var expected = NSNumberFormatter.LocalizedStringFromNumbernumberStyle ((NSNumber)f, NSNumberFormatterStyle.Decimal); Assert.That (nsd.ToString (), Is.EqualTo (expected), "ToString"); @@ -47,7 +47,7 @@ namespace MonoTouchFixtures.Foundation { // since NSDecimal.ToString () takes culture into account. .NET CultureInfo does not handle cases // like "en-HU" // note: there's no NSNumber / Decimal conversions - if (TestRuntime.CheckSystemAndSDKVersion (6, 0) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { + if (TestRuntime.CheckXcodeVersion (4, 5) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { // interestingly the call to `NSDecimal.NSDecimalString (ref this, NSLocale.CurrentLocale.Handle);` does not consider the current locale on iOS 5.1 var expected = NSNumberFormatter.LocalizedStringFromNumbernumberStyle ((NSNumber)0.7d, NSNumberFormatterStyle.Decimal); Assert.That (nsd.ToString (), Is.EqualTo (expected), "ToString"); @@ -63,7 +63,7 @@ namespace MonoTouchFixtures.Foundation { // We call NSNumberFormatter to adjust the test according to the iOS (not .NET) culture, // since NSDecimal.ToString () takes culture into account. .NET CultureInfo does not handle cases // like "en-HU" - if (TestRuntime.CheckSystemAndSDKVersion (6, 0) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { + if (TestRuntime.CheckXcodeVersion (4, 5) && (CultureInfo.CurrentCulture.Name != "ar-AE")) { // interestingly the call to `NSDecimal.NSDecimalString (ref this, NSLocale.CurrentLocale.Handle);` does not consider the current locale on iOS 5.1 var expected = NSNumberFormatter.LocalizedStringFromNumbernumberStyle ((NSNumber)d, NSNumberFormatterStyle.Decimal); Assert.That (nsd.ToString (), Is.EqualTo (expected), "ToString"); diff --git a/tests/monotouch-test/Foundation/EncodingDetectionOptionsTest.cs b/tests/monotouch-test/Foundation/EncodingDetectionOptionsTest.cs index 147092cf66..1a461fe680 100644 --- a/tests/monotouch-test/Foundation/EncodingDetectionOptionsTest.cs +++ b/tests/monotouch-test/Foundation/EncodingDetectionOptionsTest.cs @@ -24,8 +24,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void SetValueEnumArray () { - if (!TestRuntime.CheckSystemAndSDKVersion (8, 0)) - Assert.Inconclusive ("Request iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); var encodings = new NSStringEncoding [] { NSStringEncoding.ISOLatin1, NSStringEncoding.ISOLatin2 }; var edo = new EncodingDetectionOptions () { diff --git a/tests/monotouch-test/Foundation/FileManagerTest.cs b/tests/monotouch-test/Foundation/FileManagerTest.cs index 4d5ec193d4..adfe1ce7e3 100644 --- a/tests/monotouch-test/Foundation/FileManagerTest.cs +++ b/tests/monotouch-test/Foundation/FileManagerTest.cs @@ -40,7 +40,7 @@ namespace MonoTouchFixtures.Foundation { Assert.Inconclusive ("sometimes crash under the iOS simulator (generally on the SL/iOS5 bots)"); NSFileManager fm = new NSFileManager (); - if (TestRuntime.CheckSystemAndSDKVersion (6, 0) && fm.UbiquityIdentityToken == null) { + if (TestRuntime.CheckXcodeVersion (4, 5) && fm.UbiquityIdentityToken == null) { // UbiquityIdentityToken is a fast way to check if iCloud is enabled Assert.Pass ("not iCloud enabled"); } diff --git a/tests/monotouch-test/Foundation/FormatterTests.cs b/tests/monotouch-test/Foundation/FormatterTests.cs index 2818ae1ed5..72773dcbe1 100644 --- a/tests/monotouch-test/Foundation/FormatterTests.cs +++ b/tests/monotouch-test/Foundation/FormatterTests.cs @@ -29,8 +29,7 @@ namespace MonoTouchFixtures.Foundation void RequiresIos8 () { - if (!TestRuntime.CheckSystemAndSDKVersion (8, 0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); if (dateComponentsFormatter == null) dateComponentsFormatter = new NSDateComponentsFormatter (); diff --git a/tests/monotouch-test/Foundation/KeyedUnarchiverTest.cs b/tests/monotouch-test/Foundation/KeyedUnarchiverTest.cs index ac70fae5ff..a84f11ea16 100644 --- a/tests/monotouch-test/Foundation/KeyedUnarchiverTest.cs +++ b/tests/monotouch-test/Foundation/KeyedUnarchiverTest.cs @@ -35,7 +35,7 @@ namespace MonoTouchFixtures.Foundation { public void Exceptions () { var data = NSData.FromString ("dummy string"); - if (TestRuntime.CheckiOSSystemVersion (9, 0)) { + if (TestRuntime.CheckXcodeVersion (7, 0)) { // iOS9 does not throw if it cannot get correct data, it simply returns null (much better) Assert.Null (NSKeyedUnarchiver.UnarchiveFile (Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png")), "UnarchiveFile"); Assert.Null (NSKeyedUnarchiver.UnarchiveObject (data), "UnarchiveObject"); diff --git a/tests/monotouch-test/Foundation/LocaleTest.cs b/tests/monotouch-test/Foundation/LocaleTest.cs index 86dc2a60ad..2182b699ab 100644 --- a/tests/monotouch-test/Foundation/LocaleTest.cs +++ b/tests/monotouch-test/Foundation/LocaleTest.cs @@ -33,8 +33,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void FromLocaleIdentifier () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); string ident = NSLocale.CurrentLocale.Identifier; Assert.That (NSLocale.FromLocaleIdentifier (ident).Identifier, Is.EqualTo (ident), "FromLocaleIdentifier"); diff --git a/tests/monotouch-test/Foundation/NSCharacterSetTest.cs b/tests/monotouch-test/Foundation/NSCharacterSetTest.cs index 6c3702ab21..23dd7e0010 100644 --- a/tests/monotouch-test/Foundation/NSCharacterSetTest.cs +++ b/tests/monotouch-test/Foundation/NSCharacterSetTest.cs @@ -27,8 +27,7 @@ namespace MonoTouchFixtures.Foundation { static void RequiresIos8 () { - if (!TestRuntime.CheckSystemAndSDKVersion (8, 0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); } [Test] diff --git a/tests/monotouch-test/Foundation/NSDataTest.cs b/tests/monotouch-test/Foundation/NSDataTest.cs index 857c0bf165..713624ddb3 100644 --- a/tests/monotouch-test/Foundation/NSDataTest.cs +++ b/tests/monotouch-test/Foundation/NSDataTest.cs @@ -39,8 +39,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void ConstructorTest () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("This test uses API introduced in iOS 7"); + TestRuntime.AssertXcodeVersion (5, 0); var bytes = Marshal.AllocHGlobal (1); var deallocated = false; @@ -130,6 +129,12 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Https () { +#if __WATCHOS__ + if (global::ObjCRuntime.Runtime.Arch == global::ObjCRuntime.Arch.DEVICE) { + // This error is returned: Error: The file “robots.txt” couldn’t be opened. The file “robots.txt” couldn’t be opened. + Assert.Ignore ("NSData.FromUrl doesn't seem to work in watchOS"); + } +#endif using (var url = new NSUrl ("https://blog.xamarin.com/robots.txt")) using (var x = NSData.FromUrl (url)) { Assert.That ((x != null) && (x.Length > 0)); @@ -139,8 +144,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Base64_Short () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); using (var data = NSData.FromArray (new byte [1] { 42 })) { string s1 = data.GetBase64EncodedString (NSDataBase64EncodingOptions.EndLineWithCarriageReturn); @@ -160,8 +164,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Base64_Long () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); byte[] array = new byte [60]; using (var data = NSData.FromArray (array)) { @@ -294,8 +297,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Base64String () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); using (var d = new NSData ("WGFtYXJpbg==", NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) { Assert.That (d.ToString (), Is.EqualTo ("Xamarin")); @@ -305,8 +307,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Base64Data () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); using (var b = NSData.FromString ("WGFtYXJpbg==")) using (var d = new NSData (b, NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) { diff --git a/tests/monotouch-test/Foundation/NSDictionary2Test.cs b/tests/monotouch-test/Foundation/NSDictionary2Test.cs index 47740246fc..81221df055 100644 --- a/tests/monotouch-test/Foundation/NSDictionary2Test.cs +++ b/tests/monotouch-test/Foundation/NSDictionary2Test.cs @@ -69,6 +69,30 @@ namespace MonoTouchFixtures.Foundation { }); } + [Test] + public void FromObjectsAndKeysGenericTest () + { + var keys = new [] { + new NSString ("Key1"), + new NSString ("Key2"), + new NSString ("Key3"), + new NSString ("Key4"), + new NSString ("Key5"), + }; + var values = new [] { + NSNumber.FromByte (0x1), + NSNumber.FromFloat (8.5f), + NSNumber.FromDouble (10.5), + NSNumber.FromInt32 (42), + NSNumber.FromBoolean (true), + }; + + var dict = NSDictionary.FromObjectsAndKeys (values, keys, values.Length); + Assert.AreEqual (dict.Count, 5, "count"); + for (int i = 0; i < values.Length; i++) + Assert.AreEqual (dict [keys [i]], values [i], $"key lookup, Iteration: {i}"); + } + [Test] public void KeyValue_Autorelease () { diff --git a/tests/monotouch-test/Foundation/NSMutableDictionary2Test.cs b/tests/monotouch-test/Foundation/NSMutableDictionary2Test.cs index 43b1d3c6b0..d28d0447be 100644 --- a/tests/monotouch-test/Foundation/NSMutableDictionary2Test.cs +++ b/tests/monotouch-test/Foundation/NSMutableDictionary2Test.cs @@ -43,6 +43,30 @@ namespace MonoTouchFixtures.Foundation { Assert.AreEqual ((string)(NSString)(j [(NSString) "key"]), "value", "key lookup"); } + [Test] + public void FromObjectsAndKeysGenericTest () + { + var keys = new [] { + new NSString ("Key1"), + new NSString ("Key2"), + new NSString ("Key3"), + new NSString ("Key4"), + new NSString ("Key5"), + }; + var values = new [] { + NSNumber.FromByte (0x1), + NSNumber.FromFloat (8.5f), + NSNumber.FromDouble (10.5), + NSNumber.FromInt32 (42), + NSNumber.FromBoolean (true), + }; + + var dict = NSMutableDictionary.FromObjectsAndKeys (values, keys, values.Length); + Assert.AreEqual (dict.Count, 5, "count"); + for (int i = 0; i < values.Length; i++) + Assert.AreEqual (dict [keys [i]], values [i], $"key lookup, Iteration: {i}"); + } + [Test] public void KeyValue_Autorelease () { diff --git a/tests/monotouch-test/Foundation/NSStreamTest.cs b/tests/monotouch-test/Foundation/NSStreamTest.cs index 6908cbd416..bb22f63cc5 100644 --- a/tests/monotouch-test/Foundation/NSStreamTest.cs +++ b/tests/monotouch-test/Foundation/NSStreamTest.cs @@ -40,8 +40,16 @@ namespace MonoTouchFixtures.Foundation { } +#if !__WATCHOS__ TcpListener FindPort (out int port) { + // This does not work well on watchOS: + // The request to start the tcp listener will fail, but + // at the same time leave a file descriptor (the socket) open + // until the TcpListener is collected by the GC. + // Since we create 3000 TcpListeners here, we end up using + // up all the available file descriptors, causing trouble + // for later tests. for (port = 3000; port < 6000; port++) { var listener = new TcpListener (IPAddress.Any, port); try { @@ -53,7 +61,6 @@ namespace MonoTouchFixtures.Foundation { return null; } -#if !__WATCHOS__ [Test] public void ConnectToHost () { @@ -83,7 +90,6 @@ namespace MonoTouchFixtures.Foundation { read.Close (); write.Close (); } -#endif // !__WATCHOS__ [Test] public void ConnectToPeer () @@ -128,6 +134,7 @@ namespace MonoTouchFixtures.Foundation { } client.Close (); } +#endif // !__WATCHOS__ } } diff --git a/tests/monotouch-test/Foundation/ObjectTest.cs b/tests/monotouch-test/Foundation/ObjectTest.cs index 54268b50cc..efebd22abe 100644 --- a/tests/monotouch-test/Foundation/ObjectTest.cs +++ b/tests/monotouch-test/Foundation/ObjectTest.cs @@ -93,7 +93,7 @@ namespace MonoTouchFixtures.Foundation { using (CGColor c = new CGColor (CGColorSpace.CreateDeviceRGB (), new nfloat [] { 0.1f, 0.2f, 0.3f, 1.0f })) { Assert.IsNotNull (NSObject.FromObject (c), "CGColor"); } - if (TestRuntime.CheckSystemAndSDKVersion (8,0)) { + if (TestRuntime.CheckXcodeVersion (6, 0)) { using (var sac = new SecAccessControl (SecAccessible.WhenPasscodeSetThisDeviceOnly)) { Assert.IsNotNull (NSObject.FromObject (sac), "SecAccessControl"); } diff --git a/tests/monotouch-test/Foundation/StringTest.cs b/tests/monotouch-test/Foundation/StringTest.cs index 7840d8d3f7..5fe68ff7f3 100644 --- a/tests/monotouch-test/Foundation/StringTest.cs +++ b/tests/monotouch-test/Foundation/StringTest.cs @@ -179,8 +179,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void DrawingExtensions () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("requires iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var s = new NSString ("foo")) { NSStringDrawingOptions options = NSStringDrawingOptions.OneShot; diff --git a/tests/monotouch-test/Foundation/ThreadTest.cs b/tests/monotouch-test/Foundation/ThreadTest.cs index 9d4aabfe49..3ff42932c5 100644 --- a/tests/monotouch-test/Foundation/ThreadTest.cs +++ b/tests/monotouch-test/Foundation/ThreadTest.cs @@ -36,6 +36,9 @@ namespace MonoTouchFixtures.Foundation { [Test] public void GetEntryAssemblyReturnsOk () { +#if __WATCHOS__ + Assert.IsNull (Assembly.GetEntryAssembly ()); +#else Assert.IsNotNull (Assembly.GetEntryAssembly ()); Assert.IsTrue (NSThread.IsMain); int rv = -1; @@ -52,6 +55,7 @@ namespace MonoTouchFixtures.Foundation { t.Start (); t.Join (); Assert.AreEqual (0, rv); +#endif } [Test] diff --git a/tests/monotouch-test/Foundation/UbiquitousKeyValueStoreTest.cs b/tests/monotouch-test/Foundation/UbiquitousKeyValueStoreTest.cs index daaf43ce5e..5a64c8ab94 100644 --- a/tests/monotouch-test/Foundation/UbiquitousKeyValueStoreTest.cs +++ b/tests/monotouch-test/Foundation/UbiquitousKeyValueStoreTest.cs @@ -28,6 +28,13 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Indexer () { +#if __WATCHOS__ + // Looks like NSUbiquitousKeyValueStore doesn't work on watchOS: + // http://stackoverflow.com/questions/37412775/nsubiquitouskeyvaluestore-is-unavailable-watchos-2 + // https://forums.developer.apple.com/thread/47564 + Assert.Ignore ("Doesn't work on watchOS"); +#endif + using (var store = new NSUbiquitousKeyValueStore ()) { using (var key = new NSString ("key")) { using (var value = new NSString ("value")) { diff --git a/tests/monotouch-test/Foundation/UrlProtectionSpaceTest.cs b/tests/monotouch-test/Foundation/UrlProtectionSpaceTest.cs index 65118ce4be..254c2a19c8 100644 --- a/tests/monotouch-test/Foundation/UrlProtectionSpaceTest.cs +++ b/tests/monotouch-test/Foundation/UrlProtectionSpaceTest.cs @@ -59,7 +59,7 @@ namespace MonoTouchFixtures.Foundation { public void Https () { using (var ps = new NSUrlProtectionSpace ("mail.google.com", 443, NSUrlProtectionSpace.HTTPS, null, NSUrlProtectionSpace.AuthenticationMethodHTTPBasic)) { - if (TestRuntime.CheckiOSSystemVersion (9, 0)) { + if (TestRuntime.CheckXcodeVersion (7, 0)) { Assert.That (ps.AuthenticationMethod, Is.EqualTo ("NSURLAuthenticationMethodHTTPBasic"), "AuthenticationMethod"); } else { Assert.That (ps.AuthenticationMethod, Is.EqualTo ("NSURLAuthenticationMethodDefault"), "AuthenticationMethod"); diff --git a/tests/monotouch-test/Foundation/UrlSessionConfigurationTest.cs b/tests/monotouch-test/Foundation/UrlSessionConfigurationTest.cs index 624ffb1f29..d8267dfe3d 100644 --- a/tests/monotouch-test/Foundation/UrlSessionConfigurationTest.cs +++ b/tests/monotouch-test/Foundation/UrlSessionConfigurationTest.cs @@ -30,8 +30,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void BackgroundSessionConfiguration () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); // https://trello.com/c/F6cyUBFU/70-simple-background-transfer-bo-pang-block-by-an-system-invalidcastexception-in-nsurlsessionconfiguration-backgroundsessionconfigu using (var session = NSUrlSessionConfiguration.BackgroundSessionConfiguration ("id")) { @@ -42,8 +41,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Default_Properties () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); var config = NSUrlSessionConfiguration.DefaultSessionConfiguration; @@ -88,7 +86,7 @@ namespace MonoTouchFixtures.Foundation { Assert.False (config.SessionSendsLaunchEvents, "sessionSendsLaunchEvents"); config.SessionSendsLaunchEvents = config.SessionSendsLaunchEvents; // setSessionSendsLaunchEvents: - if (TestRuntime.CheckiOSSystemVersion (8,0)) { + if (TestRuntime.CheckXcodeVersion (6, 0)) { Assert.Null (config.SharedContainerIdentifier, "sharedContainerIdentifier"); config.SharedContainerIdentifier = config.SharedContainerIdentifier; // setSharedContainerIdentifier: } @@ -111,7 +109,7 @@ namespace MonoTouchFixtures.Foundation { Assert.NotNull (config.URLCredentialStorage, "URLCredentialStorage"); config.URLCredentialStorage = config.URLCredentialStorage; // setURLCredentialStorage: - if (TestRuntime.CheckiOSSystemVersion (8,0)) { + if (TestRuntime.CheckXcodeVersion (6, 0)) { Assert.NotNull (config.WeakProtocolClasses, "protocolClasses"); } else { Assert.Null (config.WeakProtocolClasses, "protocolClasses"); diff --git a/tests/monotouch-test/Foundation/UrlSessionTaskTest.cs b/tests/monotouch-test/Foundation/UrlSessionTaskTest.cs index 918754146d..1431305168 100644 --- a/tests/monotouch-test/Foundation/UrlSessionTaskTest.cs +++ b/tests/monotouch-test/Foundation/UrlSessionTaskTest.cs @@ -28,8 +28,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Properties () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); using (var ur = new NSUrlRequest ()) using (var task = NSUrlSession.SharedSession.CreateDownloadTask (ur)) { diff --git a/tests/monotouch-test/Foundation/UrlSessionTest.cs b/tests/monotouch-test/Foundation/UrlSessionTest.cs index 8685293e1d..ec20c908e7 100644 --- a/tests/monotouch-test/Foundation/UrlSessionTest.cs +++ b/tests/monotouch-test/Foundation/UrlSessionTest.cs @@ -29,11 +29,10 @@ namespace MonoTouchFixtures.Foundation { [Test] public void CreateDataTaskAsync () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); NSUrlSession session = NSUrlSession.SharedSession; - + NSUrlSessionConfiguration.DefaultSessionConfiguration.TimeoutIntervalForRequest = 15; // seconds var url = new NSUrl ("http://www.xamarin.com"); var tmpfile = Path.GetTempFileName (); File.WriteAllText (tmpfile, "TMPFILE"); @@ -98,8 +97,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void DownloadDataAsync () { - if (!TestRuntime.CheckiOSSystemVersion (7, 0)) - Assert.Inconclusive ("NSUrlSession is iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); bool completed = false; int failed_iteration = -1; @@ -128,8 +126,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void SharedSession () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); // in iOS9 those selectors do not respond - but they do work (forwarded to __NSURLSessionLocal type ?) // * delegateQueue, sessionDescription, setSessionDescription:, delegate diff --git a/tests/monotouch-test/Foundation/UrlTest.cs b/tests/monotouch-test/Foundation/UrlTest.cs index fc739f009d..3803a750ac 100644 --- a/tests/monotouch-test/Foundation/UrlTest.cs +++ b/tests/monotouch-test/Foundation/UrlTest.cs @@ -29,20 +29,12 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Fields () { - // new in 5.1 - if (!TestRuntime.CheckSystemAndSDKVersion (5, 1)) - return; - Assert.That (NSUrl.IsExcludedFromBackupKey.ToString (), Is.EqualTo ("NSURLIsExcludedFromBackupKey"), "IsExcludedFromBackupKey"); } [Test] public void IsExcludedFromBackupKey () { - // new in 5.1 - if (!TestRuntime.CheckSystemAndSDKVersion (5, 1)) - return; - // NOTE: this test was failing with either NullReferenceException or InvalidCastException // when we used CFBoolean as a NSObject (i.e. CFBoolean.TrueObject). The test order execution // was important to track this down diff --git a/tests/monotouch-test/Foundation/UserDefaultsTest.cs b/tests/monotouch-test/Foundation/UserDefaultsTest.cs index caaf79c012..11699c123b 100644 --- a/tests/monotouch-test/Foundation/UserDefaultsTest.cs +++ b/tests/monotouch-test/Foundation/UserDefaultsTest.cs @@ -70,8 +70,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Ctor_SuiteName () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); // initWithSuiteName: using (var ud = new NSUserDefaults ("suitename", NSUserDefaultsType.SuiteName)) { diff --git a/tests/monotouch-test/Foundation/UuidTest.cs b/tests/monotouch-test/Foundation/UuidTest.cs index 21d04be6ee..00c1aaebc2 100644 --- a/tests/monotouch-test/Foundation/UuidTest.cs +++ b/tests/monotouch-test/Foundation/UuidTest.cs @@ -29,8 +29,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void Constructors () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("NSUUID is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); var uuid = new NSUuid (new byte [] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }); Assert.That (uuid, Is.Not.EqualTo (null), "constructed"); @@ -45,8 +44,7 @@ namespace MonoTouchFixtures.Foundation { [Test] public void ConstructorFailures () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("NSUUID is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); try { var uuid = new NSUuid ((byte[]) null); diff --git a/tests/monotouch-test/HealthKit/AnchoredObjectQueryTest.cs b/tests/monotouch-test/HealthKit/AnchoredObjectQueryTest.cs index 2b2a74f52b..840993fa08 100644 --- a/tests/monotouch-test/HealthKit/AnchoredObjectQueryTest.cs +++ b/tests/monotouch-test/HealthKit/AnchoredObjectQueryTest.cs @@ -37,8 +37,7 @@ namespace MonoTouchFixtures.HealthKit { [Test] public void NoAnchor () { - if (!TestRuntime.CheckSystemAndSDKVersion (8,0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); using (var t = HKObjectType.GetCategoryType (HKCategoryTypeIdentifierKey.SleepAnalysis)) using (var aoq = new HKAnchoredObjectQuery (t, null, HKAnchoredObjectQuery.NoAnchor, 0, delegate (HKAnchoredObjectQuery query, HKSample[] results, nuint newAnchor, NSError error) { diff --git a/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs b/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs index 121f53e3f6..65dd514482 100644 --- a/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs +++ b/tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs @@ -31,8 +31,7 @@ namespace MonoTouchFixtures.HealthKit { [Test] public void EnumValues_22351 () { - if (!TestRuntime.CheckSystemAndSDKVersion (8,0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); foreach (HKCategoryTypeIdentifier value in Enum.GetValues (typeof (HKCategoryTypeIdentifier))) { @@ -40,7 +39,7 @@ namespace MonoTouchFixtures.HealthKit { case HKCategoryTypeIdentifier.SleepAnalysis: break; default: - if (!TestRuntime.CheckiOSSystemVersion (9, 0)) + if (!TestRuntime.CheckXcodeVersion (7, 0)) continue; break; } diff --git a/tests/monotouch-test/HealthKit/ErrorTest.cs b/tests/monotouch-test/HealthKit/ErrorTest.cs index 29b3091ca2..0c353a6803 100644 --- a/tests/monotouch-test/HealthKit/ErrorTest.cs +++ b/tests/monotouch-test/HealthKit/ErrorTest.cs @@ -32,8 +32,7 @@ namespace MonoTouchFixtures.HealthKit { public void Domain () { // the enum exists but we can't load the domain before iOS8 - if (!TestRuntime.CheckSystemAndSDKVersion (8,0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); Assert.That (HKErrorCode.NoError.GetDomain ().ToString (), Is.EqualTo ("com.apple.healthkit"), "Domain"); } diff --git a/tests/monotouch-test/HealthKit/ObjectTypeTest.cs b/tests/monotouch-test/HealthKit/ObjectTypeTest.cs index 7e0cb02735..f2cac0403b 100644 --- a/tests/monotouch-test/HealthKit/ObjectTypeTest.cs +++ b/tests/monotouch-test/HealthKit/ObjectTypeTest.cs @@ -37,8 +37,7 @@ namespace MonoTouchFixtures.HealthKit { [Test] public void Workout () { - if (!TestRuntime.CheckSystemAndSDKVersion (8,0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); using (var t = HKObjectType.GetWorkoutType ()) { Assert.That (t.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); diff --git a/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs b/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs index 795ec03a8c..ed6d9e0eb5 100644 --- a/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs +++ b/tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs @@ -31,8 +31,7 @@ namespace MonoTouchFixtures.HealthKit { [Test] public void EnumValues_22351 () { - if (!TestRuntime.CheckSystemAndSDKVersion (8,0)) - Assert.Inconclusive ("Requires iOS8+"); + TestRuntime.AssertXcodeVersion (6, 0); foreach (HKQuantityTypeIdentifier value in Enum.GetValues (typeof (HKQuantityTypeIdentifier))) { @@ -41,7 +40,7 @@ namespace MonoTouchFixtures.HealthKit { case HKQuantityTypeIdentifier.BasalBodyTemperature: case HKQuantityTypeIdentifier.DietaryWater: case HKQuantityTypeIdentifier.UVExposure: - if (!TestRuntime.CheckiOSSystemVersion (9, 0)) + if (!TestRuntime.CheckXcodeVersion (7, 0)) continue; break; } diff --git a/tests/monotouch-test/ImageIO/CGImageSourceTest.cs b/tests/monotouch-test/ImageIO/CGImageSourceTest.cs index 44ef783466..45582465f4 100644 --- a/tests/monotouch-test/ImageIO/CGImageSourceTest.cs +++ b/tests/monotouch-test/ImageIO/CGImageSourceTest.cs @@ -170,8 +170,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void CopyMetadata () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("Only on iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var imageSource = CGImageSource.FromUrl (NSUrl.FromFilename (filename))) { CGImageOptions options = new CGImageOptions () { ShouldCacheImmediately = true }; @@ -184,8 +183,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void RemoveCache () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("Only on iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var imageSource = CGImageSource.FromUrl (NSUrl.FromFilename (filename))) { imageSource.RemoveCache (0); diff --git a/tests/monotouch-test/ImageIO/ImageDestinationTest.cs b/tests/monotouch-test/ImageIO/ImageDestinationTest.cs index 8804b387e0..a1dd7ba9d5 100644 --- a/tests/monotouch-test/ImageIO/ImageDestinationTest.cs +++ b/tests/monotouch-test/ImageIO/ImageDestinationTest.cs @@ -122,8 +122,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void AddImageAndMetadata () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png"); using (NSMutableData destData = new NSMutableData ()) @@ -142,8 +141,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void CopyImageSource () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (NSData data = NSData.FromFile ("xamarin2.png")) using (var source = CGImageSource.FromData (data)) diff --git a/tests/monotouch-test/ImageIO/ImageMetadataTagTest.cs b/tests/monotouch-test/ImageIO/ImageMetadataTagTest.cs index 0adb812f45..9544bd239d 100644 --- a/tests/monotouch-test/ImageIO/ImageMetadataTagTest.cs +++ b/tests/monotouch-test/ImageIO/ImageMetadataTagTest.cs @@ -47,8 +47,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_NSString () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var value = new NSString ("value")) using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, value)) { @@ -64,8 +63,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_NSNumber () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var value = NSNumber.FromByte (255)) using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, value)) { @@ -81,8 +79,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_NSArray () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var value = NSArray.FromNSObjects (nspace, prefix, name)) using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, value)) { @@ -98,8 +95,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_NSDictionary () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var value = NSDictionary.FromObjectAndKey (name, prefix)) using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, value)) { @@ -115,8 +111,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_Bool_True () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, true)) { Assert.That (CFGetRetainCount (tag.Handle), Is.EqualTo (1), "RetainCount"); @@ -133,8 +128,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Ctor_Bool_False () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); var rc = name.RetainCount; using (var tag = new CGImageMetadataTag (nspace, prefix, name, CGImageMetadataType.Default, false)) { diff --git a/tests/monotouch-test/ImageIO/ImageMetadataTest.cs b/tests/monotouch-test/ImageIO/ImageMetadataTest.cs index d7e6b435f7..b0f984ef75 100644 --- a/tests/monotouch-test/ImageIO/ImageMetadataTest.cs +++ b/tests/monotouch-test/ImageIO/ImageMetadataTest.cs @@ -35,8 +35,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Defaults () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); Assert.Throws (delegate { new CGImageMetadata (null); }, "null"); diff --git a/tests/monotouch-test/ImageIO/ImagePropertiesTest.cs b/tests/monotouch-test/ImageIO/ImagePropertiesTest.cs index 29b63da773..443ac971b0 100644 --- a/tests/monotouch-test/ImageIO/ImagePropertiesTest.cs +++ b/tests/monotouch-test/ImageIO/ImagePropertiesTest.cs @@ -36,7 +36,7 @@ namespace MonoTouchFixtures.ImageIO { Assert.NotNull (CGImageProperties.MakerNikonDictionary, "MakerNikonDictionary"); // iOS 8.3 finally fixed them :) - if (TestRuntime.CheckiOSSystemVersion (8,3)) { + if (TestRuntime.CheckXcodeVersion (6, 3)) { Assert.NotNull (CGImageProperties.MakerMinoltaDictionary, "MakerMinoltaDictionary"); Assert.NotNull (CGImageProperties.MakerFujiDictionary, "MakerFujiDictionary"); Assert.NotNull (CGImageProperties.MakerOlympusDictionary, "MakerOlympusDictionary"); @@ -65,7 +65,7 @@ namespace MonoTouchFixtures.ImageIO { // documented as new in iOS 4.3 - https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGImageProperties_Reference/Reference/reference.html IntPtr lib = Dlfcn.dlopen (Constants.ImageIOLibrary, 0); try { - if (TestRuntime.CheckSystemAndSDKVersion (6,0)) { + if (TestRuntime.CheckXcodeVersion (4, 5)) { // symbols are available in iOS 6.0 beta 1 Assert.That (Dlfcn.dlsym (lib, "kCGImagePropertyExifCameraOwnerName"), Is.Not.EqualTo (IntPtr.Zero), "kCGImagePropertyExifCameraOwnerName"); Assert.That (Dlfcn.dlsym (lib, "kCGImagePropertyExifBodySerialNumber"), Is.Not.EqualTo (IntPtr.Zero), "kCGImagePropertyExifBodySerialNumber"); diff --git a/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs b/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs index d64c8da72d..c5450770bd 100644 --- a/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs +++ b/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs @@ -35,8 +35,7 @@ namespace MonoTouchFixtures.ImageIO { [Test] public void Defaults () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Ignore ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); using (var meta = new CGMutableImageMetadata ()) { Console.WriteLine (meta); diff --git a/tests/monotouch-test/Main.cs b/tests/monotouch-test/Main.cs index a0205b4b42..34d7fb1cbb 100644 --- a/tests/monotouch-test/Main.cs +++ b/tests/monotouch-test/Main.cs @@ -31,102 +31,19 @@ namespace monotouchtest } } -class TestRuntime +partial class TestRuntime { - [DllImport ("/usr/lib/system/libdyld.dylib")] - static extern int dyld_get_program_sdk_version (); - - public const string BuildVersion_iOS9_GM = "13A340"; - - public static string GetiOSBuildVersion () - { -#if __WATCHOS__ - throw new Exception ("Can't get iOS Build version on watchOS."); -#else - return NSString.FromHandle (Messaging.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 CheckiOSSystemVersion (int major, int minor) - { -#if __WATCHOS__ - throw new Exception ("Can't get iOS System version on WatchOS."); -#else - return UIDevice.CurrentDevice.CheckSystemVersion (major, minor); -#endif - } - - // 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 CheckSDKVersion (int major, int minor) - { -#if __WATCHOS__ - throw new Exception ("Can't get iOS SDK version on WatchOS."); -#else - if (Runtime.Arch == Arch.SIMULATOR || !UIDevice.CurrentDevice.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; - } - - public static void IgnoreOnTVOS () - { -#if __TVOS__ - NUnit.Framework.Assert.Ignore ("This test is disabled on TVOS."); -#endif - } - - public static bool IsTVOS { - get { -#if __TVOS__ - return true; -#else - return false; -#endif - } - } - public static bool RunAsync (DateTime timeout, Action action, Func check_completed) { #if __WATCHOS__ - throw new NotImplementedException ("TestRuntime.RunAsync"); + NSTimer.CreateScheduledTimer (0.01, (v) => action ()); + do { + if (timeout < DateTime.Now) + return false; + NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.1)); + } while (!check_completed ()); + + return true; #else return MonoTouchFixtures.AppDelegate.RunAsync (timeout, action, check_completed); #endif diff --git a/tests/monotouch-test/MapKit/MapRectTest.cs b/tests/monotouch-test/MapKit/MapRectTest.cs index 9352a333ea..fd36cd8ba9 100644 --- a/tests/monotouch-test/MapKit/MapRectTest.cs +++ b/tests/monotouch-test/MapKit/MapRectTest.cs @@ -115,7 +115,7 @@ namespace MonoTouchFixtures.MapKit { Assert.True (remainder.IsNull, "IsNull"); rect = new MKMapRect (-90, -90, 90, 90); - Assert.That (rect.Spans180thMeridian, Is.EqualTo (!TestRuntime.CheckiOSSystemVersion (7,1)), rect.ToString ()); + Assert.That (rect.Spans180thMeridian, Is.EqualTo (!TestRuntime.CheckXcodeVersion (5, 1)), rect.ToString ()); remainder = rect.Remainder (); Assert.That (remainder.ToString (), Is.EqualTo (@"{{268435366, -90}, {90, 90}}"), "remainder"); } diff --git a/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs b/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs index 3010ac17f1..12ceeec1d2 100644 --- a/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs +++ b/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs @@ -122,7 +122,7 @@ namespace MonoTouchFixtures.MobileCoreServices { Assert.NotNull (UTType.InkText, "InkText"); - if (TestRuntime.CheckiOSSystemVersion (9, 0)) + if (TestRuntime.CheckXcodeVersion (7, 0)) Assert.NotNull (UTType.SwiftSource, "SwiftSource"); } diff --git a/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs b/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs index e1044b225d..b446264861 100644 --- a/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs +++ b/tests/monotouch-test/ObjCRuntime/DlfcnTest.cs @@ -31,7 +31,7 @@ namespace MonoTouchFixtures.ObjCRuntime { IntPtr handle = Dlfcn.dlopen ("/usr/lib/libSystem.dylib", 0); Assert.That (handle, Is.Not.EqualTo (IntPtr.Zero), "dlopen"); var err = Dlfcn.dlclose (handle); - if ((Runtime.Arch == Arch.DEVICE) && TestRuntime.CheckiOSSystemVersion (9,0)) { + if ((Runtime.Arch == Arch.DEVICE) && TestRuntime.CheckXcodeVersion (7, 0)) { // Apple is doing some funky stuff with dlopen... this condition is to track if this change during betas Assert.That (err, Is.EqualTo (-1), "dlclose"); } else { diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index 683522d988..24fdd70039 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -1333,7 +1333,7 @@ namespace MonoTouchFixtures.ObjCRuntime { { var cl = new Class (typeof (TestTypeEncodingsClass)); var sig = Runtime.GetNSObject (Messaging.IntPtr_objc_msgSend_IntPtr (cl.Handle, Selector.GetHandle ("methodSignatureForSelector:"), Selector.GetHandle ("foo::::::::::::::::"))); - var boolEncoding = IntPtr.Size == 8 ? "B" : "c"; + var boolEncoding = (IntPtr.Size == 8 || TrampolineTest.IsArmv7k) ? "B" : "c"; var exp = new string [] { "@", ":", "^v", "C", "c", "s", "s", "S", "i", "I", "q", "Q", "f", "d", boolEncoding, "@", ":", "#" }; Assert.AreEqual (exp.Length, sig.NumberOfArguments, "NumberOfArguments"); @@ -2238,8 +2238,7 @@ namespace MonoTouchFixtures.ObjCRuntime { [Test] public void GenericAPI () { - if (!TestRuntime.CheckiOSSystemVersion (9, 0)) - Assert.Inconclusive ("Contacts is iOS9+"); + TestRuntime.AssertXcodeVersion (7, 0); using (var contact = new CNMutableContact ()) { var dt = new NSDateComponents () { diff --git a/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs b/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs index 857b43b8bd..104898d824 100644 --- a/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RuntimeTest.cs @@ -117,8 +117,7 @@ namespace MonoTouchFixtures.ObjCRuntime { [Test] public void GetNSObject_Different_Class () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("Requires iOS7 or later"); + TestRuntime.AssertXcodeVersion (5, 0); IntPtr class_ptr = Class.GetHandle ("SKPhysicsBody"); SizeF size = new SizeF (3, 2); @@ -136,8 +135,7 @@ namespace MonoTouchFixtures.ObjCRuntime { [Test] public void GetNSObject_Posing_Class () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("NSUrlSession requires iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); NSUrlSession session = NSUrlSession.SharedSession; using (var request = new NSUrlRequest (new NSUrl ("http://www.example.com"))) { @@ -290,9 +288,14 @@ namespace MonoTouchFixtures.ObjCRuntime { [Test] public void FinalizationRaceCondition () { - if ((IntPtr.Size == 8) && TestRuntime.CheckiOSSystemVersion (9,0)) + if ((IntPtr.Size == 8) && TestRuntime.CheckXcodeVersion (7, 0)) Assert.Ignore ("NSString retainCount is nuint.MaxValue, so we won't collect them"); +#if __WATCHOS__ + if (Runtime.Arch == Arch.DEVICE) + Assert.Ignore ("This test uses too much memory for the watch."); +#endif + NSDictionary dict = null; var thread = new Thread (() => { @@ -500,6 +503,11 @@ namespace MonoTouchFixtures.ObjCRuntime { [TestCase (typeof (ResurrectedObjectsDisposedTestClass))] public void ResurrectedObjectsDisposedTest (Type type) { +#if __WATCHOS__ + if (Runtime.Arch == Arch.DEVICE) + Assert.Ignore ("This test uses too much memory for the watch."); +#endif + var invokerClassHandle = Class.GetHandle (typeof (ResurrectedObjectsDisposedTestClass)); // Create a number of native objects with no managed wrappers. diff --git a/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs b/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs index 60ed2f8bed..1508ec3032 100644 --- a/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs +++ b/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs @@ -47,6 +47,15 @@ namespace MonoTouchFixtures.ObjCRuntime { public bool IsSim32 { get { return IntPtr.Size == 4 && Runtime.Arch == Arch.SIMULATOR; } } public bool IsArm64 { get { return IntPtr.Size == 8 && Runtime.Arch == Arch.DEVICE; } } public bool IsArm32 { get { return IntPtr.Size == 4 && Runtime.Arch == Arch.DEVICE; } } + public static bool IsArmv7k { + get { +#if __WATCHOS__ + return Runtime.Arch == Arch.DEVICE; +#else + return false; +#endif + } + } #if !__WATCHOS__ [Test] @@ -76,25 +85,25 @@ namespace MonoTouchFixtures.ObjCRuntime { double rvd; float rvf; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend (obj.Handle, new Selector ("Test_IIIIStruct").Handle); } else { IIIIStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_IIIIStruct").Handle); } Assert.That ("[1;2;3;4]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticIIIIStruct").Handle); } else { IIIIStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticIIIIStruct").Handle); } Assert.That ("[10;20;30;40]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend (obj.Handle, new Selector ("Test_IIIIStructProperty").Handle); } else { IIIIStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_IIIIStructProperty").Handle); } Assert.That ("[100;200;300;400]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticIIIIStructProperty").Handle); } else { IIIIStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticIIIIStructProperty").Handle); @@ -102,7 +111,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That ("[1000;2000;3000;4000]" == rv.ToString ()); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend_out_float (class_ptr, new Selector ("Test_StaticIIIIStruct_out_Float:").Handle, out rvf); } else { IIIIStruct_objc_msgSend_stret_out_float (out rv, class_ptr, new Selector ("Test_StaticIIIIStruct_out_Float:").Handle, out rvf); @@ -112,7 +121,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That (rvf == 3.15f); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IIIIStruct_objc_msgSend_out_double (obj.Handle, new Selector ("Test_IIIIStruct_out_Double:").Handle, out rvd); } else { IIIIStruct_objc_msgSend_stret_out_double (out rv, obj.Handle, new Selector ("Test_IIIIStruct_out_Double:").Handle, out rvd); @@ -132,25 +141,25 @@ namespace MonoTouchFixtures.ObjCRuntime { double rvd; float rvf; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend (obj.Handle, new Selector ("Test_FFFFStruct").Handle); } else { FFFFStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_FFFFStruct").Handle); } Assert.That ("[1;2;3;4]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticFFFFStruct").Handle); } else { FFFFStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticFFFFStruct").Handle); } Assert.That ("[10;20;30;40]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend (obj.Handle, new Selector ("Test_FFFFStructProperty").Handle); } else { FFFFStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_FFFFStructProperty").Handle); } Assert.That ("[100;200;300;400]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticFFFFStructProperty").Handle); } else { FFFFStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticFFFFStructProperty").Handle); @@ -158,7 +167,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That ("[1000;2000;3000;4000]" == rv.ToString ()); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend_out_float (class_ptr, new Selector ("Test_StaticFFFFStruct_out_Float:").Handle, out rvf); } else { FFFFStruct_objc_msgSend_stret_out_float (out rv, class_ptr, new Selector ("Test_StaticFFFFStruct_out_Float:").Handle, out rvf); @@ -168,7 +177,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That (rvf == 3.15f); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FFFFStruct_objc_msgSend_out_double (obj.Handle, new Selector ("Test_FFFFStruct_out_Double:").Handle, out rvd); } else { FFFFStruct_objc_msgSend_stret_out_double (out rv, obj.Handle, new Selector ("Test_FFFFStruct_out_Double:").Handle, out rvd); @@ -187,25 +196,25 @@ namespace MonoTouchFixtures.ObjCRuntime { double rvd; float rvf; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend (obj.Handle, new Selector ("Test_FIFIStruct").Handle); } else { FIFIStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_FIFIStruct").Handle); } Assert.That ("[1;2;3;4]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticFIFIStruct").Handle); } else { FIFIStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticFIFIStruct").Handle); } Assert.That ("[10;20;30;40]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend (obj.Handle, new Selector ("Test_FIFIStructProperty").Handle); } else { FIFIStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_FIFIStructProperty").Handle); } Assert.That ("[100;200;300;400]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticFIFIStructProperty").Handle); } else { FIFIStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticFIFIStructProperty").Handle); @@ -213,7 +222,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That ("[1000;2000;3000;4000]" == rv.ToString ()); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend_out_float (class_ptr, new Selector ("Test_StaticFIFIStruct_out_Float:").Handle, out rvf); } else { FIFIStruct_objc_msgSend_stret_out_float (out rv, class_ptr, new Selector ("Test_StaticFIFIStruct_out_Float:").Handle, out rvf); @@ -223,7 +232,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That (rvf == 3.15f); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = FIFIStruct_objc_msgSend_out_double (obj.Handle, new Selector ("Test_FIFIStruct_out_Double:").Handle, out rvd); } else { FIFIStruct_objc_msgSend_stret_out_double (out rv, obj.Handle, new Selector ("Test_FIFIStruct_out_Double:").Handle, out rvd); @@ -242,25 +251,25 @@ namespace MonoTouchFixtures.ObjCRuntime { double rvd; float rvf; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend (obj.Handle, new Selector ("Test_IFIFStruct").Handle); } else { IFIFStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_IFIFStruct").Handle); } Assert.That ("[1;2;3;4]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticIFIFStruct").Handle); } else { IFIFStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticIFIFStruct").Handle); } Assert.That ("[10;20;30;40]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend (obj.Handle, new Selector ("Test_IFIFStructProperty").Handle); } else { IFIFStruct_objc_msgSend_stret (out rv, obj.Handle, new Selector ("Test_IFIFStructProperty").Handle); } Assert.That ("[100;200;300;400]" == rv.ToString ()); - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend (class_ptr, new Selector ("Test_StaticIFIFStructProperty").Handle); } else { IFIFStruct_objc_msgSend_stret (out rv, class_ptr, new Selector ("Test_StaticIFIFStructProperty").Handle); @@ -268,7 +277,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That ("[1000;2000;3000;4000]" == rv.ToString ()); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend_out_float (class_ptr, new Selector ("Test_StaticIFIFStruct_out_Float:").Handle, out rvf); } else { IFIFStruct_objc_msgSend_stret_out_float (out rv, class_ptr, new Selector ("Test_StaticIFIFStruct_out_Float:").Handle, out rvf); @@ -278,7 +287,7 @@ namespace MonoTouchFixtures.ObjCRuntime { Assert.That (rvf == 3.15f); rvd = rvf = 0; - if (IsSim64 || IsArm64) { + if (IsSim64 || IsArm64 || IsArmv7k) { rv = IFIFStruct_objc_msgSend_out_double (obj.Handle, new Selector ("Test_IFIFStruct_out_Double:").Handle, out rvd); } else { IFIFStruct_objc_msgSend_stret_out_double (out rv, obj.Handle, new Selector ("Test_IFIFStruct_out_Double:").Handle, out rvd); @@ -494,38 +503,38 @@ namespace MonoTouchFixtures.ObjCRuntime { CATransform3D catransform3d; #endif // !__WATCHOS__ int i; - + rect2 = new RectangleF (1.2f, 2.3f, 3.4f, 4.5f); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = RectangleF_objc_msgSend_IntPtr_IntPtr_RectangleF (obj.Handle, new Selector ("testRectangleF_string_string_RectangleF:b:c:").Handle, new NSString ("a").Handle, new NSString ("b").Handle, rect2); } else { RectangleF_objc_msgSend_stret_IntPtr_IntPtr_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_string_string_RectangleF:b:c:").Handle, new NSString ("a").Handle, new NSString ("b").Handle, rect2); } Assert.That (rect == new RectangleF (rect2.X * pi, rect2.Y * pi, rect2.Width * pi, rect2.Height * pi), "#testRectangleF_string_string_RectangleF:b:c:"); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend (obj.Handle, new Selector ("testRectangleF").Handle); } else { Messaging.RectangleF_objc_msgSend_stret (out rect, obj.Handle, new Selector ("testRectangleF").Handle); } Assert.That (rect == new RectangleF (1.2f, 2.3f, 3.4f, 4.5f), "#testRectangleF"); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend (class_ptr, new Selector ("staticTestRectangleF").Handle); } else { Messaging.RectangleF_objc_msgSend_stret (out rect, class_ptr, new Selector ("staticTestRectangleF").Handle); } Assert.That (rect == new RectangleF (1.2f, 2.3f, 3.4f, 4.5f), "#static testRectangleF"); - + i = 152; - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_int (obj.Handle, new Selector ("testRectangleF_int:").Handle, 152); } else { Messaging.RectangleF_objc_msgSend_stret_int (out rect, obj.Handle, new Selector ("testRectangleF_int:").Handle, 152); } Assert.That (rect == new RectangleF (i + .1f, i + .2f, i + .3f, i + .4f), "#ret RectF-int", "#testRectangleF_int:"); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_IntPtr (obj.Handle, new Selector ("testRectangleF_IntPtr:").Handle, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_IntPtr:").Handle, tmp_obj.Handle); @@ -534,50 +543,50 @@ namespace MonoTouchFixtures.ObjCRuntime { #if !__TVOS__ mkregion = new MKCoordinateRegion (new CLLocationCoordinate2D (123.456, 345.678), new MKCoordinateSpan (987.654, 654.321)); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_MKCoordinateRegion_IntPtr (obj.Handle, new Selector ("testRectangleF_MCCoordinateRegion_IntPtr:str:").Handle, mkregion, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_MKCoordinateRegion_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_MCCoordinateRegion_IntPtr:str:").Handle, mkregion, tmp_obj.Handle); } Assert.That (rect == new RectangleF (123.456f+pi, 345.678f-pi, 987.654f*pi, 654.321f/pi), "#testRectangleF_MCCoordinateRegion_IntPtr:str:"); - + mkmaprect = new MKMapRect (111.1, 222.2, 333.3, 444.4); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_MKMapRect (obj.Handle, new Selector ("testRectangleF_MKMapRect:").Handle, mkmaprect); } else { Messaging.RectangleF_objc_msgSend_stret_MKMapRect (out rect, obj.Handle, new Selector ("testRectangleF_MKMapRect:").Handle, mkmaprect); } Assert.That (rect == new RectangleF (111.1f, 222.2f, 333.3f, 444.4f), "#testRectangleF_MKMapRect:"); #endif // !__TVOS__ - + rect2 = new RectangleF (9.9f, 8.8f, 7.7f, 6.6f); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF (obj.Handle, new Selector ("testRectangleF_RectangleF:").Handle, rect2); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF:").Handle, rect2); } Assert.That (rect == rect2, "#testRectangleF_RectangleF:"); - + rect2 = new RectangleF (5.44f, 4.33f, 3.22f, 2.11f); i = 8; - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_int (obj.Handle, new Selector ("testRectangleF_RectangleF_int:i:").Handle, rect2, 8); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_int (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_int:i:").Handle, rect2, 8); } AreAlmostEqual (rect, new RectangleF (5.44f*i, 4.33f+i, 3.22f-i, 2.11f/i), "testRectangleF_RectangleF_int:i:"); - + rect2 = new RectangleF (5.4f, 4.3f, 3.2f, 2.1f); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_IntPtr (obj.Handle, new Selector ("testRectangleF_RectangleF_IntPtr:str:").Handle, rect2, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_IntPtr:str:").Handle, rect2, tmp_obj.Handle); } Assert.That (rect == new RectangleF (5.4f*pi, 4.3f+pi, 3.2f-pi, 2.1f/pi)); - + rect2 = new RectangleF (1, 2, 3, 4); rect3 = new RectangleF (9, 8, 7, 6); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_RectangleF_float ( obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_float:b:c:").Handle, rect2, rect3, (float) pi); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_RectangleF_float (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_float:b:c:").Handle, rect2, rect3, (float) pi); @@ -587,7 +596,7 @@ namespace MonoTouchFixtures.ObjCRuntime { rect2 = new RectangleF (1, 2, 3, 4); rect3 = new RectangleF (9, 8, 7, 6); rect4 = new RectangleF (10, 20, 30, 40); - if (IsArm64) { + if (IsArm64 || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_RectangleF_RectangleF (obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_RectangleF:b:c:").Handle, rect2, rect3, rect4); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_RectangleF_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_RectangleF:b:c:").Handle, rect2, rect3, rect4); @@ -625,14 +634,14 @@ namespace MonoTouchFixtures.ObjCRuntime { PointF point; SizeF size; - if (IsArm32) { + if (IsArm32 && !IsArmv7k) { Messaging.PointF_objc_msgSend_stret (out point, obj.Handle, new Selector ("testPointF").Handle); } else { point = Messaging.PointF_objc_msgSend (obj.Handle, new Selector ("testPointF").Handle); } Assert.That (point == new PointF (pi*2, pi*20), "#testPointF"); - if (IsArm32) { + if (IsArm32 && !IsArmv7k) { Messaging.SizeF_objc_msgSend_stret (out size, obj.Handle, new Selector ("testSizeF").Handle); } else { size = Messaging.SizeF_objc_msgSend (obj.Handle, new Selector ("testSizeF").Handle); diff --git a/tests/monotouch-test/PassKit/ObjectTest.cs b/tests/monotouch-test/PassKit/ObjectTest.cs index f76f2a8a81..5ff7d33d9b 100644 --- a/tests/monotouch-test/PassKit/ObjectTest.cs +++ b/tests/monotouch-test/PassKit/ObjectTest.cs @@ -29,10 +29,9 @@ namespace MonoTouchFixtures.PassKit { [Test] public void Constructor () { - if (!TestRuntime.CheckSystemAndSDKVersion (6, 0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); - if (TestRuntime.CheckSystemAndSDKVersion (8, 0)) { + if (TestRuntime.CheckXcodeVersion (6, 0)) { Assert.DoesNotThrow (() => new PKObject ()); } else { Assert.Throws (() => new PKObject ()); diff --git a/tests/monotouch-test/PassKit/PassLibraryTest.cs b/tests/monotouch-test/PassKit/PassLibraryTest.cs index c7dd939323..03806c8268 100644 --- a/tests/monotouch-test/PassKit/PassLibraryTest.cs +++ b/tests/monotouch-test/PassKit/PassLibraryTest.cs @@ -30,8 +30,7 @@ namespace MonoTouchFixtures.PassKit { [Test] public void Defaults () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); // this is yet another case where Apples plays ping-ping with different versions // @@ -64,8 +63,7 @@ namespace MonoTouchFixtures.PassKit { [Test] public void Fields () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); Assert.That (PKPassLibraryUserInfoKey.AddedPasses.ToString (), Is.EqualTo ("PKPassLibraryAddedPassesUserInfo"), "AddedPassesUserInfoKey"); Assert.That (PKPassLibraryUserInfoKey.RemovedPassInfos.ToString (), Is.EqualTo ("PKPassLibraryRemovedPassInfosUserInfo"), "RemovedPassInfosUserInfoKey"); diff --git a/tests/monotouch-test/PassKit/PassTest.cs b/tests/monotouch-test/PassKit/PassTest.cs index e543ffcb14..398cc1a4c9 100644 --- a/tests/monotouch-test/PassKit/PassTest.cs +++ b/tests/monotouch-test/PassKit/PassTest.cs @@ -30,8 +30,7 @@ namespace MonoTouchFixtures.PassKit { [Test] public void Defaults () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); using (PKPass pass = new PKPass ()) { Assert.Null (pass.AuthenticationToken, "AuthenticationToken"); @@ -63,8 +62,7 @@ namespace MonoTouchFixtures.PassKit { [Test] public void BoardingPass () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); using (var pass = GetBoardingPass ()) { Assert.That (pass.AuthenticationToken, Is.EqualTo ("vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc"), "AuthenticationToken"); @@ -78,7 +76,7 @@ namespace MonoTouchFixtures.PassKit { Assert.That (pass.OrganizationName, Is.EqualTo ("Skyport Airways"), "OrganizationName"); Assert.That (pass.PassTypeIdentifier, Is.EqualTo ("pass.com.apple.devpubs.example"), "PassTypeIdentifier"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.That (pass.PassUrl.AbsoluteString, Is.EqualTo ("shoebox://card/1UuiGnfwxHgd0G0bIuPYPNpeRX8="), "PassUrl"); else Assert.Null (pass.PassUrl, "PassUrl"); @@ -91,8 +89,7 @@ namespace MonoTouchFixtures.PassKit { [Test] public void Fields () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("PassKit is new in 6.0"); + TestRuntime.AssertXcodeVersion (4, 5); Assert.That (PKPass.ErrorDomain.ToString (), Is.EqualTo ("PKPassKitErrorDomain"), "ErrorDomain"); } diff --git a/tests/monotouch-test/Security/KeyChainTest.cs b/tests/monotouch-test/Security/KeyChainTest.cs index 90a49173b0..06d6aca84c 100644 --- a/tests/monotouch-test/Security/KeyChainTest.cs +++ b/tests/monotouch-test/Security/KeyChainTest.cs @@ -51,7 +51,7 @@ namespace MonoTouchFixtures.Security { Assert.True (code == SecStatusCode.DuplicateItem || code == SecStatusCode.Success); } - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) + if (!TestRuntime.CheckXcodeVersion (5, 0)) Assert.Inconclusive ("QueryAsConcreteType does not work before iOS7"); using (SecRecord rec = new SecRecord (SecKind.Identity)) { diff --git a/tests/monotouch-test/Security/KeyTest.cs b/tests/monotouch-test/Security/KeyTest.cs index 2c0b2e74f2..9c319e5cb4 100644 --- a/tests/monotouch-test/Security/KeyTest.cs +++ b/tests/monotouch-test/Security/KeyTest.cs @@ -226,7 +226,7 @@ namespace MonoTouchFixtures.Security { record.KeySizeInBits = 16384; Assert.That (SecKey.GenerateKeyPair (record.ToDictionary (), out public_key, out private_key), Is.EqualTo (SecStatusCode.Param), "16384"); record.KeySizeInBits = 8192; - if (TestRuntime.CheckiOSSystemVersion (9, 0)) { + if (TestRuntime.CheckXcodeVersion (7, 0)) { // It seems iOS 9 supports 8192, but it takes a long time to generate (~40 seconds on my iPad Air 2), so skip it. // Assert.That (SecKey.GenerateKeyPair (record.ToDictionary (), out public_key, out private_key), Is.EqualTo (SecStatusCode.Success), "8192"); } else { diff --git a/tests/monotouch-test/Security/PolicyTest.cs b/tests/monotouch-test/Security/PolicyTest.cs index 21eab0ea10..228b2a179a 100644 --- a/tests/monotouch-test/Security/PolicyTest.cs +++ b/tests/monotouch-test/Security/PolicyTest.cs @@ -51,7 +51,7 @@ namespace MonoTouchFixtures.Security { Assert.That (policy.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); Assert.That (CFGetRetainCount (policy.Handle), Is.EqualTo ((nint) 1), "RetainCount"); - if (TestRuntime.CheckSystemAndSDKVersion (7,0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var properties = policy.GetProperties ()) { Assert.That (properties.Handle, Is.Not.EqualTo (IntPtr.Zero), "Properties.Handle"); Assert.That (CFGetRetainCount (properties.Handle), Is.EqualTo ((nint) 1), "Properties.RetainCount"); @@ -69,7 +69,7 @@ namespace MonoTouchFixtures.Security { Assert.That (policy.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); Assert.That (CFGetRetainCount (policy.Handle), Is.EqualTo ((nint) 1), "RetainCount"); - if (TestRuntime.CheckSystemAndSDKVersion (7,0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var properties = policy.GetProperties ()) { Assert.That (properties.Handle, Is.Not.EqualTo (IntPtr.Zero), "Properties.Handle"); Assert.That (CFGetRetainCount (properties.Handle), Is.EqualTo ((nint) 1), "Properties.RetainCount"); @@ -88,7 +88,7 @@ namespace MonoTouchFixtures.Security { Assert.That (policy.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); Assert.That (CFGetRetainCount (policy.Handle), Is.EqualTo ((nint) 1), "RetainCount"); - if (TestRuntime.CheckSystemAndSDKVersion (7,0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var properties = policy.GetProperties ()) { Assert.That (properties.Handle, Is.Not.EqualTo (IntPtr.Zero), "Properties.Handle"); Assert.That (CFGetRetainCount (properties.Handle), Is.EqualTo ((nint) 1), "Properties.RetainCount"); @@ -107,7 +107,7 @@ namespace MonoTouchFixtures.Security { Assert.That (policy.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); Assert.That (CFGetRetainCount (policy.Handle), Is.EqualTo ((nint) 1), "RetainCount"); - if (TestRuntime.CheckSystemAndSDKVersion (7,0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var properties = policy.GetProperties ()) { Assert.That (properties.Handle, Is.Not.EqualTo (IntPtr.Zero), "Properties.Handle"); Assert.That (CFGetRetainCount (properties.Handle), Is.EqualTo ((nint) 1), "Properties.RetainCount"); @@ -121,8 +121,7 @@ namespace MonoTouchFixtures.Security { [Test] public void RevocationPolicy () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); using (var policy = SecPolicy.CreateRevocationPolicy (SecRevocation.UseAnyAvailableMethod | SecRevocation.RequirePositiveResponse)) { Assert.That (policy.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); @@ -149,8 +148,7 @@ namespace MonoTouchFixtures.Security { [Test] public void CreateWellKnownPolicies () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); CreatePolicy (SecPolicyIdentifier.AppleX509Basic); CreatePolicy (SecPolicyIdentifier.AppleSSL); @@ -169,8 +167,7 @@ namespace MonoTouchFixtures.Security { [Test] public void CreateUnknownPolicy () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Inconclusive ("requires iOS7"); + TestRuntime.AssertXcodeVersion (5, 0); using (var oid = new NSString ("1.2.3.4")) { Assert.Throws (delegate { diff --git a/tests/monotouch-test/Security/RecordTest.cs b/tests/monotouch-test/Security/RecordTest.cs index ca4f5d792b..2e93c323c7 100644 --- a/tests/monotouch-test/Security/RecordTest.cs +++ b/tests/monotouch-test/Security/RecordTest.cs @@ -29,7 +29,7 @@ namespace MonoTouchFixtures.Security { // prior to iOS7 you had to deal without the class using (var dict = rec.ToDictionary ()) { - if (TestRuntime.CheckSystemAndSDKVersion (7,0)) + if (TestRuntime.CheckXcodeVersion (5, 0)) Assert.That (dict ["class"].ToString (), Is.EqualTo ("idnt"), "idnt"); else Assert.Null (dict ["class"], "idnt"); @@ -73,7 +73,7 @@ namespace MonoTouchFixtures.Security { Assert.AreSame (rec.MatchIssuers [0], data, "MatchIssuers [0]"); } - if (!TestRuntime.CheckiOSSystemVersion (9,0)) + if (!TestRuntime.CheckXcodeVersion (7, 0)) return; Assert.That (rec.AuthenticationUI, Is.EqualTo (SecAuthenticationUI.NotSet), "AuthenticationUI-get"); rec.AuthenticationUI = SecAuthenticationUI.Allow; diff --git a/tests/monotouch-test/Security/SecureTransportTest.cs b/tests/monotouch-test/Security/SecureTransportTest.cs index 2d1c554047..708d193e73 100644 --- a/tests/monotouch-test/Security/SecureTransportTest.cs +++ b/tests/monotouch-test/Security/SecureTransportTest.cs @@ -92,7 +92,7 @@ namespace MonoTouchFixtures.Security { [Test] public void DatagramDefaults () { - nint dsize = TestRuntime.CheckSystemAndSDKVersion (8, 0) ? 1327 : 1387; + nint dsize = TestRuntime.CheckXcodeVersion (6, 0) ? 1327 : 1387; using (var ssl = new SslContext (SslProtocolSide.Client, SslConnectionType.Datagram)) { Assert.That (ssl.BufferedReadSize, Is.EqualTo ((nint) 0), "BufferedReadSize"); Assert.Null (ssl.Connection, "Connection"); @@ -153,6 +153,8 @@ namespace MonoTouchFixtures.Security { Assert.That (ssl_client_ciphers, Is.EqualTo (ssl_server_ciphers), "same"); } +#if !__WATCHOS__ + // This test uses sockets (TcpClient), which doesn't work on watchOS. [Test] public void Tls12 () { @@ -197,5 +199,6 @@ namespace MonoTouchFixtures.Security { Assert.That (s, Is.StringStarting ("HTTP/1.0 302 Found").Or.StringStarting ("HTTP/1.0 200 OK"), "response"); } } +#endif // !__WATCHOS__ } } \ No newline at end of file diff --git a/tests/monotouch-test/Security/TrustTest.cs b/tests/monotouch-test/Security/TrustTest.cs index 375556f962..cdb4471fdc 100644 --- a/tests/monotouch-test/Security/TrustTest.cs +++ b/tests/monotouch-test/Security/TrustTest.cs @@ -75,7 +75,7 @@ namespace MonoTouchFixtures.Security { // the system was able to construct the chain based on the single certificate Assert.That (Evaluate (trust, true), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "Evaluate"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { Assert.True (trust.NetworkFetchAllowed, "NetworkFetchAllowed-1"); trust.NetworkFetchAllowed = false; Assert.False (trust.NetworkFetchAllowed, "NetworkFetchAllowed-2"); @@ -100,7 +100,7 @@ namespace MonoTouchFixtures.Security { trust.SetVerifyDate (new DateTime (635108745218945450, DateTimeKind.Utc)); Assert.That (Evaluate (trust, true), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "Evaluate"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { Assert.That (trust.GetTrustResult (), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "GetTrustResult"); using (var a = NSArray.FromNSObjects (policy)) @@ -127,7 +127,7 @@ namespace MonoTouchFixtures.Security { trust.SetVerifyDate (new DateTime (635108745218945450, DateTimeKind.Utc)); Assert.That (Evaluate (trust, true), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "Evaluate"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { using (var rev = SecPolicy.CreateRevocationPolicy (SecRevocation.UseAnyAvailableMethod)) { List list = new List () { policy, rev }; trust.SetPolicies (list); @@ -150,7 +150,7 @@ namespace MonoTouchFixtures.Security { // a host name is not meaningful for client certificates Assert.That (Evaluate (trust, true), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "Evaluate"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { // by default there's no *custom* anchors Assert.Null (trust.GetCustomAnchorCertificates (), "GetCustomAnchorCertificates"); @@ -176,7 +176,7 @@ namespace MonoTouchFixtures.Security { SecTrustResult result = SecTrustResult.RecoverableTrustFailure; Assert.That (Evaluate (trust, result == SecTrustResult.RecoverableTrustFailure), Is.EqualTo (result), "Evaluate"); - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { // call GetPolicies without a SetPolicy / SetPolicies var policies = trust.GetPolicies (); Assert.That (policies.Length, Is.EqualTo (1), "Policies.Length"); @@ -201,7 +201,7 @@ namespace MonoTouchFixtures.Security { trust.SetVerifyDate (new DateTime (635108745218945450, DateTimeKind.Utc)); // iOS9 is not fully happy with the basic constraints: `SecTrustEvaluate [root AnchorTrusted BasicContraints]` // so it returns RecoverableTrustFailure and that affects the Count of trust later (it does not add to what we provided) - var ios9 = TestRuntime.CheckiOSSystemVersion (9,0); + var ios9 = TestRuntime.CheckXcodeVersion (7, 0); var result = Evaluate (trust, ios9); Assert.That (result, Is.EqualTo (ios9 ? SecTrustResult.RecoverableTrustFailure : SecTrustResult.Unspecified), "Evaluate"); // Evalute must be called prior to Count (Apple documentation) @@ -226,10 +226,12 @@ namespace MonoTouchFixtures.Security { trust.SetVerifyDate (new DateTime (635108745218945450, DateTimeKind.Utc)); SecTrustResult trust_result = SecTrustResult.Unspecified; - if (TestRuntime.CheckiOSSystemVersion (10, 0)) + var ios9 = TestRuntime.CheckXcodeVersion (7, 0); + var ios10 = TestRuntime.CheckXcodeVersion (8, 0); + if (ios10) trust_result = SecTrustResult.FatalTrustFailure; // iOS9 is not fully happy with the basic constraints: `SecTrustEvaluate [root AnchorTrusted BasicContraints]` - else if (TestRuntime.CheckiOSSystemVersion (9, 0)) + else if (ios9) trust_result = SecTrustResult.RecoverableTrustFailure; var result = Evaluate (trust, true); Assert.That (result, Is.EqualTo (trust_result), "Evaluate"); @@ -251,7 +253,7 @@ namespace MonoTouchFixtures.Security { Assert.That (sc3.SubjectSummary, Is.EqualTo ("Class 3 Public Primary Certification Authority"), "SubjectSummary(sc3)"); } - if (TestRuntime.CheckSystemAndSDKVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { Assert.That (trust.GetTrustResult (), Is.EqualTo (trust_result), "GetTrustResult"); trust.SetAnchorCertificates (certs); @@ -274,9 +276,15 @@ namespace MonoTouchFixtures.Security { Assert.That (CFGetRetainCount (trust.Handle), Is.EqualTo ((nint) 1), "RetainCount(trust)"); Assert.That (CFGetRetainCount (policy.Handle), Is.EqualTo ((nint) 2), "RetainCount(policy)"); // the system was able to construct the chain based on the single certificate +#if __WATCHOS__ + Assert.That (Evaluate (trust), Is.EqualTo (SecTrustResult.RecoverableTrustFailure), "Evaluate"); + // Evalute must be called prior to Count (Apple documentation) + Assert.That (trust.Count, Is.EqualTo (1), "Count"); +#else Assert.That (Evaluate (trust), Is.EqualTo (SecTrustResult.Unspecified), "Evaluate"); // Evalute must be called prior to Count (Apple documentation) Assert.That (trust.Count, Is.EqualTo (3), "Count"); +#endif using (NSData data = trust.GetExceptions ()) { Assert.That (CFGetRetainCount (data.Handle), Is.EqualTo ((nint) 1), "RetainCount(data)"); diff --git a/tests/monotouch-test/UIKit/FontTest.cs b/tests/monotouch-test/UIKit/FontTest.cs index d43a7ea6c7..adb1ea2eb7 100644 --- a/tests/monotouch-test/UIKit/FontTest.cs +++ b/tests/monotouch-test/UIKit/FontTest.cs @@ -38,8 +38,7 @@ namespace MonoTouchFixtures.UIKit { [Test] public void TestDescriptors () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("requires iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); var font = UIFont.BoldSystemFontOfSize (80); var descriptor = font.FontDescriptor; @@ -103,7 +102,7 @@ namespace MonoTouchFixtures.UIKit { f2 = f2.WithSize (12); SemiFactory_25511 (f1, f2, "WithSize"); - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) + if (!TestRuntime.CheckXcodeVersion (5, 0)) return; using (var name = new NSString ("UICTFontTextStyleBody")) { @@ -121,8 +120,7 @@ namespace MonoTouchFixtures.UIKit { [Test] public void Properties () { - if (!TestRuntime.CheckSystemAndSDKVersion (7, 0)) - Assert.Ignore ("requires iOS7+"); + TestRuntime.AssertXcodeVersion (5, 0); var f1 = UIFont.PreferredBody; // the same instance will be returned (from an iOS cache) @@ -155,7 +153,7 @@ namespace MonoTouchFixtures.UIKit { public void NullFonts () { var invalidFontName = new NSString ("Invalid Font Name"); - if (TestRuntime.CheckiOSSystemVersion (7, 0)) { + if (TestRuntime.CheckXcodeVersion (5, 0)) { Assert.IsNotNull (UIFont.GetPreferredFontForTextStyle (invalidFontName), "GetPreferredFontForTextStyle"); Assert.IsNotNull (UIFont.FromDescriptor (new UIFontDescriptor (), -2), "FromDescriptor (,)"); } @@ -164,7 +162,7 @@ namespace MonoTouchFixtures.UIKit { Assert.IsNotNull (UIFont.SystemFontOfSize (-3), "SystemFontOfSize()"); - if (TestRuntime.CheckiOSSystemVersion (8, 2)) { + if (TestRuntime.CheckXcodeVersion (6, 2)) { Assert.IsNotNull (UIFont.SystemFontOfSize (0, UIFontWeight.Regular), "SystemFontOfSize (nfloat, UIFontWeight)"); Assert.IsNotNull (UIFont.SystemFontOfSize (0, (nfloat) 0), "SystemFontOfSize (nfloat, nfloat)"); } diff --git a/tests/monotouch-test/UIKit/StringAttributesTest.cs b/tests/monotouch-test/UIKit/StringAttributesTest.cs index c34f126d86..201e7bd659 100644 --- a/tests/monotouch-test/UIKit/StringAttributesTest.cs +++ b/tests/monotouch-test/UIKit/StringAttributesTest.cs @@ -38,8 +38,7 @@ namespace MonoTouchFixtures.UIKit { [Test] public void RetainCount () { - if (!TestRuntime.CheckSystemAndSDKVersion (6,0)) - Assert.Inconclusive ("Requires iOS 6+"); + TestRuntime.AssertXcodeVersion (4, 5); var sa = new UIStringAttributes (); @@ -86,8 +85,7 @@ namespace MonoTouchFixtures.UIKit { [Test] public void RetainCount_7 () { - if (!TestRuntime.CheckSystemAndSDKVersion (7,0)) - Assert.Inconclusive ("Requires iOS 7+"); + TestRuntime.AssertXcodeVersion (5, 0); var sa = new UIStringAttributes (); sa.Expansion = 0.0f; diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index f12edfb27e..fbc0aa8254 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -533,6 +533,9 @@ + + TestRuntime.cs + diff --git a/tests/tests.sln b/tests/tests.sln index 041d8d79f6..fbff4671a0 100644 --- a/tests/tests.sln +++ b/tests/tests.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monotouch-test", "monotouch-test\monotouch-test.csproj", "{AC6D070F-2ED4-4701-B701-81915B931D1D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link", "linker-ios\dont link\dont link.csproj", "{208744BD-504E-47D7-9A98-1CF02454A6DA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "introspection-ios", "introspection\iOS\introspection-ios.csproj", "{208744BD-504E-47D7-9A98-1CF02454A6DA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link sdk", "linker-ios\link sdk\link sdk.csproj", "{C47F8F72-A7CA-4149-AA7D-BC4814803EF3}" EndProject @@ -63,6 +63,8 @@ Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "fsharplibrary", "fsharplibr EndProject Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "fsharp", "fsharp\fsharp.fsproj", "{7862FE5A-530A-4651-825F-C80836B0A3A1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link", "linker-ios\dont link\dont link.csproj", "{839212D5-C25B-4284-AA96-59C3872B8184}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|iPhoneSimulator = Debug|iPhoneSimulator @@ -70,6 +72,7 @@ Global Debug|iPhone = Debug|iPhone Release|iPhone = Release|iPhone Debug|Any CPU = Debug|Any CPU + DebugStaticRegistrar|iPhone = DebugStaticRegistrar|iPhone EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1ADF4F27-7610-4501-A62E-1157273AED7E}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator @@ -82,6 +85,8 @@ Global {1ADF4F27-7610-4501-A62E-1157273AED7E}.Release|iPhone.Build.0 = Release|iPhone {1ADF4F27-7610-4501-A62E-1157273AED7E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {1ADF4F27-7610-4501-A62E-1157273AED7E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {1ADF4F27-7610-4501-A62E-1157273AED7E}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {1ADF4F27-7610-4501-A62E-1157273AED7E}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.ActiveCfg = Debug|iPhone {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.Build.0 = Debug|iPhone @@ -92,6 +97,8 @@ Global {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {208744BD-504E-47D7-9A98-1CF02454A6DA}.DebugStaticRegistrar|iPhone.ActiveCfg = DebugStaticRegistrar|iPhone + {208744BD-504E-47D7-9A98-1CF02454A6DA}.DebugStaticRegistrar|iPhone.Build.0 = DebugStaticRegistrar|iPhone {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -102,6 +109,8 @@ Global {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhone.Build.0 = Release|iPhone {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {2CF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -112,6 +121,8 @@ Global {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhone.Build.0 = Release|iPhone {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.DebugStaticRegistrar|iPhone.ActiveCfg = Release|iPhone + {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.DebugStaticRegistrar|iPhone.Build.0 = Release|iPhone {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -122,6 +133,8 @@ Global {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Release|iPhone.Build.0 = Release|iPhone {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {34CB1751-E445-4E32-BFA7-03E6831C11EE}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {34CB1751-E445-4E32-BFA7-03E6831C11EE}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {34CB1751-E445-4E32-BFA7-03E6831C11EE}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -132,6 +145,8 @@ Global {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhone.Build.0 = Release|iPhone {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -142,6 +157,8 @@ Global {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhone.Build.0 = Release|iPhone {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {3DF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -152,6 +169,8 @@ Global {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhone.Build.0 = Release|iPhone {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {4EF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {5023D584-1A32-4917-90C5-A641C800230C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {5023D584-1A32-4917-90C5-A641C800230C}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {5023D584-1A32-4917-90C5-A641C800230C}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -162,6 +181,8 @@ Global {5023D584-1A32-4917-90C5-A641C800230C}.Release|iPhone.Build.0 = Release|iPhone {5023D584-1A32-4917-90C5-A641C800230C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {5023D584-1A32-4917-90C5-A641C800230C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {5023D584-1A32-4917-90C5-A641C800230C}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {5023D584-1A32-4917-90C5-A641C800230C}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -172,6 +193,8 @@ Global {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhone.Build.0 = Release|iPhone {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -182,6 +205,8 @@ Global {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhone.Build.0 = Release|iPhone {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {5FF294C6-91F1-407B-8A0C-AFACC7C1BDE8}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {676F527D-3352-42EA-9DE2-181C45003568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {676F527D-3352-42EA-9DE2-181C45003568}.Debug|Any CPU.Build.0 = Debug|Any CPU {676F527D-3352-42EA-9DE2-181C45003568}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -192,6 +217,8 @@ Global {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhone.Build.0 = Release|Any CPU {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {676F527D-3352-42EA-9DE2-181C45003568}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {676F527D-3352-42EA-9DE2-181C45003568}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -202,6 +229,8 @@ Global {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhone.Build.0 = Release|iPhone {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {93268FFB-571C-4402-8899-027A7778D2C0}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {93268FFB-571C-4402-8899-027A7778D2C0}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -212,6 +241,8 @@ Global {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhoneSimulator.Build.0 = Debug|Any CPU {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.Build.0 = Debug|Any CPU {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhone.Build.0 = Debug|Any CPU + {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -222,6 +253,8 @@ Global {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Release|iPhone.Build.0 = Release|iPhone {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {A12ED440-8270-4701-A35D-0C3C9E0AA735}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {A12ED440-8270-4701-A35D-0C3C9E0AA735}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {A12ED440-8270-4701-A35D-0C3C9E0AA735}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhone.ActiveCfg = Debug|iPhone {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhone.Build.0 = Debug|iPhone @@ -232,6 +265,8 @@ Global {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {AC6D070F-2ED4-4701-B701-81915B931D1D}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {AC6D070F-2ED4-4701-B701-81915B931D1D}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -242,6 +277,8 @@ Global {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Release|iPhone.Build.0 = Release|iPhone {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {B86D100D-895B-4510-A5BB-E08F11E82C3C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {B86D100D-895B-4510-A5BB-E08F11E82C3C}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {B86D100D-895B-4510-A5BB-E08F11E82C3C}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -252,6 +289,8 @@ Global {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhone.Build.0 = Release|iPhone {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {BEF0140A-A6A6-4074-B55F-03856A6B5862}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {BEF0140A-A6A6-4074-B55F-03856A6B5862}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.ActiveCfg = Debug|iPhone {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.Build.0 = Debug|iPhone @@ -262,6 +301,8 @@ Global {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -272,6 +313,8 @@ Global {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhone.Build.0 = Release|Any CPU {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -282,6 +325,8 @@ Global {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhone.Build.0 = Release|iPhone {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -292,6 +337,8 @@ Global {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhone.Build.0 = Release|iPhone {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {DA061019-04C3-4221-AF04-63F2BFB5DA42}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {DA061019-04C3-4221-AF04-63F2BFB5DA42}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -302,6 +349,8 @@ Global {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Release|iPhone.Build.0 = Release|iPhone {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {DB354193-B05D-471B-BEB8-F6C74DA4C93A}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -312,6 +361,8 @@ Global {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhone.Build.0 = Release|Any CPU {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {E1F53F80-8399-499B-8017-C414B9CD263B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1F53F80-8399-499B-8017-C414B9CD263B}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1F53F80-8399-499B-8017-C414B9CD263B}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -322,6 +373,8 @@ Global {E1F53F80-8399-499B-8017-C414B9CD263B}.Release|iPhone.Build.0 = Release|Any CPU {E1F53F80-8399-499B-8017-C414B9CD263B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {E1F53F80-8399-499B-8017-C414B9CD263B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {E1F53F80-8399-499B-8017-C414B9CD263B}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {E1F53F80-8399-499B-8017-C414B9CD263B}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.Build.0 = Debug|Any CPU {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -332,6 +385,8 @@ Global {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhone.Build.0 = Release|Any CPU {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {E40B0B77-3467-4891-9117-7AF8F248E306}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {E40B0B77-3467-4891-9117-7AF8F248E306}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {EEE20F63-4282-450A-8584-93F640929D13}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {EEE20F63-4282-450A-8584-93F640929D13}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {EEE20F63-4282-450A-8584-93F640929D13}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -342,6 +397,8 @@ Global {EEE20F63-4282-450A-8584-93F640929D13}.Release|iPhone.Build.0 = Release|iPhone {EEE20F63-4282-450A-8584-93F640929D13}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {EEE20F63-4282-450A-8584-93F640929D13}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {EEE20F63-4282-450A-8584-93F640929D13}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {EEE20F63-4282-450A-8584-93F640929D13}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {FBC970AA-8234-4905-B559-BD3F32A63C04}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {FBC970AA-8234-4905-B559-BD3F32A63C04}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {FBC970AA-8234-4905-B559-BD3F32A63C04}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -352,6 +409,8 @@ Global {FBC970AA-8234-4905-B559-BD3F32A63C04}.Release|iPhone.Build.0 = Release|iPhone {FBC970AA-8234-4905-B559-BD3F32A63C04}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {FBC970AA-8234-4905-B559-BD3F32A63C04}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {FBC970AA-8234-4905-B559-BD3F32A63C04}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|iPhone + {FBC970AA-8234-4905-B559-BD3F32A63C04}.DebugStaticRegistrar|iPhone.Build.0 = Debug|iPhone {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -362,6 +421,8 @@ Global {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhone.Build.0 = Release|Any CPU {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU @@ -372,6 +433,8 @@ Global {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhone.Build.0 = Release|Any CPU {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7212169-BA46-413B-91CD-A32C52AD5E0D}.DebugStaticRegistrar|iPhone.ActiveCfg = Debug|Any CPU + {C7212169-BA46-413B-91CD-A32C52AD5E0D}.DebugStaticRegistrar|iPhone.Build.0 = Debug|Any CPU {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator @@ -382,5 +445,19 @@ Global {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhone.Build.0 = Release|iPhone {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {7862FE5A-530A-4651-825F-C80836B0A3A1}.DebugStaticRegistrar|iPhone.ActiveCfg = Release|iPhone + {7862FE5A-530A-4651-825F-C80836B0A3A1}.DebugStaticRegistrar|iPhone.Build.0 = Release|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.ActiveCfg = Debug|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.Build.0 = Debug|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.ActiveCfg = Release|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.Build.0 = Release|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {839212D5-C25B-4284-AA96-59C3872B8184}.DebugStaticRegistrar|iPhone.ActiveCfg = DebugStaticRegistrar|iPhone + {839212D5-C25B-4284-AA96-59C3872B8184}.DebugStaticRegistrar|iPhone.Build.0 = DebugStaticRegistrar|iPhone EndGlobalSection EndGlobal diff --git a/tests/watchos/Extension/InterfaceController.cs b/tests/watchos/Extension/InterfaceController.cs index 8cf983d251..2539b16d65 100644 --- a/tests/watchos/Extension/InterfaceController.cs +++ b/tests/watchos/Extension/InterfaceController.cs @@ -15,6 +15,7 @@ namespace monotouchtestWatchKitExtension public partial class InterfaceController : WKInterfaceController { WatchOSRunner runner; + bool running; [Action ("runTests:")] partial void RunTests (NSObject obj); @@ -37,6 +38,18 @@ namespace monotouchtestWatchKitExtension [Outlet ("cmdRun")] WatchKit.WKInterfaceButton cmdRun { get; set; } + static InterfaceController () + { + ObjCRuntime.Runtime.MarshalManagedException += (object sender, ObjCRuntime.MarshalManagedExceptionEventArgs args) => + { + Console.WriteLine ("Managed exception: {0}", args.Exception); + }; + ObjCRuntime.Runtime.MarshalObjectiveCException += (object sender, ObjCRuntime.MarshalObjectiveCExceptionEventArgs args) => + { + Console.WriteLine ("Objective-C exception: {0}", args.Exception); + }; + } + public InterfaceController (IntPtr handle) : base (handle) { } @@ -70,12 +83,20 @@ namespace monotouchtestWatchKitExtension void RunTests () { + if (running) { + Console.WriteLine ("Already running"); + return; + } + running = true; cmdRun.SetEnabled (false); lblStatus.SetText ("Running"); BeginInvokeOnMainThread (() => { runner.Run (); + cmdRun.SetEnabled (true); + lblStatus.SetText ("Done"); BeginInvokeOnMainThread (RenderResults); + running = false; }); } diff --git a/tests/xharness/WatchOSTarget.cs b/tests/xharness/WatchOSTarget.cs index d4e02c2355..83b7cea02b 100644 --- a/tests/xharness/WatchOSTarget.cs +++ b/tests/xharness/WatchOSTarget.cs @@ -24,7 +24,7 @@ namespace xharness csproj.FindAndReplace ("%WATCHAPP_PATH%", Path.GetFullPath (Harness.WatchOSAppTemplate).Replace ('/', '\\') + "\\"); csproj.FindAndReplace ("%WATCHEXTENSION_CSPROJ%", Path.GetFileName (WatchOSExtensionProjectPath)); csproj.SetProjectReferenceValue (Path.GetFileName (WatchOSExtensionProjectPath), "Project", WatchOSExtensionGuid); - csproj.SetProjectReferenceValue (Path.GetFileName (WatchOSExtensionProjectPath), "Name", Name + "-watchos-extension"); + csproj.SetProjectReferenceValue (Path.GetFileName (WatchOSExtensionProjectPath), "Name", Path.GetFileNameWithoutExtension (WatchOSExtensionProjectPath)); WatchOSAppGuid = "{" + Harness.NewStableGuid ().ToString ().ToUpper () + "}"; csproj.SetProjectGuid (WatchOSAppGuid); Harness.Save (csproj, WatchOSAppProjectPath); @@ -45,7 +45,7 @@ namespace xharness csproj.FindAndReplace ("%CONTAINER_PATH%", Path.GetFullPath (Harness.WatchOSContainerTemplate).Replace ('/', '\\') + "\\"); csproj.FindAndReplace ("%WATCHAPP_CSPROJ%", Path.GetFileName (WatchOSAppProjectPath)); - csproj.SetProjectReferenceValue (Path.GetFileName (WatchOSAppProjectPath), "Name", Name + "-watchos-app"); + csproj.SetProjectReferenceValue (Path.GetFileName (WatchOSAppProjectPath), "Name", Path.GetFileNameWithoutExtension (WatchOSAppProjectPath)); WatchOSGuid = "{" + Harness.NewStableGuid ().ToString ().ToUpper () + "}"; csproj.SetProjectGuid (WatchOSGuid); Harness.Save (csproj, WatchOSProjectPath);