2020-12-19 01:37:47 +08:00
|
|
|
// 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.
|
|
|
|
|
2021-02-16 09:51:21 +08:00
|
|
|
using System.Collections.Generic;
|
2020-12-19 01:37:47 +08:00
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
2021-08-16 14:06:56 +08:00
|
|
|
using osu.Framework.Extensions.ObjectExtensions;
|
2020-12-19 01:37:47 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Testing;
|
2020-12-22 17:25:45 +08:00
|
|
|
using osu.Framework.Utils;
|
2021-02-05 14:52:49 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2021-01-18 16:10:38 +08:00
|
|
|
using osu.Game.Online;
|
2021-11-04 17:02:44 +08:00
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2020-12-25 12:38:11 +08:00
|
|
|
using osu.Game.Online.Multiplayer;
|
2021-01-18 16:10:38 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2021-02-01 16:54:56 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
2020-12-25 23:50:00 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Participants;
|
2020-12-19 01:37:47 +08:00
|
|
|
using osu.Game.Users;
|
|
|
|
using osuTK;
|
|
|
|
|
2020-12-25 12:20:37 +08:00
|
|
|
namespace osu.Game.Tests.Visual.Multiplayer
|
2020-12-19 01:37:47 +08:00
|
|
|
{
|
2020-12-25 12:38:11 +08:00
|
|
|
public class TestSceneMultiplayerParticipantsList : MultiplayerTestScene
|
2020-12-19 01:37:47 +08:00
|
|
|
{
|
2021-06-25 19:56:13 +08:00
|
|
|
[SetUpSteps]
|
|
|
|
public void SetupSteps()
|
2021-06-25 19:44:00 +08:00
|
|
|
{
|
2021-06-25 19:56:13 +08:00
|
|
|
createNewParticipantsList();
|
2021-06-25 19:44:00 +08:00
|
|
|
}
|
|
|
|
|
2020-12-19 01:37:47 +08:00
|
|
|
[Test]
|
|
|
|
public void TestAddUser()
|
|
|
|
{
|
|
|
|
AddAssert("one unique panel", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 1);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("add user", () => MultiplayerClient.AddUser(new APIUser
|
2020-12-19 01:37:47 +08:00
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Username = "Second",
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
}));
|
|
|
|
|
|
|
|
AddAssert("two unique panels", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 2);
|
2020-12-28 13:56:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2021-11-02 15:51:27 +08:00
|
|
|
public void TestAddUnresolvedUser()
|
2020-12-28 13:56:53 +08:00
|
|
|
{
|
|
|
|
AddAssert("one unique panel", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 1);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("add non-resolvable user", () => MultiplayerClient.TestAddUnresolvedUser());
|
|
|
|
AddAssert("null user added", () => MultiplayerClient.Room.AsNonNull().Users.Count(u => u.User == null) == 1);
|
2020-12-28 13:56:53 +08:00
|
|
|
|
|
|
|
AddUntilStep("two unique panels", () => this.ChildrenOfType<ParticipantPanel>().Select(p => p.User).Distinct().Count() == 2);
|
2021-08-16 14:37:29 +08:00
|
|
|
|
|
|
|
AddStep("kick null user", () => this.ChildrenOfType<ParticipantPanel>().Single(p => p.User.User == null)
|
|
|
|
.ChildrenOfType<ParticipantPanel.KickButton>().Single().TriggerClick());
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddAssert("null user kicked", () => MultiplayerClient.Room.AsNonNull().Users.Count == 1);
|
2020-12-19 01:37:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestRemoveUser()
|
|
|
|
{
|
2021-11-04 17:02:44 +08:00
|
|
|
APIUser secondUser = null;
|
2020-12-19 01:37:47 +08:00
|
|
|
|
|
|
|
AddStep("add a user", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.AddUser(secondUser = new APIUser
|
2020-12-19 01:37:47 +08:00
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Username = "Second",
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("remove host", () => MultiplayerClient.RemoveUser(API.LocalUser.Value));
|
2020-12-19 01:37:47 +08:00
|
|
|
|
|
|
|
AddAssert("single panel is for second user", () => this.ChildrenOfType<ParticipantPanel>().Single().User.User == secondUser);
|
|
|
|
}
|
|
|
|
|
2021-02-05 14:58:27 +08:00
|
|
|
[Test]
|
|
|
|
public void TestGameStateHasPriorityOverDownloadState()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set to downloading map", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
2021-02-05 14:58:27 +08:00
|
|
|
checkProgressBarVisibility(true);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make user ready", () => MultiplayerClient.ChangeState(MultiplayerUserState.Results));
|
2021-02-05 14:58:27 +08:00
|
|
|
checkProgressBarVisibility(false);
|
|
|
|
AddUntilStep("ready mark visible", () => this.ChildrenOfType<StateDisplay>().Single().IsPresent);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make user ready", () => MultiplayerClient.ChangeState(MultiplayerUserState.Idle));
|
2021-02-05 14:58:27 +08:00
|
|
|
checkProgressBarVisibility(true);
|
|
|
|
}
|
|
|
|
|
2021-02-09 14:46:23 +08:00
|
|
|
[Test]
|
|
|
|
public void TestCorrectInitialState()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set to downloading map", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
2021-06-25 19:56:13 +08:00
|
|
|
createNewParticipantsList();
|
2021-02-09 14:46:23 +08:00
|
|
|
checkProgressBarVisibility(true);
|
|
|
|
}
|
|
|
|
|
2021-01-18 16:10:38 +08:00
|
|
|
[Test]
|
|
|
|
public void TestBeatmapDownloadingStates()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set to no map", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.NotDownloaded()));
|
|
|
|
AddStep("set to downloading map", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
2021-02-05 14:52:49 +08:00
|
|
|
|
2021-02-05 14:58:27 +08:00
|
|
|
checkProgressBarVisibility(true);
|
2021-02-05 14:52:49 +08:00
|
|
|
|
2021-01-18 16:10:38 +08:00
|
|
|
AddRepeatStep("increment progress", () =>
|
|
|
|
{
|
2021-10-27 12:04:41 +08:00
|
|
|
float progress = this.ChildrenOfType<ParticipantPanel>().Single().User.BeatmapAvailability.DownloadProgress ?? 0;
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(progress + RNG.NextSingle(0.1f)));
|
2021-01-18 16:10:38 +08:00
|
|
|
}, 25);
|
2021-02-05 14:52:49 +08:00
|
|
|
|
|
|
|
AddAssert("progress bar increased", () => this.ChildrenOfType<ProgressBar>().Single().Current.Value > 0);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set to importing map", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Importing()));
|
2021-02-05 14:58:27 +08:00
|
|
|
checkProgressBarVisibility(false);
|
2021-02-05 14:52:49 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set to available", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.LocallyAvailable()));
|
2021-01-18 16:10:38 +08:00
|
|
|
}
|
|
|
|
|
2020-12-19 01:37:47 +08:00
|
|
|
[Test]
|
|
|
|
public void TestToggleReadyState()
|
|
|
|
{
|
2020-12-22 17:25:45 +08:00
|
|
|
AddAssert("ready mark invisible", () => !this.ChildrenOfType<StateDisplay>().Single().IsPresent);
|
2020-12-19 01:37:47 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make user ready", () => MultiplayerClient.ChangeState(MultiplayerUserState.Ready));
|
2020-12-22 17:25:45 +08:00
|
|
|
AddUntilStep("ready mark visible", () => this.ChildrenOfType<StateDisplay>().Single().IsPresent);
|
2020-12-19 01:37:47 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make user idle", () => MultiplayerClient.ChangeState(MultiplayerUserState.Idle));
|
2020-12-22 17:25:45 +08:00
|
|
|
AddUntilStep("ready mark invisible", () => !this.ChildrenOfType<StateDisplay>().Single().IsPresent);
|
2020-12-19 01:37:47 +08:00
|
|
|
}
|
|
|
|
|
2021-04-07 15:40:24 +08:00
|
|
|
[Test]
|
|
|
|
public void TestToggleSpectateState()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make user spectating", () => MultiplayerClient.ChangeState(MultiplayerUserState.Spectating));
|
|
|
|
AddStep("make user idle", () => MultiplayerClient.ChangeState(MultiplayerUserState.Idle));
|
2021-04-07 15:40:24 +08:00
|
|
|
}
|
|
|
|
|
2020-12-19 01:37:47 +08:00
|
|
|
[Test]
|
|
|
|
public void TestCrownChangesStateWhenHostTransferred()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("add user", () => MultiplayerClient.AddUser(new APIUser
|
2020-12-19 01:37:47 +08:00
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Username = "Second",
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
}));
|
|
|
|
|
|
|
|
AddUntilStep("first user crown visible", () => this.ChildrenOfType<ParticipantPanel>().ElementAt(0).ChildrenOfType<SpriteIcon>().First().Alpha == 1);
|
|
|
|
AddUntilStep("second user crown hidden", () => this.ChildrenOfType<ParticipantPanel>().ElementAt(1).ChildrenOfType<SpriteIcon>().First().Alpha == 0);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make second user host", () => MultiplayerClient.TransferHost(3));
|
2020-12-19 01:37:47 +08:00
|
|
|
|
|
|
|
AddUntilStep("first user crown hidden", () => this.ChildrenOfType<ParticipantPanel>().ElementAt(0).ChildrenOfType<SpriteIcon>().First().Alpha == 0);
|
|
|
|
AddUntilStep("second user crown visible", () => this.ChildrenOfType<ParticipantPanel>().ElementAt(1).ChildrenOfType<SpriteIcon>().First().Alpha == 1);
|
|
|
|
}
|
2020-12-19 01:46:16 +08:00
|
|
|
|
2021-08-11 16:31:37 +08:00
|
|
|
[Test]
|
|
|
|
public void TestKickButtonOnlyPresentWhenHost()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("add user", () => MultiplayerClient.AddUser(new APIUser
|
2021-08-11 16:31:37 +08:00
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Username = "Second",
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
}));
|
|
|
|
|
2021-08-11 16:39:23 +08:00
|
|
|
AddUntilStep("kick buttons visible", () => this.ChildrenOfType<ParticipantPanel.KickButton>().Count(d => d.IsPresent) == 1);
|
2021-08-11 16:31:37 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make second user host", () => MultiplayerClient.TransferHost(3));
|
2021-08-11 16:31:37 +08:00
|
|
|
|
|
|
|
AddUntilStep("kick buttons not visible", () => this.ChildrenOfType<ParticipantPanel.KickButton>().Count(d => d.IsPresent) == 0);
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("make local user host again", () => MultiplayerClient.TransferHost(API.LocalUser.Value.Id));
|
2021-08-11 16:31:37 +08:00
|
|
|
|
2021-08-11 16:39:23 +08:00
|
|
|
AddUntilStep("kick buttons visible", () => this.ChildrenOfType<ParticipantPanel.KickButton>().Count(d => d.IsPresent) == 1);
|
2021-08-11 16:31:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestKickButtonKicks()
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("add user", () => MultiplayerClient.AddUser(new APIUser
|
2021-08-11 16:31:37 +08:00
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Username = "Second",
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
}));
|
|
|
|
|
2021-08-11 16:39:23 +08:00
|
|
|
AddStep("kick second user", () => this.ChildrenOfType<ParticipantPanel.KickButton>().Single(d => d.IsPresent).TriggerClick());
|
2021-08-11 16:31:37 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddAssert("second user kicked", () => MultiplayerClient.Room?.Users.Single().UserID == API.LocalUser.Value.Id);
|
2021-08-11 16:31:37 +08:00
|
|
|
}
|
|
|
|
|
2020-12-19 01:46:16 +08:00
|
|
|
[Test]
|
|
|
|
public void TestManyUsers()
|
|
|
|
{
|
|
|
|
AddStep("add many users", () =>
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 20; i++)
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.AddUser(new APIUser
|
2020-12-19 01:46:16 +08:00
|
|
|
{
|
|
|
|
Id = i,
|
|
|
|
Username = $"User {i}",
|
2021-02-16 09:51:21 +08:00
|
|
|
RulesetsStatistics = new Dictionary<string, UserStatistics>
|
2021-02-09 13:28:09 +08:00
|
|
|
{
|
2021-02-16 12:28:51 +08:00
|
|
|
{
|
|
|
|
Ruleset.Value.ShortName,
|
2021-02-17 13:50:48 +08:00
|
|
|
new UserStatistics { GlobalRank = RNG.Next(1, 100000), }
|
2021-02-16 12:28:51 +08:00
|
|
|
}
|
2021-02-09 13:28:09 +08:00
|
|
|
},
|
2020-12-19 01:46:16 +08:00
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
});
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserState(i, (MultiplayerUserState)RNG.Next(0, (int)MultiplayerUserState.Results + 1));
|
2021-01-18 16:10:38 +08:00
|
|
|
|
|
|
|
if (RNG.NextBool())
|
|
|
|
{
|
|
|
|
var beatmapState = (DownloadState)RNG.Next(0, (int)DownloadState.LocallyAvailable + 1);
|
|
|
|
|
|
|
|
switch (beatmapState)
|
|
|
|
{
|
|
|
|
case DownloadState.NotDownloaded:
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserBeatmapAvailability(i, BeatmapAvailability.NotDownloaded());
|
2021-01-18 16:10:38 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DownloadState.Downloading:
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserBeatmapAvailability(i, BeatmapAvailability.Downloading(RNG.NextSingle()));
|
2021-01-18 16:10:38 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DownloadState.Importing:
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserBeatmapAvailability(i, BeatmapAvailability.Importing());
|
2021-01-18 16:10:38 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-12-19 01:46:16 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-02-01 16:54:56 +08:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestUserWithMods()
|
|
|
|
{
|
|
|
|
AddStep("add user", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.AddUser(new APIUser
|
2021-02-01 16:54:56 +08:00
|
|
|
{
|
|
|
|
Id = 0,
|
2021-02-03 13:53:13 +08:00
|
|
|
Username = "User 0",
|
2021-02-16 09:51:21 +08:00
|
|
|
RulesetsStatistics = new Dictionary<string, UserStatistics>
|
2021-02-09 13:28:09 +08:00
|
|
|
{
|
2021-02-16 12:28:51 +08:00
|
|
|
{
|
|
|
|
Ruleset.Value.ShortName,
|
2021-02-17 13:50:48 +08:00
|
|
|
new UserStatistics { GlobalRank = RNG.Next(1, 100000), }
|
2021-02-16 12:28:51 +08:00
|
|
|
}
|
2021-02-09 13:28:09 +08:00
|
|
|
},
|
2021-02-01 16:54:56 +08:00
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
});
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserMods(0, new Mod[]
|
2021-02-01 16:54:56 +08:00
|
|
|
{
|
|
|
|
new OsuModHardRock(),
|
|
|
|
new OsuModDifficultyAdjust { ApproachRate = { Value = 1 } }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-02-01 17:25:09 +08:00
|
|
|
for (var i = MultiplayerUserState.Idle; i < MultiplayerUserState.Results; i++)
|
|
|
|
{
|
|
|
|
var state = i;
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep($"set state: {state}", () => MultiplayerClient.ChangeUserState(0, state));
|
2021-02-01 17:25:09 +08:00
|
|
|
}
|
2021-10-18 01:58:38 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set state: downloading", () => MultiplayerClient.ChangeUserBeatmapAvailability(0, BeatmapAvailability.Downloading(0)));
|
2021-10-18 01:58:38 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set state: locally available", () => MultiplayerClient.ChangeUserBeatmapAvailability(0, BeatmapAvailability.LocallyAvailable()));
|
2021-10-18 01:58:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestModOverlap()
|
|
|
|
{
|
|
|
|
AddStep("add dummy mods", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserMods(new Mod[]
|
2021-10-18 01:58:38 +08:00
|
|
|
{
|
|
|
|
new OsuModNoFail(),
|
|
|
|
new OsuModDoubleTime()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("add user with mods", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.AddUser(new APIUser
|
2021-10-18 01:58:38 +08:00
|
|
|
{
|
|
|
|
Id = 0,
|
|
|
|
Username = "Baka",
|
|
|
|
RulesetsStatistics = new Dictionary<string, UserStatistics>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Ruleset.Value.ShortName,
|
|
|
|
new UserStatistics { GlobalRank = RNG.Next(1, 100000), }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
|
|
|
|
});
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeUserMods(0, new Mod[]
|
2021-10-18 01:58:38 +08:00
|
|
|
{
|
|
|
|
new OsuModHardRock(),
|
|
|
|
new OsuModDoubleTime()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set 0 ready", () => MultiplayerClient.ChangeState(MultiplayerUserState.Ready));
|
2021-10-18 01:58:38 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set 1 spectate", () => MultiplayerClient.ChangeUserState(0, MultiplayerUserState.Spectating));
|
2021-10-18 01:58:38 +08:00
|
|
|
|
|
|
|
// Have to set back to idle due to status priority.
|
|
|
|
AddStep("set 0 no map, 1 ready", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeState(MultiplayerUserState.Idle);
|
|
|
|
MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.NotDownloaded());
|
|
|
|
MultiplayerClient.ChangeUserState(0, MultiplayerUserState.Ready);
|
2021-10-18 01:58:38 +08:00
|
|
|
});
|
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set 0 downloading", () => MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(0)));
|
2021-10-18 01:58:38 +08:00
|
|
|
|
2022-02-16 08:43:28 +08:00
|
|
|
AddStep("set 0 spectate", () => MultiplayerClient.ChangeUserState(0, MultiplayerUserState.Spectating));
|
2021-10-18 01:58:38 +08:00
|
|
|
|
|
|
|
AddStep("make both default", () =>
|
|
|
|
{
|
2022-02-16 08:43:28 +08:00
|
|
|
MultiplayerClient.ChangeBeatmapAvailability(BeatmapAvailability.LocallyAvailable());
|
|
|
|
MultiplayerClient.ChangeUserState(0, MultiplayerUserState.Idle);
|
|
|
|
MultiplayerClient.ChangeState(MultiplayerUserState.Idle);
|
2021-10-18 01:58:38 +08:00
|
|
|
});
|
2021-02-01 16:54:56 +08:00
|
|
|
}
|
2021-02-05 14:58:27 +08:00
|
|
|
|
2021-02-09 14:46:23 +08:00
|
|
|
private void createNewParticipantsList()
|
|
|
|
{
|
2021-06-25 19:56:13 +08:00
|
|
|
ParticipantsList participantsList = null;
|
|
|
|
|
|
|
|
AddStep("create new list", () => Child = participantsList = new ParticipantsList
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Size = new Vector2(380, 0.7f)
|
|
|
|
});
|
|
|
|
|
|
|
|
AddUntilStep("wait for list to load", () => participantsList.IsLoaded);
|
2021-02-09 14:46:23 +08:00
|
|
|
}
|
|
|
|
|
2021-02-05 14:58:27 +08:00
|
|
|
private void checkProgressBarVisibility(bool visible) =>
|
|
|
|
AddUntilStep($"progress bar {(visible ? "is" : "is not")}visible", () =>
|
|
|
|
this.ChildrenOfType<ProgressBar>().Single().IsPresent == visible);
|
2020-12-19 01:37:47 +08:00
|
|
|
}
|
|
|
|
}
|