2022-12-23 21:27:22 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Online.Solo;
|
|
|
|
using osu.Game.Scoring;
|
2022-12-24 21:48:04 +08:00
|
|
|
using osu.Game.Screens.Ranking.Statistics.User;
|
2022-12-23 21:27:22 +08:00
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Ranking
|
|
|
|
{
|
|
|
|
public partial class TestSceneOverallRanking : OsuTestScene
|
|
|
|
{
|
2022-12-24 17:27:28 +08:00
|
|
|
private OverallRanking overallRanking = null!;
|
2022-12-23 21:27:22 +08:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestUpdatePending()
|
|
|
|
{
|
|
|
|
createDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestAllIncreased()
|
|
|
|
{
|
|
|
|
createDisplay();
|
2022-12-24 17:27:28 +08:00
|
|
|
displayUpdate(
|
|
|
|
new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = 12_345,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 98.99,
|
2022-12-24 17:27:28 +08:00
|
|
|
MaxCombo = 2_322,
|
|
|
|
RankedScore = 23_123_543_456,
|
|
|
|
TotalScore = 123_123_543_456,
|
|
|
|
PP = 5_072
|
|
|
|
},
|
|
|
|
new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = 1_234,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 99.07,
|
2022-12-24 17:27:28 +08:00
|
|
|
MaxCombo = 2_352,
|
|
|
|
RankedScore = 23_124_231_435,
|
|
|
|
TotalScore = 123_124_231_435,
|
|
|
|
PP = 5_434
|
|
|
|
});
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestAllDecreased()
|
|
|
|
{
|
|
|
|
createDisplay();
|
2022-12-24 17:27:28 +08:00
|
|
|
displayUpdate(
|
|
|
|
new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = 1_234,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 99.07,
|
2022-12-24 17:27:28 +08:00
|
|
|
MaxCombo = 2_352,
|
|
|
|
RankedScore = 23_124_231_435,
|
|
|
|
TotalScore = 123_124_231_435,
|
|
|
|
PP = 5_434
|
|
|
|
},
|
|
|
|
new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = 12_345,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 98.99,
|
2022-12-24 17:27:28 +08:00
|
|
|
MaxCombo = 2_322,
|
|
|
|
RankedScore = 23_123_543_456,
|
|
|
|
TotalScore = 123_123_543_456,
|
|
|
|
PP = 5_072
|
|
|
|
});
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestNoChanges()
|
|
|
|
{
|
|
|
|
var statistics = new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = 12_345,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 98.99,
|
2022-12-23 21:27:22 +08:00
|
|
|
MaxCombo = 2_322,
|
|
|
|
RankedScore = 23_123_543_456,
|
|
|
|
TotalScore = 123_123_543_456,
|
|
|
|
PP = 5_072
|
|
|
|
};
|
|
|
|
|
|
|
|
createDisplay();
|
2022-12-24 17:27:28 +08:00
|
|
|
displayUpdate(statistics, statistics);
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestNotRanked()
|
|
|
|
{
|
|
|
|
var statistics = new UserStatistics
|
|
|
|
{
|
|
|
|
GlobalRank = null,
|
2022-12-28 02:48:18 +08:00
|
|
|
Accuracy = 98.99,
|
2022-12-23 21:27:22 +08:00
|
|
|
MaxCombo = 2_322,
|
|
|
|
RankedScore = 23_123_543_456,
|
|
|
|
TotalScore = 123_123_543_456,
|
|
|
|
PP = null
|
|
|
|
};
|
|
|
|
|
|
|
|
createDisplay();
|
2022-12-24 17:27:28 +08:00
|
|
|
displayUpdate(statistics, statistics);
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
|
2022-12-24 17:44:38 +08:00
|
|
|
private void createDisplay() => AddStep("create display", () => Child = overallRanking = new OverallRanking
|
2022-12-23 21:27:22 +08:00
|
|
|
{
|
|
|
|
Width = 400,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
});
|
|
|
|
|
2022-12-24 17:27:28 +08:00
|
|
|
private void displayUpdate(UserStatistics before, UserStatistics after) =>
|
|
|
|
AddStep("display update", () => overallRanking.StatisticsUpdate.Value = new SoloStatisticsUpdate(new ScoreInfo(), before, after));
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
}
|