mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add multiplayer lounge test coverage
This commit is contained in:
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
|
using osu.Game.Tests.Visual.OnlinePlay;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
|
{
|
||||||
|
public class TestSceneMultiplayerLoungeSubScreen : OnlinePlayTestScene
|
||||||
|
{
|
||||||
|
protected new BasicTestRoomManager RoomManager => (BasicTestRoomManager)base.RoomManager;
|
||||||
|
|
||||||
|
private LoungeSubScreen loungeScreen;
|
||||||
|
|
||||||
|
public override void SetUpSteps()
|
||||||
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
|
||||||
|
AddStep("push screen", () => LoadScreen(loungeScreen = new MultiplayerLoungeSubScreen()));
|
||||||
|
|
||||||
|
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestJoinRoomWithoutPassword()
|
||||||
|
{
|
||||||
|
AddStep("add room", () => RoomManager.AddRooms(1, withPassword: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestJoinRoomWithPassword()
|
||||||
|
{
|
||||||
|
AddStep("add room", () => RoomManager.AddRooms(1, withPassword: true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private RoomsContainer roomsContainer => loungeScreen.ChildrenOfType<RoomsContainer>().First();
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRooms(int count, RulesetInfo ruleset = null)
|
public void AddRooms(int count, RulesetInfo ruleset = null, bool withPassword = false)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
@ -53,7 +53,8 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
|||||||
Name = { Value = $"Room {i}" },
|
Name = { Value = $"Room {i}" },
|
||||||
Host = { Value = new User { Username = "Host" } },
|
Host = { Value = new User { Username = "Host" } },
|
||||||
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
|
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
|
||||||
Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal }
|
Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal },
|
||||||
|
Password = { Value = withPassword ? "password" : string.Empty }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ruleset != null)
|
if (ruleset != null)
|
||||||
|
Reference in New Issue
Block a user