Skip to content

Commit

Permalink
[introspection] Fix a few issues found on iPad Air 2 with iOS 12. (#5034
Browse files Browse the repository at this point in the history
)

* [introspection] MPSCnnBinaryKernel's kernelHeight/kernelWidth are missing on iOS too.

* [introspection] CoreNFC is not even available on all devices.
  • Loading branch information
rolfbjarne authored and Martin Baulig committed Oct 29, 2018
1 parent 374898a commit de197e3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
9 changes: 9 additions & 0 deletions tests/introspection/ApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,15 @@ protected virtual bool Skip (Type type, string selectorName)
return true;
}
break;
case "MPSCnnBinaryKernel":
switch (selectorName) {
// Xcode 9.4 removed both selectors from MPSCnnBinaryKernel, reported radar https://trello.com/c/7EAM0qk1
// but apple says this was intentional.
case "kernelHeight":
case "kernelWidth":
return true;
}
break;
}

// old binding mistake
Expand Down
9 changes: 0 additions & 9 deletions tests/introspection/Mac/MacApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,6 @@ protected override bool Skip (Type type, string selectorName)
case "readingOptionsForType:pasteboard:":
case "writingOptionsForType:pasteboard:":
return true; // Optional selectors on NSPasteboardReading/NSPasteboardWriting
// Xcode 9.4 removed both selectors from MPSCnnBinaryKernel, reported radar https://trello.com/c/7EAM0qk1
// but apple says this was intentional.
case "kernelHeight":
case "kernelWidth":
switch (type.Name) {
case "MPSCnnBinaryKernel":
return true;
}
break;
case "newWindowForTab:": // "This method can be implemented in the responder chain", optional but not protocol directly on NSResponder
switch (type.Name) {
case "NSViewController":
Expand Down
5 changes: 4 additions & 1 deletion tests/introspection/iOS/iOSApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ protected override bool Skip (Type type)
return true;
break;
#endif // !__WATCHOS__
case "CoreNFC": // Only available on device
case "CoreNFC": // Only available on devices that support NFC, so check if NFCNDEFReaderSession is present.
if (Class.GetHandle ("NFCNDEFReaderSession") == IntPtr.Zero)
return true;
break;
case "DeviceCheck": // Only available on device
if (Runtime.Arch == Arch.SIMULATOR)
return true;
Expand Down
10 changes: 8 additions & 2 deletions tests/introspection/iOS/iOSApiFieldTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ protected override bool Skip (PropertyInfo p)
case "MonoTouch.MetalKit":
case "MetalPerformanceShaders":
case "MonoTouch.MetalPerformanceShaders":
case "CoreNFC": // Only available on device
case "CoreNFC": // Only available on devices that support NFC, so check if NFCNDEFReaderSession is present.
if (Class.GetHandle ("NFCNDEFReaderSession") == IntPtr.Zero)
return true;
break;
case "DeviceCheck": // Only available on device
if (Runtime.Arch == Arch.SIMULATOR)
return true;
Expand Down Expand Up @@ -108,6 +111,10 @@ protected override bool Skip (PropertyInfo p)
protected override bool Skip (string constantName, string libraryName)
{
switch (libraryName) {
case "CoreNFC": // Only available on devices that support NFC, so check if NFCNDEFReaderSession is present.
if (Class.GetHandle ("NFCNDEFReaderSession") == IntPtr.Zero)
return true;
break;
case "IOSurface":
return Runtime.Arch == Arch.SIMULATOR && !TestRuntime.CheckXcodeVersion (9, 0);
}
Expand Down Expand Up @@ -141,7 +148,6 @@ protected override bool Skip (string constantName, string libraryName)
case "MTKTextureLoaderOptionTextureCPUCacheMode":
case "MTKModelErrorDomain":
case "MTKModelErrorKey":
case "NFCISO15693TagResponseErrorKey": // Not in simulator since no NFC on it
return Runtime.Arch == Arch.SIMULATOR;
default:
return false;
Expand Down
4 changes: 4 additions & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ protected override bool Skip (Type type)
if (Runtime.Arch == Arch.SIMULATOR)
return true;
break;
case "CoreNFC": // Only available on devices that support NFC, so check if NFCNDEFReaderSession is present.
if (Class.GetHandle ("NFCNDEFReaderSession") == IntPtr.Zero)
return true;
break;
}

switch (type.Name) {
Expand Down
5 changes: 4 additions & 1 deletion tests/introspection/iOS/iOSApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ protected override bool Skip (Type type)
return true;
break;
// Xcode 9
case "CoreNFC":
case "CoreNFC": // Only available on devices that support NFC, so check if NFCNDEFReaderSession is present.
if (Class.GetHandle ("NFCNDEFReaderSession") == IntPtr.Zero)
return true;
break;
case "DeviceCheck":
if (Runtime.Arch == Arch.SIMULATOR)
return true;
Expand Down

0 comments on commit de197e3

Please sign in to comment.