mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Add full multiplayer gameplay flow test
This commit is contained in:
parent
8ff30ffd1d
commit
c2974cfc65
@ -9,6 +9,8 @@ namespace osu.Game.Tests.Resources
|
|||||||
{
|
{
|
||||||
public static class TestResources
|
public static class TestResources
|
||||||
{
|
{
|
||||||
|
public const double QUICK_BEATMAP_LENGTH = 10000;
|
||||||
|
|
||||||
public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly);
|
public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly);
|
||||||
|
|
||||||
public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}");
|
public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}");
|
||||||
|
@ -28,6 +28,8 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|||||||
using osu.Game.Screens.OnlinePlay.Match;
|
using osu.Game.Screens.OnlinePlay.Match;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -430,6 +432,40 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGameplayFlow()
|
||||||
|
{
|
||||||
|
createRoom(() => new Room
|
||||||
|
{
|
||||||
|
Name = { Value = "Test Room" },
|
||||||
|
Playlist =
|
||||||
|
{
|
||||||
|
new PlaylistItem
|
||||||
|
{
|
||||||
|
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo },
|
||||||
|
Ruleset = { Value = new OsuRuleset().RulesetInfo },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddRepeatStep("click spectate button", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(this.ChildrenOfType<MultiplayerReadyButton>().Single());
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
}, 2);
|
||||||
|
|
||||||
|
AddUntilStep("wait for player", () => Stack.CurrentScreen is Player);
|
||||||
|
|
||||||
|
// Gameplay runs in real-time, so we need to incrementally check if gameplay has finished in order to not time out.
|
||||||
|
for (double i = 1000; i < TestResources.QUICK_BEATMAP_LENGTH; i += 1000)
|
||||||
|
{
|
||||||
|
var time = i;
|
||||||
|
AddUntilStep($"wait for time > {i}", () => this.ChildrenOfType<GameplayClockContainer>().SingleOrDefault()?.GameplayClock.CurrentTime > time);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddUntilStep("wait for results", () => Stack.CurrentScreen is ResultsScreen);
|
||||||
|
}
|
||||||
|
|
||||||
private void createRoom(Func<Room> room)
|
private void createRoom(Func<Room> room)
|
||||||
{
|
{
|
||||||
AddUntilStep("wait for lounge", () => multiplayerScreen.ChildrenOfType<LoungeSubScreen>().SingleOrDefault()?.IsLoaded == true);
|
AddUntilStep("wait for lounge", () => multiplayerScreen.ChildrenOfType<LoungeSubScreen>().SingleOrDefault()?.IsLoaded == true);
|
||||||
|
Loading…
Reference in New Issue
Block a user