mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Improve implementation of TestSpectatorClient
There was a lot of weirdness here, such as storing the playing users, clearing the playing users from test scenes (!!), and storing the users being wathed. This was all a thing because the previous implementation overrode the base method implementations, which is no longer a thing.
This commit is contained in:
@ -19,6 +19,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneCurrentlyPlayingDisplay : OsuTestScene
|
||||
{
|
||||
private readonly User streamingUser = new User { Id = 2, Username = "Test user" };
|
||||
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestSpectatorClient testSpectatorClient = new TestSpectatorClient();
|
||||
|
||||
@ -55,15 +57,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
};
|
||||
});
|
||||
|
||||
AddStep("Reset players", () => testSpectatorClient.PlayingUsers.Clear());
|
||||
AddStep("Reset players", () => testSpectatorClient.EndPlay(streamingUser.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBasicDisplay()
|
||||
{
|
||||
AddStep("Add playing user", () => testSpectatorClient.PlayingUsers.Add(2));
|
||||
AddStep("Add playing user", () => testSpectatorClient.StartPlay(streamingUser.Id, 0));
|
||||
AddUntilStep("Panel loaded", () => currentlyPlaying.ChildrenOfType<UserGridPanel>()?.FirstOrDefault()?.User.Id == 2);
|
||||
AddStep("Remove playing user", () => testSpectatorClient.PlayingUsers.Remove(2));
|
||||
AddStep("Remove playing user", () => testSpectatorClient.EndPlay(streamingUser.Id));
|
||||
AddUntilStep("Panel no longer present", () => !currentlyPlaying.ChildrenOfType<UserGridPanel>().Any());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user