Disallow setting "NoScores" externally as it is handled internally

This commit is contained in:
Dean Herbert 2022-01-30 16:16:33 +09:00
parent acc1199add
commit 04dbb5d3c6
2 changed files with 4 additions and 2 deletions

View File

@ -114,7 +114,8 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test]
public void TestPlaceholderStates()
{
AddStep(@"Empty Scores", () => leaderboard.SetErrorState(LeaderboardErrorState.NoScores));
AddStep("ensure no scores displayed", () => leaderboard.SetScores(null));
AddStep(@"Network failure", () => leaderboard.SetErrorState(LeaderboardErrorState.NetworkFailure));
AddStep(@"No supporter", () => leaderboard.SetErrorState(LeaderboardErrorState.NotSupporter));
AddStep(@"Not logged in", () => leaderboard.SetErrorState(LeaderboardErrorState.NotLoggedIn));

View File

@ -165,6 +165,7 @@ namespace osu.Game.Online.Leaderboards
{
switch (errorState)
{
case LeaderboardErrorState.NoScores:
case LeaderboardErrorState.NoError:
throw new InvalidOperationException($"State {errorState} cannot be set by a leaderboard implementation.");
}
@ -250,7 +251,7 @@ namespace osu.Game.Online.Leaderboards
if (scores?.Any() != true)
{
SetErrorState(LeaderboardErrorState.NoScores);
setErrorState(LeaderboardErrorState.NoScores);
loading.Hide();
return;
}