Centralise screen exit logic to ScreenTestScene

This commit is contained in:
Dean Herbert
2020-01-31 13:54:26 +09:00
parent d5b9df049b
commit 5f48affcba
11 changed files with 76 additions and 47 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
@ -27,11 +28,24 @@ namespace osu.Game.Tests.Visual
});
}
protected void LoadScreen(OsuScreen screen)
protected void LoadScreen(OsuScreen screen) => Stack.Push(screen);
[SetUpSteps]
public virtual void SetUpSteps() => addExitAllScreensStep();
// pending framework update.
//[TearDownSteps]
//public void TearDownSteps() => addExitAllScreensStep();
private void addExitAllScreensStep()
{
if (Stack.CurrentScreen != null)
AddUntilStep("exit all screens", () =>
{
if (Stack.CurrentScreen == null) return true;
Stack.Exit();
Stack.Push(screen);
return false;
});
}
}
}