Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        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");
            }
        }
Exemplo n.º 3
0
 public void SetUp()
 {
     TestRuntime.AssertXcodeVersion(12, TestRuntime.MinorXcode12APIMismatch);
     TestRuntime.AssertNotSimulator("https://github.com/xamarin/maccore/issues/2271");
 }