diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs index f0d39a8b18..5bb3851264 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplaySamplePlayback.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Audio; @@ -17,7 +18,6 @@ namespace osu.Game.Tests.Visual.Gameplay public class TestSceneGameplaySamplePlayback : PlayerTestScene { [Test] - [Ignore("temporarily disabled pending investigation")] public void TestAllSamplesStopDuringSeek() { DrawableSlider slider = null; @@ -47,7 +47,8 @@ namespace osu.Game.Tests.Visual.Gameplay // because we are in frame stable context, it's quite likely that not all samples are "played" at this point. // the important thing is that at least one started, and that sample has since stopped. - AddAssert("no samples are playing", () => Player.ChildrenOfType().All(s => !s.IsPlaying)); + AddAssert("all looping samples stopped immediately", () => allStopped(allLoopingSounds)); + AddUntilStep("all samples stopped eventually", () => allStopped(allSounds)); AddAssert("sample playback still disabled", () => gameplayClock.SamplePlaybackDisabled.Value); @@ -55,6 +56,11 @@ namespace osu.Game.Tests.Visual.Gameplay AddUntilStep("any sample is playing", () => Player.ChildrenOfType().Any(s => s.IsPlaying)); } + private IEnumerable allSounds => Player.ChildrenOfType(); + private IEnumerable allLoopingSounds => allSounds.Where(sound => sound.Looping); + + private bool allStopped(IEnumerable sounds) => sounds.All(sound => !sound.IsPlaying); + protected override bool Autoplay => true; protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();