mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +08:00
Fix seek ending too early in sample playback test
This commit is contained in:
parent
45f9d722a5
commit
88ec0cdbc7
@ -18,6 +18,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
protected override bool AllowBackwardsSeeks => true;
|
||||
|
||||
private bool seek;
|
||||
|
||||
[Test]
|
||||
public void TestAllSamplesStopDuringSeek()
|
||||
{
|
||||
@ -42,7 +44,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
if (!samples.Any(s => s.Playing))
|
||||
return false;
|
||||
|
||||
Player.ChildrenOfType<GameplayClockContainer>().First().Seek(40000);
|
||||
seek = true;
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -55,10 +57,27 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddAssert("sample playback still disabled", () => sampleDisabler.SamplePlaybackDisabled.Value);
|
||||
|
||||
AddStep("stop seeking", () => seek = false);
|
||||
|
||||
AddUntilStep("seek finished, sample playback enabled", () => !sampleDisabler.SamplePlaybackDisabled.Value);
|
||||
AddUntilStep("any sample is playing", () => Player.ChildrenOfType<PausableSkinnableSound>().Any(s => s.IsPlaying));
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (seek)
|
||||
{
|
||||
// Frame stable playback is too fast to catch up these days.
|
||||
//
|
||||
// We want to keep seeking while asserting various test conditions, so
|
||||
// continue to seek until we unset the flag.
|
||||
var gameplayClockContainer = Player.ChildrenOfType<GameplayClockContainer>().First();
|
||||
gameplayClockContainer.Seek(gameplayClockContainer.CurrentTime > 30000 ? 0 : 60000);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<PausableSkinnableSound> allSounds => Player.ChildrenOfType<PausableSkinnableSound>();
|
||||
private IEnumerable<PausableSkinnableSound> allLoopingSounds => allSounds.Where(sound => sound.Looping);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user