public void TestCallbackPlayAlert() { TestRuntime.AssertNotSimulator(); TestRuntime.AssertSystemVersion(ApplePlatform.iOS, 9, 0, throwIfOtherPlatform: false); string path = Path.Combine(NSBundle.MainBundle.ResourcePath, "drum01.mp3"); using (var ss = SystemSound.FromFile(NSUrl.FromFilename(path))) { var completed = false; const int timeout = 10; completed = false; Assert.IsTrue(TestRuntime.RunAsync(DateTime.Now.AddSeconds(timeout), async() => ss.PlayAlertSound(() => { completed = true; } ), () => completed), "TestCallbackPlayAlert"); } }
public void FromFile() { TestRuntime.AssertNotSimulator(); var path = NSBundle.MainBundle.PathForResource("1", "caf", "AudioToolbox"); using (var ss = SystemSound.FromFile(NSUrl.FromFilename(path))) { var completed = false; const int timeout = 10; Assert.AreEqual(AudioServicesError.None, ss.AddSystemSoundCompletion(delegate { completed = true; })); ss.PlaySystemSound(); Assert.IsTrue(TestRuntime.RunAsync(DateTime.Now.AddSeconds(timeout), async() => { }, () => completed), "PlaySystemSound"); } }
public void SetUp() { TestRuntime.AssertXcodeVersion(12, TestRuntime.MinorXcode12APIMismatch); TestRuntime.AssertNotSimulator("https://github.com/xamarin/maccore/issues/2271"); }