1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Re-enable and fix gameplay sample playback test

This commit is contained in:
Bartłomiej Dach 2020-10-05 21:22:07 +02:00
parent 3630aa30d4
commit 9eeac759b8

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<PausableSkinnableSound>().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<PausableSkinnableSound>().Any(s => s.IsPlaying));
}
private IEnumerable<PausableSkinnableSound> allSounds => Player.ChildrenOfType<PausableSkinnableSound>();
private IEnumerable<PausableSkinnableSound> allLoopingSounds => allSounds.Where(sound => sound.Looping);
private bool allStopped(IEnumerable<PausableSkinnableSound> sounds) => sounds.All(sound => !sound.IsPlaying);
protected override bool Autoplay => true;
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();