mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
rename test scene and create a new game each test
This commit is contained in:
parent
82fcb88f5c
commit
98bb6da975
@ -20,49 +20,37 @@ using osuTK.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
{
|
{
|
||||||
public class TestSceneExitingScreens : ManualInputManagerTestScene
|
public class TestSceneScreenNavigation : ManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private readonly TestOsuGame osuGame = new TestOsuGame();
|
private GameHost gameHost;
|
||||||
|
private TestOsuGame osuGame;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost gameHost)
|
private void load(GameHost gameHost)
|
||||||
{
|
{
|
||||||
osuGame.SetHost(gameHost);
|
this.gameHost = gameHost;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Child = new Box
|
||||||
{
|
{
|
||||||
new Box
|
RelativeSizeAxes = Axes.Both,
|
||||||
{
|
Colour = Color4.Black,
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
},
|
|
||||||
osuGame
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
AddUntilStep("wait for load", () => osuGame.IsLoaded);
|
AddStep("Create new game instance", () =>
|
||||||
AddUntilStep("exit to main menu", () =>
|
|
||||||
{
|
{
|
||||||
var current = osuGame.ScreenStack.CurrentScreen;
|
if (osuGame != null)
|
||||||
|
Remove(osuGame);
|
||||||
|
|
||||||
switch (current)
|
osuGame = new TestOsuGame();
|
||||||
{
|
osuGame.SetHost(gameHost);
|
||||||
case null:
|
|
||||||
case IntroScreen _:
|
|
||||||
case Disclaimer _:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case MainMenu _:
|
Add(osuGame);
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
current.Exit();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
AddUntilStep("wait for load and menu is current", () => osuGame.IsLoaded && osuGame.ScreenStack.CurrentScreen is MainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
Loading…
Reference in New Issue
Block a user