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 @@ protected override void LoadComplete()
AddStep("Mania scores", () => createScoreTable(new ManiaRuleset().RulesetInfo));
AddStep("Taiko country scores", () => createCountryTable(new TaikoRuleset().RulesetInfo));
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)
@ -112,6 +113,20 @@ private void createScoreTable(RulesetInfo ruleset, int page = 1)
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()
{
loading.Show();

View File

@ -44,8 +44,8 @@ protected sealed override Drawable[] CreateAdditionalContent(UserStatistics item
new ColoredRowText { Text = $@"{item.PlayCount:N0}", },
}.Concat(CreateUniqueContent(item)).Concat(new[]
{
new ColoredRowText { Text = $@"{item.GradesCount.SS + item.GradesCount.SSPlus:N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.S + item.GradesCount.SPlus:N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.SS + (item.GradesCount.SSPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.S + (item.GradesCount.SPlus ?? 0):N0}", },
new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", }
}).ToArray();

View File

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