Fix crash on exiting song select with ctrl-enter autoplay

This commit is contained in:
Dean Herbert 2020-02-03 16:04:32 +09:00
parent c5422743e2
commit 9183c78319
2 changed files with 28 additions and 3 deletions

View File

@ -23,6 +23,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
@ -77,7 +78,6 @@ namespace osu.Game.Tests.Visual.SongSelect
private OsuConfigManager config;
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
@ -426,6 +426,31 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("start not requested", () => !startRequested);
}
[Test]
public void TestAutoplayViaCtrlEnter()
{
addRulesetImportStep(0);
createSongSelect();
AddStep("press ctrl+enter", () =>
{
InputManager.PressKey(Key.ControlLeft);
InputManager.PressKey(Key.Enter);
InputManager.ReleaseKey(Key.ControlLeft);
InputManager.ReleaseKey(Key.Enter);
});
AddUntilStep("wait for player", () => Stack.CurrentScreen is PlayerLoader);
AddAssert("autoplay enabled", () => songSelect.Mods.Value.FirstOrDefault() is ModAutoplay);
AddUntilStep("wait for return to ss", () => songSelect.IsCurrentScreen());
AddAssert("mod disabled", () => songSelect.Mods.Value.Count == 0);
}
[Test]
public void TestHideSetSelectsCorrectBeatmap()
{

View File

@ -33,6 +33,8 @@ namespace osu.Game.Screens.Select
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
player = null;
if (removeAutoModOnResume)
@ -41,8 +43,6 @@ namespace osu.Game.Screens.Select
ModSelect.DeselectTypes(new[] { autoType }, true);
removeAutoModOnResume = false;
}
base.OnResuming(last);
}
protected override bool OnStart()