mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 13:07:25 +08:00
Merge pull request #10377 from bdach/reenable-gameplay-sample-playback-test
Re-enable and fix gameplay sample playback test
This commit is contained in:
commit
798dc9bc25
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user