Add missing null checks and avoid cross-test pollution

This commit is contained in:
Dean Herbert 2020-08-13 12:53:37 +09:00
parent 99bea6b8e9
commit 5b536aebe7
1 changed files with 5 additions and 3 deletions

View File

@ -49,6 +49,8 @@ public class TestScenePlayerLoader : OsuManualInputManagerTestScene
/// <param name="afterLoadAction">An action to run after container load.</param>
public void ResetPlayer(bool interactive, Action beforeLoadAction = null, Action afterLoadAction = null)
{
player = null;
audioManager.Volume.SetDefault();
InputManager.Clear();
@ -80,7 +82,7 @@ public void TestEarlyExit()
AddAssert("mod rate applied", () => Beatmap.Value.Track.Rate != 1);
AddStep("exit loader", () => loader.Exit());
AddUntilStep("wait for not current", () => !loader.IsCurrentScreen());
AddAssert("player did not load", () => !player.IsLoaded);
AddAssert("player did not load", () => player?.IsLoaded != true);
AddUntilStep("player disposed", () => loader.DisposalTask?.IsCompleted == true);
AddAssert("mod rate still applied", () => Beatmap.Value.Track.Rate != 1);
}
@ -94,7 +96,7 @@ public void TestBlockLoadViaMouseMovement()
AddUntilStep("wait for load ready", () =>
{
moveMouse();
return player.LoadState == LoadState.Ready;
return player?.LoadState == LoadState.Ready;
});
AddRepeatStep("move mouse", moveMouse, 20);
@ -222,7 +224,7 @@ private void addVolumeSteps(string volumeName, Action beforeLoad, Action afterLo
AddStep("reset notification lock", () => sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).Value = false);
AddStep("load player", () => ResetPlayer(false, beforeLoad, afterLoad));
AddUntilStep("wait for player", () => player.LoadState == LoadState.Ready);
AddUntilStep("wait for player", () => player?.LoadState == LoadState.Ready);
AddAssert("check for notification", () => container.NotificationOverlay.UnreadCount.Value == 1);
AddStep("click notification", () =>