public void SetUp() { if (IntPtr.Size == 4 && PlatformHelper.CheckSystemVersion(10, 13)) { Assert.Ignore("CCUUID was removed from 32-bit in macOS 10.13"); } }
static bool CheckSystemVersion() { #if MONOMAC return(PlatformHelper.CheckSystemVersion(10, 10)); #else return(XamCore.UIKit.UIDevice.CurrentDevice.CheckSystemVersion(8, 0)); #endif // MONOMAC }
bool IsDeprecated() { #if IOS || MONOMAC return(PlatformHelper.CheckSystemVersion(GetMethodDeprecatedMajor, GetMethodDeprecatedMinor)); #elif TVOS return(true); #endif }
bool Skip(Type t) { switch (t.Name) { case "IKPictureTaker": // radar://29311598 case "AVAssetResourceLoader": case "AVAssetResourceLoadingRequest": case "AVAssetResourceLoadingContentInformationRequest": case "SCNRenderer": case "NSStream": case "NSSharingServicePicker": case "NSCache": case "NSToolbar": case "NSComboBox": case "NSComboBoxCell": case "IKScannerDeviceView": case "NSUserActivity": case "NSFontPanel": case "AVAudioRecorder": case "MKMapView": case "SKScene": case "NSSpeechRecognizer": case "NSClickGestureRecognizer": case "NSPopover": // These classes don't do well when you instance them without support return(true); case "SCNLayer": case "SCNProgram": if (Asserts.IsAtLeastElCapitan && IntPtr.Size == 4) { return(true); } break; case "CBCentralManager": if (IntPtr.Size == 4 && PlatformHelper.CheckSystemVersion(10, 13)) // Removed from 32-bit in macOS 10.13 { return(true); } break; case "QTMovie": return(TestRuntime.CheckSystemVersion(PlatformName.MacOSX, 10, 14, 4)); // Broke in macOS 10.14.4. case "AVCaptureView": // Deallocating a AVCaptureView makes it trigger a permission dialog, which we don't want, so just skip this type. return(true); } switch (t.Namespace) { case "QTKit": return(TestRuntime.CheckSystemVersion(PlatformName.MacOSX, 10, 15)); // QTKit is gone in 10.15. } return(false); }
public void SetUp() { var sdk = new Version(Constants.SdkVersion); if (!PlatformHelper.CheckSystemVersion(sdk.Major, sdk.Minor)) { Assert.Ignore("Typos only verified using the latest SDK"); } }
static bool CheckSystemVersion() { #if MONOMAC return(PlatformHelper.CheckSystemVersion(10, 10)); #elif TVOS || IOS return(UIKit.UIDevice.CurrentDevice.CheckSystemVersion(8, 0)); #else #error Unknown platform #endif }
public NSDictionary GetAttachments(CVAttachmentMode attachmentMode) { #if IOS || __MACCATALYST__ || TVOS if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(15, 0)) #elif WATCH if (WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(8, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(12, 0)) #endif { return(Runtime.GetINativeObject <NSDictionary> (CVBufferCopyAttachments(handle, attachmentMode), true)); } return(Runtime.GetNSObject <NSDictionary> (CVBufferGetAttachments(handle, attachmentMode), false)); }
public override void TypoTest() { var sdk = new Version(Constants.SdkVersion); if (!PlatformHelper.CheckSystemVersion(sdk.Major, sdk.Minor)) { Assert.Ignore("Typos only verified using the latest SDK"); } checker = new NSSpellChecker(); base.TypoTest(); }
static bool CheckSystemVersion() { if (!versionCheck.HasValue) { #if MONOMAC versionCheck = PlatformHelper.CheckSystemVersion(10, 12); #elif TVOS || IOS versionCheck = XamCore.UIKit.UIDevice.CurrentDevice.CheckSystemVersion(10, 0); #else #error Unknown platform #endif } return(versionCheck.Value); }
public NSObject GetAttachment(NSString key, out CVAttachmentMode attachmentMode) { if (key == null) { throw new ArgumentNullException("key"); } if (PlatformHelper.CheckSystemVersion(12, 0)) { return(Runtime.GetNSObject <NSObject> (CVBufferCopyAttachment(handle, key.Handle, out attachmentMode), true)); } else { return(Runtime.GetNSObject <NSObject> (CVBufferGetAttachment(handle, key.Handle, out attachmentMode), false)); } }
public static INMessageAttributeOptionsResolutionResult GetConfirmationRequired(INMessageAttributeOptions valueToConfirm) { #if IOS if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) #elif WATCH if (WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(4, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(10, 13)) #endif { return(ConfirmationRequiredWithMessageAttributeOptionsToConfirm(valueToConfirm)); } else { return(ConfirmationRequiredWithValueToConfirm(valueToConfirm)); } }
public static INMessageAttributeOptionsResolutionResult GetSuccess(INMessageAttributeOptions resolvedValue) { #if IOS if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) #elif WATCH if (WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(4, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(10, 13)) #endif { return(SuccessWithResolvedMessageAttributeOptions(resolvedValue)); } else { return(SuccessWithResolvedValue(resolvedValue)); } }
public static INCallRecordTypeResolutionResult GetSuccess(INCallRecordType resolvedValue) { #if IOS if (XamCore.UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) #elif WATCH if (XamCore.WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(4, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(10, 13)) #endif { return(SuccessWithResolvedCallRecordType(resolvedValue)); } else { return(SuccessWithResolvedValue(resolvedValue)); } }
public static INCallRecordTypeResolutionResult GetConfirmationRequired(INCallRecordType valueToConfirm) { #if IOS if (XamCore.UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) #elif WATCH if (XamCore.WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(4, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(10, 13)) #endif { return(ConfirmationRequiredWithCallRecordTypeToConfirm(valueToConfirm)); } else { return(ConfirmationRequiredWithValueToConfirm(valueToConfirm)); } }
public INSpeakableString(string identifier, string spokenPhrase, string pronunciationHint) : base(NSObjectFlag.Empty) { #if IOS if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) #elif WATCH if (WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(4, 0)) #elif MONOMAC if (PlatformHelper.CheckSystemVersion(10, 13)) #endif { InitializeHandle(InitWithVocabularyIdentifier(identifier, spokenPhrase, pronunciationHint)); } else { InitializeHandle(InitWithIdentifier(identifier, spokenPhrase, pronunciationHint)); } }
public void GetBoundingRect_WithEmptyGlyphs() { if (!PlatformHelper.CheckSystemVersion(10, 13)) { return; } CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [] {}; CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); Assert.Throws <ArgumentException> (() => nsFont.GetBoundingRects(glyphs)); Assert.Throws <ArgumentException> (() => nsFont.GetAdvancements(glyphs)); }
bool Skip(Type t) { switch (t.Name) { case "IKPictureTaker": // radar://29311598 case "AVAssetResourceLoader": case "AVAssetResourceLoadingRequest": case "AVAssetResourceLoadingContentInformationRequest": case "SCNRenderer": case "NSStream": case "NSSharingServicePicker": case "NSCache": case "NSToolbar": case "NSComboBox": case "NSComboBoxCell": case "IKScannerDeviceView": case "NSUserActivity": case "NSFontPanel": case "AVAudioRecorder": case "MKMapView": case "SKScene": case "NSSpeechRecognizer": case "NSClickGestureRecognizer": case "NSPopover": // These classes don't do well when you instance them without support return(true); case "SCNLayer": case "SCNProgram": if (Asserts.IsAtLeastElCapitan && IntPtr.Size == 4) { return(true); } break; case "CBCentralManager": if (IntPtr.Size == 4 && PlatformHelper.CheckSystemVersion(10, 13)) // Removed from 32-bit in macOS 10.13 { return(true); } break; } return(false); }
public void GetBoundingRect_SmokeTest() { if (!PlatformHelper.CheckSystemVersion(10, 13)) { return; } CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [5]; for (int i = 0; i < 5; ++i) { glyphs[i] = cgFont.GetGlyphWithGlyphName("Hello"[i].ToString()); } CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); var bounding = nsFont.GetBoundingRects(glyphs); var advancement = nsFont.GetAdvancements(glyphs); Assert.AreEqual(5, bounding.Length); Assert.AreEqual(5, advancement.Length); }
public void ConstantsCheck() { // The constants are file paths for frameworks / dylibs // unless the latest OS is used there's likely to be missing ones // so we run this test only on the latest supported (matching SDK) OS var sdk = new Version(Constants.SdkVersion); #if MONOMAC if (!PlatformHelper.CheckSystemVersion(sdk.Major, sdk.Minor)) #elif __WATCHOS__ if (!WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion(sdk.Major, sdk.Minor)) #else if (!UIDevice.CurrentDevice.CheckSystemVersion(sdk.Major, sdk.Minor)) #endif { Assert.Ignore($"Constants only verified using the latest OS version ({sdk.Major}.{sdk.Minor})"); } var c = typeof(Constants); foreach (var fi in c.GetFields()) { if (!fi.IsPublic) { continue; } var s = fi.GetValue(null) as string; switch (fi.Name) { case "Version": case "SdkVersion": Assert.True(Version.TryParse(s, out _), fi.Name); break; #if !XAMCORE_4_0 #if __TVOS__ case "PassKitLibrary": // not part of tvOS break; #endif case "libcompression": // bad (missing) suffix Assert.True(CheckLibrary(s), fi.Name); break; #endif #if !__MACOS__ case "ChipLibrary": case "ThreadNetworkLibrary": case "MediaSetupLibrary": case "MLComputeLibrary": // Xcode 12 beta 2 does not ship these framework/headers for the simulators if (Runtime.Arch == Arch.DEVICE) { Assert.True(CheckLibrary(s), fi.Name); } break; #endif #if __TVOS__ case "MetalPerformanceShadersLibrary": // not supported in tvOS (12.1) simulator so load fails if (Runtime.Arch == Arch.SIMULATOR) { break; } goto default; #endif default: if (fi.Name.EndsWith("Library", StringComparison.Ordinal)) { #if __IOS__ if (fi.Name == "CoreNFCLibrary") { // NFC is currently not available on iPad if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { continue; } // Phone works unless Xcode 12 on simulator if ((Runtime.Arch == Arch.SIMULATOR) && TestRuntime.CheckXcodeVersion(12, 0)) { continue; } } #endif #if __MACOS__ // Only available in macOS 10.15.4+ if (fi.Name == "AutomaticAssessmentConfigurationLibrary" && !TestRuntime.CheckXcodeVersion(11, 4)) { continue; } #endif #if __WATCHOS__ // added with watchOS 4 (mistake) if (fi.Name == "VisionLibrary") { continue; } #endif Assert.True(CheckLibrary(s), fi.Name); } else { Assert.Fail($"Unknown '{fi.Name}' field cannot be verified - please fix me!"); } break; } } }