Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[appkit] Fix introspection tests for NSAccessibility on macOS 10.9 #10016

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AppKit/NSAccessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ public enum NSAccessibilityPriorityLevel : long
High = 90
}

#if !COREBUILD
[Mac (10,10)] // protocol added in 10.10
public partial interface INSAccessibility {}

[Mac (10,9)] // but the field/notifications are in 10.9
public partial class NSAccessibility
{
#if !COREBUILD
[Mac (10,10)]
[DllImport (Constants.AppKitLibrary)]
static extern CGRect NSAccessibilityFrameInView (NSView parentView, CGRect frame);
Expand Down Expand Up @@ -229,6 +229,6 @@ public static bool SetMayContainProtectedContent (bool flag)
{
return NSAccessibilitySetMayContainProtectedContent (flag);
}
}
#endif
}
}
26 changes: 26 additions & 0 deletions src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23917,18 +23917,22 @@ interface NSAccessibility
[NullAllowed, Export ("accessibilityVerticalUnitDescription")]
string AccessibilityVerticalUnitDescription { get; set; }

[Mac (10,10)]
[Abstract]
[Export ("accessibilityLayoutPointForScreenPoint:")]
CGPoint GetAccessibilityLayoutForScreen (CGPoint point);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityLayoutSizeForScreenSize:")]
CGSize GetAccessibilityLayoutForScreen (CGSize size);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityScreenPointForLayoutPoint:")]
CGPoint GetAccessibilityScreenForLayout (CGPoint point);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityScreenSizeForLayoutSize:")]
CGSize GetAccessibilityScreenForLayout (CGSize size);
Expand Down Expand Up @@ -24123,6 +24127,7 @@ interface NSAccessibility
[NullAllowed, Export ("accessibilityColumnHeaderUIElements", ArgumentSemantic.Copy)]
NSObject[] AccessibilityColumnHeaderUIElements { get; set; }

[Mac (10,10)]
[Abstract]
[Export ("accessibilityCellForColumn:row:")]
[return: NullAllowed]
Expand Down Expand Up @@ -24178,41 +24183,50 @@ interface NSAccessibility
[NullAllowed, Export ("accessibilitySelectedTextRanges", ArgumentSemantic.Copy)]
NSValue[] AccessibilitySelectedTextRanges { get; set; }

[Mac (10,10)]
[Abstract]
[Export ("accessibilityAttributedStringForRange:")]
[return: NullAllowed]
NSAttributedString GetAccessibilityAttributedString (NSRange range);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityRangeForLine:")]
NSRange GetAccessibilityRangeForLine (nint line);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityStringForRange:")]
[return: NullAllowed]
string GetAccessibilityString (NSRange range);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityRangeForPosition:")]
NSRange GetAccessibilityRange (CGPoint point);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityRangeForIndex:")]
NSRange GetAccessibilityRange (nint index);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityFrameForRange:")]
CGRect GetAccessibilityFrame (NSRange range);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityRTFForRange:")]
[return: NullAllowed]
NSData GetAccessibilityRtf (NSRange range);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityStyleRangeForIndex:")]
NSRange GetAccessibilityStyleRange (nint index);

[Mac (10,10)]
[Abstract]
[Export ("accessibilityLineForIndex:")]
nint GetAccessibilityLine (nint index);
Expand Down Expand Up @@ -24277,50 +24291,62 @@ interface NSAccessibility
[Export ("accessibilityMinimized")]
bool AccessibilityMinimized { [Bind ("isAccessibilityMinimized")] get; set; }

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformCancel")]
bool AccessibilityPerformCancel ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformConfirm")]
bool AccessibilityPerformConfirm ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformDecrement")]
bool AccessibilityPerformDecrement ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformDelete")]
bool AccessibilityPerformDelete ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformIncrement")]
bool AccessibilityPerformIncrement ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformPick")]
bool AccessibilityPerformPick ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformPress")]
bool AccessibilityPerformPress ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformRaise")]
bool AccessibilityPerformRaise ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformShowAlternateUI")]
bool AccessibilityPerformShowAlternateUI ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformShowDefaultUI")]
bool AccessibilityPerformShowDefaultUI ();

[Mac (10, 10)]
[Abstract]
[Export ("accessibilityPerformShowMenu")]
bool AccessibilityPerformShowMenu ();

[Mac (10,10)]
[Abstract]
[Export ("isAccessibilitySelectorAllowed:")]
bool IsAccessibilitySelectorAllowed (Selector selector);
Expand Down
11 changes: 10 additions & 1 deletion tests/introspection/ApiAvailabilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,16 @@ public void Introduced ()

// Duplicate checks, e.g. same attribute on member and type (extranous metadata)
if (ma.Version == ta.Version) {
AddErrorLine ($"[FAIL] {ma.Version} ({m}) == {ta.Version} ({t})");
switch (t.FullName) {
case "AppKit.INSAccessibility":
// special case for [I]NSAccessibility type (10.9) / protocol (10.10) mix up
// https://github.com/xamarin/xamarin-macios/issues/10009
// better some dupes than being inaccurate when protocol members are inlined
break;
default:
AddErrorLine ($"[FAIL] {ma.Version} ({m}) == {ta.Version} ({t})");
break;
}
}
// Consistency checks, e.g. member lower than type
// note: that's valid in some cases, like a new base type being introduced
Expand Down