mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Merge branch 'fix-osu-game-test-scene' into update-framework
This commit is contained in:
commit
b399f910e4
@ -15,9 +15,6 @@ namespace osu.Game.Rulesets.EmptyFreeform.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, OsuGameBase gameBase)
|
private void load(GameHost host, OsuGameBase gameBase)
|
||||||
{
|
{
|
||||||
OsuGame game = new OsuGame();
|
|
||||||
game.SetHost(host);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -25,8 +22,9 @@ namespace osu.Game.Rulesets.EmptyFreeform.Tests
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
game
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddGame(new OsuGame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, OsuGameBase gameBase)
|
private void load(GameHost host, OsuGameBase gameBase)
|
||||||
{
|
{
|
||||||
OsuGame game = new OsuGame();
|
|
||||||
game.SetHost(host);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -25,8 +22,9 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
game
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddGame(new OsuGame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@ namespace osu.Game.Rulesets.EmptyScrolling.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, OsuGameBase gameBase)
|
private void load(GameHost host, OsuGameBase gameBase)
|
||||||
{
|
{
|
||||||
OsuGame game = new OsuGame();
|
|
||||||
game.SetHost(host);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -25,8 +22,9 @@ namespace osu.Game.Rulesets.EmptyScrolling.Tests
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
game
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddGame(new OsuGame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, OsuGameBase gameBase)
|
private void load(GameHost host, OsuGameBase gameBase)
|
||||||
{
|
{
|
||||||
OsuGame game = new OsuGame();
|
|
||||||
game.SetHost(host);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -25,8 +22,9 @@ namespace osu.Game.Rulesets.Pippidon.Tests
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
game
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddGame(new OsuGame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,9 +96,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
{
|
{
|
||||||
AddStep("create game", () =>
|
AddStep("create game", () =>
|
||||||
{
|
{
|
||||||
game = new OsuGame();
|
|
||||||
game.SetHost(host);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -106,8 +103,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
},
|
},
|
||||||
game
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddGame(game = new OsuGame());
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => game.IsLoaded);
|
AddUntilStep("wait for load", () => game.IsLoaded);
|
||||||
|
@ -77,7 +77,13 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
AddUntilStep("wait for player", () =>
|
||||||
|
{
|
||||||
|
// dismiss any notifications that may appear (ie. muted notification).
|
||||||
|
clickMouseInCentre();
|
||||||
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
|
});
|
||||||
|
|
||||||
AddAssert("retry count is 0", () => player.RestartCount == 0);
|
AddAssert("retry count is 0", () => player.RestartCount == 0);
|
||||||
|
|
||||||
AddStep("attempt to retry", () => player.ChildrenOfType<HotkeyRetryOverlay>().First().Action());
|
AddStep("attempt to retry", () => player.ChildrenOfType<HotkeyRetryOverlay>().First().Action());
|
||||||
@ -104,7 +110,14 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddStep("set mods", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModDoubleTime { SpeedChange = { Value = 2 } } });
|
AddStep("set mods", () => Game.SelectedMods.Value = new Mod[] { new OsuModNoFail(), new OsuModDoubleTime { SpeedChange = { Value = 2 } } });
|
||||||
|
|
||||||
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
|
||||||
|
AddUntilStep("wait for player", () =>
|
||||||
|
{
|
||||||
|
// dismiss any notifications that may appear (ie. muted notification).
|
||||||
|
clickMouseInCentre();
|
||||||
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for track playing", () => beatmap().Track.IsRunning);
|
AddUntilStep("wait for track playing", () => beatmap().Track.IsRunning);
|
||||||
AddStep("seek to near end", () => player.ChildrenOfType<GameplayClockContainer>().First().Seek(beatmap().Beatmap.HitObjects[^1].StartTime - 1000));
|
AddStep("seek to near end", () => player.ChildrenOfType<GameplayClockContainer>().First().Seek(beatmap().Beatmap.HitObjects[^1].StartTime - 1000));
|
||||||
AddUntilStep("wait for pass", () => (results = Game.ScreenStack.CurrentScreen as ResultsScreen) != null && results.IsLoaded);
|
AddUntilStep("wait for pass", () => (results = Game.ScreenStack.CurrentScreen as ResultsScreen) != null && results.IsLoaded);
|
||||||
@ -131,7 +144,13 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
AddUntilStep("wait for player", () =>
|
||||||
|
{
|
||||||
|
// dismiss any notifications that may appear (ie. muted notification).
|
||||||
|
clickMouseInCentre();
|
||||||
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for fail", () => player.HasFailed);
|
AddUntilStep("wait for fail", () => player.HasFailed);
|
||||||
|
|
||||||
AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying);
|
AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying);
|
||||||
@ -399,7 +418,15 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
|
AddStep("Hold escape", () => InputManager.PressKey(Key.Escape));
|
||||||
AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroTriangles);
|
AddUntilStep("Wait for intro", () => Game.ScreenStack.CurrentScreen is IntroTriangles);
|
||||||
|
AddStep("Release escape", () => InputManager.ReleaseKey(Key.Escape));
|
||||||
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
|
AddUntilStep("Wait for game exit", () => Game.ScreenStack.CurrentScreen == null);
|
||||||
|
AddStep("test dispose doesn't crash", () => Game.Dispose());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clickMouseInCentre()
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushEscape() =>
|
private void pushEscape() =>
|
||||||
|
@ -30,8 +30,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class OsuGameTestScene : OsuManualInputManagerTestScene
|
public abstract class OsuGameTestScene : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private GameHost host;
|
|
||||||
|
|
||||||
protected TestOsuGame Game;
|
protected TestOsuGame Game;
|
||||||
|
|
||||||
protected override bool UseFreshStoragePerRun => true;
|
protected override bool UseFreshStoragePerRun => true;
|
||||||
@ -39,10 +37,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected override bool CreateNestedActionContainer => false;
|
protected override bool CreateNestedActionContainer => false;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host)
|
private void load()
|
||||||
{
|
{
|
||||||
this.host = host;
|
|
||||||
|
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -55,7 +51,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
AddStep("Create new game instance", () =>
|
AddStep("Create new game instance", () =>
|
||||||
{
|
{
|
||||||
if (Game != null)
|
if (Game?.Parent != null)
|
||||||
{
|
{
|
||||||
Remove(Game);
|
Remove(Game);
|
||||||
Game.Dispose();
|
Game.Dispose();
|
||||||
@ -81,10 +77,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected void CreateGame()
|
protected void CreateGame()
|
||||||
{
|
{
|
||||||
Game = new TestOsuGame(LocalStorage, API);
|
AddGame(Game = new TestOsuGame(LocalStorage, API));
|
||||||
Game.SetHost(host);
|
|
||||||
|
|
||||||
Add(Game);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void PushAndConfirm(Func<Screen> newScreen)
|
protected void PushAndConfirm(Func<Screen> newScreen)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user