1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:02:53 +08:00

Add leaderboard test on beatmap update

This commit is contained in:
Cootz 2023-02-08 05:01:54 +03:00
parent 7e127dafe2
commit 338d96534a

View File

@ -96,6 +96,37 @@ namespace osu.Game.Tests.Visual.SongSelect
checkCount(0);
}
[Test]
public void TestLocalScoresDisplayOnBeatmapEdit()
{
BeatmapInfo beatmapInfo = null!;
AddStep(@"Set scope", () => leaderboard.Scope = BeatmapLeaderboardScope.Local);
AddStep(@"Set beatmap", () =>
{
beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
beatmapInfo = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First();
leaderboard.BeatmapInfo = beatmapInfo;
});
clearScores();
checkCount(0);
loadMoreScores(() => beatmapInfo);
checkCount(10);
beatmapEdit(() => beatmapInfo);
checkCount(0);
loadMoreScores(() => beatmapInfo);
checkCount(10);
clearScores();
checkCount(0);
}
[Test]
public void TestGlobalScoresDisplay()
{
@ -123,6 +154,21 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep(@"None selected", () => leaderboard.SetErrorState(LeaderboardState.NoneSelected));
}
private void beatmapEdit(Func<BeatmapInfo> beatmapInfo)
{
AddStep(@"Update beatmap via BeatmapManager", () =>
{
BeatmapInfo info = beatmapInfo();
IBeatmap beatmap = beatmapManager.GetWorkingBeatmap(info).Beatmap;
beatmap.Difficulty.ApproachRate = 11;
beatmap.Difficulty.DrainRate = 11;
beatmap.Difficulty.OverallDifficulty = 11;
beatmapManager.Save(info, beatmap);
});
}
private void showPersonalBestWithNullPosition()
{
leaderboard.SetScores(leaderboard.Scores, new ScoreInfo