Pause playback in present tests to avoid track inadvertently changing at menu

This commit is contained in:
Dean Herbert 2020-09-15 20:17:59 +09:00
parent 71f32a2e37
commit e43e12cb2d
2 changed files with 14 additions and 0 deletions

View File

@ -74,6 +74,13 @@ public void TestFromSongSelectDifferentRuleset()
private void returnToMenu()
{
// if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track).
AddStep("pause audio", () =>
{
if (Game.MusicController.IsPlaying)
Game.MusicController.TogglePause();
});
AddStep("return to menu", () => Game.ScreenStack.CurrentScreen.Exit());
AddUntilStep("wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
}

View File

@ -110,6 +110,13 @@ public void TestFromSongSelectDifferentRuleset([Values] ScorePresentType type)
private void returnToMenu()
{
// if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track).
AddStep("pause audio", () =>
{
if (Game.MusicController.IsPlaying)
Game.MusicController.TogglePause();
});
AddStep("return to menu", () => Game.ScreenStack.CurrentScreen.Exit());
AddUntilStep("wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
}