mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 19:53:08 +08:00
Move to TestPlayer and add null check
This commit is contained in:
parent
6c671434ec
commit
00bdd52cff
@ -203,15 +203,5 @@ namespace osu.Game.Screens.Play
|
||||
api.Queue(request);
|
||||
return scoreSubmissionSource.Task;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
// Specific to tests, the player can be disposed without OnExiting() ever being called.
|
||||
// We should make sure that the gameplay session has finished even in this case.
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -46,6 +47,9 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
public readonly List<JudgementResult> Results = new List<JudgementResult>();
|
||||
|
||||
[Resolved]
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
public TestPlayer(bool allowPause = true, bool showResults = true, bool pauseOnFocusLost = false)
|
||||
: base(new PlayerConfiguration
|
||||
{
|
||||
@ -98,5 +102,15 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
ScoreProcessor.NewJudgement += r => Results.Add(r);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
// Specific to tests, the player can be disposed without OnExiting() ever being called.
|
||||
// We should make sure that the gameplay session has finished even in this case.
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user