mirror of
https://github.com/ppy/osu
synced 2025-01-19 12:30:50 +00:00
Add tests for creating/joining/parting multiplayer rooms
This commit is contained in:
parent
e84ce80d6c
commit
109e6b4283
@ -90,6 +90,52 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
|
|||||||
AddAssert("initial rooms not received", () => !roomManager.InitialRoomsReceived.Value);
|
AddAssert("initial rooms not received", () => !roomManager.InitialRoomsReceived.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiplayerRoomJoinedWhenCreated()
|
||||||
|
{
|
||||||
|
AddStep("create room manager with a room", () =>
|
||||||
|
{
|
||||||
|
createRoomManager().With(d => d.OnLoadComplete += _ =>
|
||||||
|
{
|
||||||
|
roomManager.CreateRoom(new Room());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("multiplayer room joined", () => roomContainer.Client.Room != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiplayerRoomPartedWhenAPIRoomParted()
|
||||||
|
{
|
||||||
|
AddStep("create room manager with a room", () =>
|
||||||
|
{
|
||||||
|
createRoomManager().With(d => d.OnLoadComplete += _ =>
|
||||||
|
{
|
||||||
|
roomManager.CreateRoom(new Room());
|
||||||
|
roomManager.PartRoom();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("multiplayer room parted", () => roomContainer.Client.Room == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMultiplayerRoomPartedWhenAPIRoomJoined()
|
||||||
|
{
|
||||||
|
AddStep("create room manager with a room", () =>
|
||||||
|
{
|
||||||
|
createRoomManager().With(d => d.OnLoadComplete += _ =>
|
||||||
|
{
|
||||||
|
var r = new Room();
|
||||||
|
roomManager.CreateRoom(r);
|
||||||
|
roomManager.PartRoom();
|
||||||
|
roomManager.JoinRoom(r);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("multiplayer room parted", () => roomContainer.Client.Room != null);
|
||||||
|
}
|
||||||
|
|
||||||
private TestRealtimeRoomManager createRoomManager()
|
private TestRealtimeRoomManager createRoomManager()
|
||||||
{
|
{
|
||||||
Child = roomContainer = new TestRealtimeRoomContainer
|
Child = roomContainer = new TestRealtimeRoomContainer
|
||||||
|
Loading…
Reference in New Issue
Block a user