Skip to content

Commit

Permalink
[introspection] Fix according to macOS 12.4. Fixes xamarin#15229. (xa…
Browse files Browse the repository at this point in the history
…marin#15230)

* Ignore anything Chip-related, the framework was removed from macOS.
* Fix reporting errors some protocol-related errors so that they're actually
  reported as errors (by calling 'ReportError' instead of just adding the
  errors to a list that doesn't affect anything else).
* Ignore the NSUserActivityRestoring protocol, according to the macOS headers
  it's attached to NSResponder using a category, which is invisible at
  runtime. Due to the previous point this didn't show up before, but once at
  least another error (which happened with the Chip framework), then this was
  listed as well.
* Add ignores for a couple of protocols.

Fixes xamarin#15229.
  • Loading branch information
rolfbjarne committed Jun 16, 2022
1 parent ac427be commit 09efc7d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
22 changes: 21 additions & 1 deletion tests/introspection/ApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,26 @@ protected virtual bool Skip (Type type, string protocolName)
if (!TestRuntime.CheckXcodeVersion (11,0))
return true;
break;
case "VNRecognizedText":
// Conformance added in Xcode 13
if (!TestRuntime.CheckXcodeVersion (13, 0))
return true;
break;
}
break;
case "NSUserActivityRestoring":
return true;
#if __MACCATALYST__
case "UIScrollViewDelegate":
// The headers say PKCanvasViewDelegate implements UIScrollViewDelegate
if (type.Name == "PKCanvasViewDelegate")
return true;
break;
#endif
case "NSExtensionRequestHandling":
if (type.Name == "HMChipServiceRequestHandler") // Apple removed this class
return true;
break;
}
return false;
}
Expand Down Expand Up @@ -714,7 +732,9 @@ public void GeneralCase ()

if (t.IsPublic && !ConformTo (klass.Handle, protocol)) {
// note: some internal types, e.g. like UIAppearance subclasses, return false (and there's not much value in changing this)
list.Add ($"Type {t.FullName} (native: {klass.Name}) does not conform {protocolName}");
var msg = $"Type {t.FullName} (native: {klass.Name}) does not conform {protocolName}";
list.Add (msg);
ReportError (msg);
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion tests/introspection/Mac/MacApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@
namespace Introspection {

[TestFixture]
public class MonoMacFixtures : ApiProtocolTest {
public class MacApiProtocolTest : ApiProtocolTest {

protected override bool Skip (Type type)
{
#if !NET
switch (type.Namespace) {
case "Chip":
// The Chip framework is not stable, it's been added and removed and added and removed a few times already, so just skip verifying the entire framework.
// This is legacy Xamarin only, because we removed the framework for .NET.
return true;
}
#endif

switch (type.Name) {
#if !NET
case "NSDraggingInfo":
Expand Down
6 changes: 6 additions & 0 deletions tests/introspection/Mac/MacApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ protected override bool Skip (Type type)
if (Mac.CheckSystemVersion (10, 15))
return true;
break;
#if !NET
case "Chip":
// The Chip framework is not stable, it's been added and removed and added and removed a few times already, so just skip verifying the entire framework.
// This is legacy Xamarin only, because we removed the framework for .NET.
return true;
#endif
}

return base.Skip (type);
Expand Down
1 change: 1 addition & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ protected override bool Skip (Type type, string protocolName)
case "UIStepper":
case "UISwitch":
case "ASAuthorizationAppleIdButton":
case "INUIAddVoiceShortcutButton":
if (protocolName == "UIContextMenuInteractionDelegate")
return !TestRuntime.CheckXcodeVersion (12, 0);
break;
Expand Down

0 comments on commit 09efc7d

Please sign in to comment.