mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Add test coverage
This commit is contained in:
parent
644c981673
commit
32d8ee2d0c
@ -81,6 +81,21 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("End watching user presence", () => metadataClient.EndWatchingUserPresence());
|
AddStep("End watching user presence", () => metadataClient.EndWatchingUserPresence());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUserWasPlayingBeforeWatchingUserPresence()
|
||||||
|
{
|
||||||
|
AddStep("User began playing", () => spectatorClient.SendStartPlay(streamingUser.Id, 0));
|
||||||
|
AddStep("Begin watching user presence", () => metadataClient.BeginWatchingUserPresence());
|
||||||
|
AddStep("Add online user", () => metadataClient.UserPresenceUpdated(streamingUser.Id, new UserPresence { Status = UserStatus.Online, Activity = new UserActivity.ChoosingBeatmap() }));
|
||||||
|
AddUntilStep("Panel loaded", () => currentlyOnline.ChildrenOfType<UserGridPanel>().FirstOrDefault()?.User.Id == 2);
|
||||||
|
AddAssert("Spectate button enabled", () => currentlyOnline.ChildrenOfType<PurpleRoundedButton>().First().Enabled.Value, () => Is.True);
|
||||||
|
|
||||||
|
AddStep("User finished playing", () => spectatorClient.SendEndPlay(streamingUser.Id));
|
||||||
|
AddAssert("Spectate button disabled", () => currentlyOnline.ChildrenOfType<PurpleRoundedButton>().First().Enabled.Value, () => Is.False);
|
||||||
|
AddStep("Remove playing user", () => metadataClient.UserPresenceUpdated(streamingUser.Id, null));
|
||||||
|
AddStep("End watching user presence", () => metadataClient.EndWatchingUserPresence());
|
||||||
|
}
|
||||||
|
|
||||||
internal partial class TestUserLookupCache : UserLookupCache
|
internal partial class TestUserLookupCache : UserLookupCache
|
||||||
{
|
{
|
||||||
private static readonly string[] usernames =
|
private static readonly string[] usernames =
|
||||||
|
Loading…
Reference in New Issue
Block a user