[mediaaccessibility] Update for Xcode 11 beta 5 (#6733)
This commit is contained in:
Родитель
eb77564659
Коммит
193ae8bfdf
|
@ -262,6 +262,34 @@ namespace MediaAccessibility {
|
|||
behavior = (MACaptionAppearanceBehavior) (int) b;
|
||||
return (MACaptionAppearanceTextEdgeStyle) (int) rv;
|
||||
}
|
||||
|
||||
[TV (13,0), Mac (10,15), iOS (13,0)]
|
||||
[DllImport (Constants.MediaAccessibilityLibrary)]
|
||||
static extern void MACaptionAppearanceDidDisplayCaptions (IntPtr /* CFArratRef */ strings);
|
||||
|
||||
[TV (13,0), Mac (10,15), iOS (13,0)]
|
||||
public static void DidDisplayCaptions (string[] strings)
|
||||
{
|
||||
if ((strings == null) || (strings.Length == 0))
|
||||
MACaptionAppearanceDidDisplayCaptions (IntPtr.Zero);
|
||||
else {
|
||||
using (var array = NSArray.FromStrings (strings))
|
||||
MACaptionAppearanceDidDisplayCaptions (array.Handle);
|
||||
}
|
||||
}
|
||||
|
||||
[TV (13,0), Mac (10,15), iOS (13,0)]
|
||||
public static void DidDisplayCaptions (NSAttributedString[] strings)
|
||||
{
|
||||
// CFAttributedString is “toll-free bridged” with its Foundation counterpart, NSAttributedString.
|
||||
// https://developer.apple.com/documentation/corefoundation/cfattributedstring?language=objc
|
||||
if ((strings == null) || (strings.Length == 0))
|
||||
MACaptionAppearanceDidDisplayCaptions (IntPtr.Zero);
|
||||
else {
|
||||
using (var array = NSArray.FromNSObjects (strings))
|
||||
MACaptionAppearanceDidDisplayCaptions (array.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static partial class MAAudibleMedia {
|
||||
|
|
|
@ -51,6 +51,27 @@ namespace MonoTouchFixtures.MediaAccessibility {
|
|||
|
||||
Assert.That (MACaptionAppearance.GetDisplayType (MACaptionAppearanceDomain.Default), Is.EqualTo (MACaptionAppearanceDisplayType.Automatic).Or.EqualTo (MACaptionAppearanceDisplayType.AlwaysOn).Or.EqualTo (MACaptionAppearanceDisplayType.ForcedOnly), "Default");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DidDisplayCaptions ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (11,0);
|
||||
|
||||
// there's a known bug with UIPasteboard and NSAttributedString - and it makes our tests hang
|
||||
var nsa = new NSAttributedString [0];
|
||||
MACaptionAppearance.DidDisplayCaptions (nsa);
|
||||
nsa = new [] { new NSAttributedString ("Bonjour") };
|
||||
MACaptionAppearance.DidDisplayCaptions (nsa);
|
||||
nsa = null;
|
||||
MACaptionAppearance.DidDisplayCaptions (nsa);
|
||||
|
||||
var a = new string [0];
|
||||
MACaptionAppearance.DidDisplayCaptions (a);
|
||||
a = new [] { "Hello", "World" };
|
||||
MACaptionAppearance.DidDisplayCaptions (a);
|
||||
a = null;
|
||||
MACaptionAppearance.DidDisplayCaptions (a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
!missing-pinvoke! MACaptionAppearanceDidDisplayCaptions is not bound
|
|
@ -1 +0,0 @@
|
|||
!missing-pinvoke! MACaptionAppearanceDidDisplayCaptions is not bound
|
|
@ -1 +0,0 @@
|
|||
!missing-pinvoke! MACaptionAppearanceDidDisplayCaptions is not bound
|
Загрузка…
Ссылка в новой задаче