diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs
index 7848a825f4..6862cda88c 100644
--- a/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs
+++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorClient.cs
@@ -39,11 +39,7 @@ namespace osu.Game.Tests.Visual.Spectator
public TestSpectatorClient()
{
- OnNewFrames += (i, bundle) =>
- {
- if (PlayingUserStates.ContainsKey(i))
- lastReceivedUserFrames[i] = bundle.Frames[^1];
- };
+ OnNewFrames += (i, bundle) => lastReceivedUserFrames[i] = bundle.Frames[^1];
}
///
@@ -62,16 +58,20 @@ namespace osu.Game.Tests.Visual.Spectator
/// Ends play for an arbitrary user.
///
/// The user to end play for.
- public void EndPlay(int userId)
+ /// The spectator state to end play with.
+ public void EndPlay(int userId, SpectatingUserState state = SpectatingUserState.Quit)
{
- if (!PlayingUserStates.ContainsKey(userId))
+ if (!userBeatmapDictionary.ContainsKey(userId))
return;
((ISpectatorClient)this).UserFinishedPlaying(userId, new SpectatorState
{
BeatmapID = userBeatmapDictionary[userId],
RulesetID = 0,
+ State = state
});
+
+ userBeatmapDictionary.Remove(userId);
}
public new void Schedule(Action action) => base.Schedule(action);
@@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.Spectator
protected override Task WatchUserInternal(int userId)
{
// When newly watching a user, the server sends the playing state immediately.
- if (PlayingUserStates.ContainsKey(userId))
+ if (userBeatmapDictionary.ContainsKey(userId))
sendPlayingState(userId);
return Task.CompletedTask;
@@ -144,6 +144,7 @@ namespace osu.Game.Tests.Visual.Spectator
{
BeatmapID = userBeatmapDictionary[userId],
RulesetID = 0,
+ State = SpectatingUserState.Playing
});
}
}