1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-15 06:22:34 +08:00
Files
osu-lazer/osu.Game.Tests/Visual/Matchmaking/TestScenePlayerPanel.cs
T
2025-09-24 14:28:04 +09:00

96 lines
3.0 KiB
C#

// 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 NUnit.Framework;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.Matchmaking;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking;
using osu.Game.Tests.Visual.Multiplayer;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Matchmaking
{
public partial class TestScenePlayerPanel : MultiplayerTestScene
{
private PlayerPanel panel = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.Matchmaking)));
WaitForJoined();
AddStep("add panel", () => Child = panel = new PlayerPanel(new MultiplayerRoomUser(1)
{
User = new APIUser
{
Username = @"peppy",
Id = 2,
Colour = "99EB47",
CountryCode = CountryCode.AU,
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
Statistics = new UserStatistics { GlobalRank = null, CountryRank = null }
}
})
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
[Test]
public void TestIncreasePlacement()
{
int rank = 0;
AddStep("increase placement", () => MultiplayerClient.ChangeMatchRoomState(new MatchmakingRoomState
{
Users =
{
UserDictionary =
{
{
2, new MatchmakingUser
{
UserId = 2,
Placement = ++rank
}
}
}
}
}).WaitSafely());
AddToggleStep("toggle horizontal", h => panel.Horizontal = h);
}
[Test]
public void TestIncreasePoints()
{
int points = 0;
AddStep("increase points", () => MultiplayerClient.ChangeMatchRoomState(new MatchmakingRoomState
{
Users =
{
UserDictionary =
{
{
1, new MatchmakingUser
{
UserId = 1,
Placement = 1,
Points = ++points
}
}
}
}
}).WaitSafely());
}
}
}