1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Add test step to TestSceneRankingsTable

This commit is contained in:
Andrei Zavatski 2020-02-04 16:20:15 +03:00
parent 37992e99f9
commit f889f2435b
3 changed files with 21 additions and 6 deletions

View File

@ -68,6 +68,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Mania scores", () => createScoreTable(new ManiaRuleset().RulesetInfo)); AddStep("Mania scores", () => createScoreTable(new ManiaRuleset().RulesetInfo));
AddStep("Taiko country scores", () => createCountryTable(new TaikoRuleset().RulesetInfo)); AddStep("Taiko country scores", () => createCountryTable(new TaikoRuleset().RulesetInfo));
AddStep("Catch US performance page 10", () => createPerformanceTable(new CatchRuleset().RulesetInfo, "US", 10)); AddStep("Catch US performance page 10", () => createPerformanceTable(new CatchRuleset().RulesetInfo, "US", 10));
AddStep("Osu 271 spotlight table", () => createSpotlightTable(new OsuRuleset().RulesetInfo, 271));
} }
private void createCountryTable(RulesetInfo ruleset, int page = 1) private void createCountryTable(RulesetInfo ruleset, int page = 1)
@ -112,6 +113,20 @@ namespace osu.Game.Tests.Visual.Online
api.Queue(request); api.Queue(request);
} }
private void createSpotlightTable(RulesetInfo ruleset, int spotlight)
{
onLoadStarted();
request = new GetSpotlightRankingsRequest(ruleset, spotlight);
((GetSpotlightRankingsRequest)request).Success += rankings => Schedule(() =>
{
var table = new ScoresTable(1, rankings.Users);
loadTable(table);
});
api.Queue(request);
}
private void onLoadStarted() private void onLoadStarted()
{ {
loading.Show(); loading.Show();

View File

@ -44,8 +44,8 @@ namespace osu.Game.Overlays.Rankings.Tables
new ColoredRowText { Text = $@"{item.PlayCount:N0}", }, new ColoredRowText { Text = $@"{item.PlayCount:N0}", },
}.Concat(CreateUniqueContent(item)).Concat(new[] }.Concat(CreateUniqueContent(item)).Concat(new[]
{ {
new ColoredRowText { Text = $@"{item.GradesCount.SS + item.GradesCount.SSPlus:N0}", }, new ColoredRowText { Text = $@"{item.GradesCount.SS + (item.GradesCount.SSPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.S + item.GradesCount.SPlus:N0}", }, new ColoredRowText { Text = $@"{item.GradesCount.S + (item.GradesCount.SPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", } new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", }
}).ToArray(); }).ToArray();

View File

@ -30,7 +30,7 @@ namespace osu.Game.Users
public decimal? PP; public decimal? PP;
[JsonProperty(@"pp_rank")] // the API sometimes only returns this value in condensed user responses [JsonProperty(@"pp_rank")] // the API sometimes only returns this value in condensed user responses
private int rank private int? rank
{ {
set => Ranks.Global = value; set => Ranks.Global = value;
} }
@ -71,13 +71,13 @@ namespace osu.Game.Users
public struct Grades public struct Grades
{ {
[JsonProperty(@"ssh")] [JsonProperty(@"ssh")]
public int SSPlus; public int? SSPlus;
[JsonProperty(@"ss")] [JsonProperty(@"ss")]
public int SS; public int SS;
[JsonProperty(@"sh")] [JsonProperty(@"sh")]
public int SPlus; public int? SPlus;
[JsonProperty(@"s")] [JsonProperty(@"s")]
public int S; public int S;
@ -85,7 +85,7 @@ namespace osu.Game.Users
[JsonProperty(@"a")] [JsonProperty(@"a")]
public int A; public int A;
public int this[ScoreRank rank] public int? this[ScoreRank rank]
{ {
get get
{ {