[mediaaccessibility] Update for Xcode 11 beta 5 (#6733)

This commit is contained in:
Sebastien Pouliot 2019-08-07 19:40:32 -04:00 коммит произвёл GitHub
Родитель eb77564659
Коммит 193ae8bfdf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 49 добавлений и 3 удалений

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

@ -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