1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-26 20:43:10 +08:00

Fix incorrect cursor parameterisation in test scene

This commit is contained in:
Dan Balasescu 2022-04-11 15:38:11 +09:00
parent 37976c569a
commit d1de516b11

View File

@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.Playlists
{
multiplayerUserScore.ScoresAround.Lower.Scores.Add(new MultiplayerScore
{
ID = --highestScoreId,
ID = getNextLowestScoreId(),
Accuracy = userScore.Accuracy,
Passed = true,
Rank = userScore.Rank,
@ -274,7 +274,7 @@ namespace osu.Game.Tests.Visual.Playlists
multiplayerUserScore.ScoresAround.Higher.Scores.Add(new MultiplayerScore
{
ID = ++lowestScoreId,
ID = getNextHighestScoreId(),
Accuracy = userScore.Accuracy,
Passed = true,
Rank = userScore.Rank,
@ -306,7 +306,7 @@ namespace osu.Game.Tests.Visual.Playlists
{
result.Scores.Add(new MultiplayerScore
{
ID = sort == "score_asc" ? --highestScoreId : ++lowestScoreId,
ID = sort == "score_asc" ? getNextHighestScoreId() : getNextLowestScoreId(),
Accuracy = 1,
Passed = true,
Rank = ScoreRank.X,
@ -327,6 +327,17 @@ namespace osu.Game.Tests.Visual.Playlists
return result;
}
/// <summary>
/// The next highest score ID to appear at the left of the list. Monotonically decreasing.
/// </summary>
private int getNextHighestScoreId() => --highestScoreId;
/// <summary>
/// The next lowest score ID to appear at the right of the list. Monotonically increasing.
/// </summary>
/// <returns></returns>
private int getNextLowestScoreId() => ++lowestScoreId;
private void addCursor(MultiplayerScores scores)
{
scores.Cursor = new Cursor
@ -342,7 +353,9 @@ namespace osu.Game.Tests.Visual.Playlists
{
Properties = new Dictionary<string, JToken>
{
{ "sort", JToken.FromObject(scores.Scores[^1].ID > scores.Scores[^2].ID ? "score_asc" : "score_desc") }
// [ 1, 2, 3, ... ] => score_desc (will be added to the right of the list)
// [ 3, 2, 1, ... ] => score_asc (will be added to the left of the list)
{ "sort", JToken.FromObject(scores.Scores[^1].ID > scores.Scores[^2].ID ? "score_desc" : "score_asc") }
}
};
}