A game framework written with osu! in mind.
at master 45 lines 1.2 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using NUnit.Framework; 5 6namespace osu.Framework.Tests.Audio 7{ 8 [TestFixture] 9 public class DevicelessAudioTest : AudioThreadTest 10 { 11 public override void SetUp() 12 { 13 base.SetUp(); 14 15 // lose all devices 16 Manager.SimulateDeviceLoss(); 17 } 18 19 [Test] 20 public void TestPlayTrackWithoutDevices() 21 { 22 var track = Manager.Tracks.Get("Tracks.sample-track.mp3"); 23 24 // start track 25 track.Restart(); 26 27 WaitForOrAssert(() => track.IsRunning, "Track started", 1000); 28 29 CheckTrackIsProgressing(track); 30 31 // stop track 32 track.Stop(); 33 34 WaitForOrAssert(() => !track.IsRunning, "Track did not stop", 1000); 35 36 Assert.IsFalse(track.IsRunning); 37 38 // seek track 39 track.Seek(0); 40 41 Assert.IsFalse(track.IsRunning); 42 WaitForOrAssert(() => track.CurrentTime == 0, "Track did not seek correctly", 1000); 43 } 44 } 45}