mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Re-enable and fix gameplay sample playback test
This commit is contained in:
parent
3630aa30d4
commit
9eeac759b8
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics.Audio;
|
using osu.Framework.Graphics.Audio;
|
||||||
@ -17,7 +18,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public class TestSceneGameplaySamplePlayback : PlayerTestScene
|
public class TestSceneGameplaySamplePlayback : PlayerTestScene
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("temporarily disabled pending investigation")]
|
|
||||||
public void TestAllSamplesStopDuringSeek()
|
public void TestAllSamplesStopDuringSeek()
|
||||||
{
|
{
|
||||||
DrawableSlider slider = null;
|
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.
|
// 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.
|
// 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);
|
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));
|
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 bool Autoplay => true;
|
||||||
|
|
||||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||||
|
Loading…
Reference in New Issue
Block a user