[tests] Use the correct OS version for Mac Catalyst. (#14143)

This fixes the CheckManagedFilters tests on Mac Catalyst on older macOS versions:

    [FAIL] CheckManagedFilters :   Managed filters not found for CIAreaMinMax, CIAreaMinMaxRed, CIAttributedTextImageGenerator, CIBarcodeGenerator, CIBicubicScaleTransform, CIBlendWithBlueMask, CIBlendWithRedMask, CIBokehBlur, CICameraCalibrationLensCorrection, CIColorCubesMixedWithMask, CIColorCurves, CICoreMLModelFilter, CIDepthBlurEffect, CIDepthToDisparity, CIDisparityToDepth, CIDither, CIDocumentEnhancer, CIEdgePreserveUpsampleFilter, CIGaborGradients, CIGuidedFilter, CIKeystoneCorrectionCombined, CIKeystoneCorrectionHorizontal, CIKeystoneCorrectionVertical, CIKMeans, CILabDeltaE, CIMeshGenerator, CIMix, CIMorphologyGradient, CIMorphologyMaximum, CIMorphologyMinimum, CIMorphologyRectangleMaximum, CIMorphologyRectangleMinimum, CIPaletteCentroid, CIPalettize, CIPerspectiveRotate, CIRoundedRectangleGenerator, CISaliencyMapFilter, CISampleNearest, CITextImageGenerator
      Expected: 0
      But was:  39
This commit is contained in:
Rolf Bjarne Kvinge 2022-02-16 20:11:57 +01:00 коммит произвёл GitHub
Родитель d8e5cce46e
Коммит 8060e2f6d3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 17 добавлений и 1 удалений

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

@ -31,7 +31,7 @@ namespace Xamarin.Tests
string version;
#if __MACCATALYST__
name = "MacCatalyst";
version = UIDevice.CurrentDevice.SystemVersion;
version = iOSSupportVersion;
#elif __TVOS__ || __IOS__
name = UIDevice.CurrentDevice.SystemName;
version = UIDevice.CurrentDevice.SystemVersion;
@ -92,6 +92,22 @@ namespace Xamarin.Tests
return platformInfo;
}
#if __MACCATALYST__
static string? _iOSSupportVersion;
internal static string iOSSupportVersion {
get {
if (_iOSSupportVersion is null) {
// This is how Apple does it: https://github.com/llvm/llvm-project/blob/62ec4ac90738a5f2d209ed28c822223e58aaaeb7/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm#L100-L105
using var dict = NSMutableDictionary.FromFile ("/System/Library/CoreServices/SystemVersion.plist");
using var str = (NSString) "iOSSupportVersion";
using var obj = dict.ObjectForKey (str);
_iOSSupportVersion = obj.ToString ();
}
return _iOSSupportVersion;
}
}
#endif
public static readonly PlatformInfo Host = GetHostPlatformInfo ();
#if NET