Remove PausableGameplayContainer

This commit is contained in:
Dean Herbert
2019-03-18 11:48:11 +09:00
parent f13003c53b
commit 536b5e0dab
6 changed files with 183 additions and 209 deletions

View File

@ -188,10 +188,10 @@ namespace osu.Game.Tests.Visual
public void PauseTest()
{
performFullSetup(true);
AddStep("Pause", () => player.CurrentPausableGameplayContainer.Pause());
AddStep("Pause", () => player.Pause());
waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
AddStep("Unpause", () => player.CurrentPausableGameplayContainer.Resume());
AddStep("Unpause", () => player.Resume());
waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
}
@ -328,8 +328,6 @@ namespace osu.Game.Tests.Visual
};
}
public PausableGameplayContainer CurrentPausableGameplayContainer => PausableGameplayContainer;
public UserDimContainer CurrentStoryboardContainer => StoryboardContainer;
// Whether or not the player should be allowed to load.

View File

@ -17,15 +17,15 @@ namespace osu.Game.Tests.Visual
[Description("player pause/fail screens")]
public class TestCaseGameplayMenuOverlay : ManualInputManagerTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PausableGameplayContainer) };
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseOverlay) };
private FailOverlay failOverlay;
private PausableGameplayContainer.PauseOverlay pauseOverlay;
private PauseOverlay pauseOverlay;
[BackgroundDependencyLoader]
private void load()
{
Add(pauseOverlay = new PausableGameplayContainer.PauseOverlay
Add(pauseOverlay = new PauseOverlay
{
OnResume = () => Logger.Log(@"Resume"),
OnRetry = () => Logger.Log(@"Retry"),

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
@ -16,6 +17,8 @@ namespace osu.Game.Tests.Visual
{
}
protected override bool AllowFail => true;
protected override Player CreatePlayer(Ruleset ruleset) => new PausePlayer();
protected override void AddCheckSteps(Func<Player> player)
@ -25,23 +28,36 @@ namespace osu.Game.Tests.Visual
base.AddCheckSteps(player);
//AddUntilStep(() => pausable().ScoreProcessor.TotalScore.Value > 0, "score above zero");
AddStep("pause", () => pausable().PausableGameplayContainer.Pause());
AddStep("pause", () => pausable().Pause());
AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning);
AddAssert("pause overlay shown", () => pausable().PauseOverlayVisible);
AddStep("resume", () => pausable().PausableGameplayContainer.Resume());
AddUntilStep(() => pausable().GameplayClockContainer.GameplayClock.IsRunning, "clock started");
AddStep("resume", () => pausable().Resume());
AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible);
AddStep("pause too soon", () => pausable().PausableGameplayContainer.Pause());
AddStep("pause too soon", () => pausable().Pause());
AddAssert("clock not stopped", () => pausable().GameplayClockContainer.GameplayClock.IsRunning);
AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible);
AddUntilStep(() => pausable().HasFailed, "wait for fail");
AddAssert("fail overlay shown", () => pausable().FailOverlayVisible);
AddStep("try to pause", () => pausable().Pause());
AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible);
AddAssert("fail overlay still shown", () => pausable().FailOverlayVisible);
}
private class PausePlayer : Player
{
public new PausableGameplayContainer PausableGameplayContainer => base.PausableGameplayContainer;
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible;
public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible;
}
}
}