mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Fix PushAndConfirm
potentially failing if new screen quickly pushes a child screen
This commit is contained in:
parent
8ffaa491e7
commit
90fdaf18c0
@ -83,8 +83,17 @@ namespace osu.Game.Tests.Visual
|
||||
protected void PushAndConfirm(Func<Screen> newScreen)
|
||||
{
|
||||
Screen screen = null;
|
||||
AddStep("Push new screen", () => Game.ScreenStack.Push(screen = newScreen()));
|
||||
AddUntilStep("Wait for new screen", () => Game.ScreenStack.CurrentScreen == screen && screen.IsLoaded);
|
||||
IScreen previousScreen = null;
|
||||
|
||||
AddStep("Push new screen", () =>
|
||||
{
|
||||
previousScreen = Game.ScreenStack.CurrentScreen;
|
||||
Game.ScreenStack.Push(screen = newScreen());
|
||||
});
|
||||
|
||||
AddUntilStep("Wait for new screen", () => screen.IsLoaded
|
||||
&& Game.ScreenStack.CurrentScreen != previousScreen
|
||||
&& previousScreen.GetChildScreen() == screen);
|
||||
}
|
||||
|
||||
protected void ConfirmAtMainMenu() => AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
||||
|
Loading…
Reference in New Issue
Block a user