1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Add more comprehensive testing

This commit is contained in:
Dean Herbert 2019-03-18 14:57:06 +09:00
parent 9433a97747
commit 4f075f4740
2 changed files with 16 additions and 5 deletions

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
@ -26,7 +27,6 @@ namespace osu.Game.Tests.Visual
PausePlayer pausable() => (PausePlayer)player();
base.AddCheckSteps(player);
//AddUntilStep(() => pausable().ScoreProcessor.TotalScore.Value > 0, "score above zero");
AddStep("pause", () => pausable().Pause());
AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning);
@ -47,6 +47,17 @@ namespace osu.Game.Tests.Visual
AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible);
AddAssert("fail overlay still shown", () => pausable().FailOverlayVisible);
AddStep("restart", () => pausable().Restart());
AddUntilStep(() =>
{
pausable().Pause();
return pausable().PauseOverlayVisible;
}, "keep trying to pause");
AddStep("exit", () => pausable().Exit());
AddUntilStep(() => !pausable().IsCurrentScreen(), "player exited");
}
private class PausePlayer : Player

View File

@ -158,14 +158,14 @@ namespace osu.Game.Screens.Play
},
FailOverlay = new FailOverlay
{
OnRetry = restart,
OnRetry = Restart,
OnQuit = performUserRequestedExit,
},
PauseOverlay = new PauseOverlay
{
OnResume = Resume,
Retries = RestartCount,
OnRetry = restart,
OnRetry = Restart,
OnQuit = performUserRequestedExit,
},
new HotkeyRetryOverlay
@ -175,7 +175,7 @@ namespace osu.Game.Screens.Play
if (!this.IsCurrentScreen()) return;
fadeOut(true);
restart();
Restart();
},
}
};
@ -246,7 +246,7 @@ namespace osu.Game.Screens.Play
this.Exit();
}
private void restart()
public void Restart()
{
if (!this.IsCurrentScreen()) return;