From 31e1d204d4d1d63debe92159443e09db9ddb1cd1 Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Sun, 7 Jul 2019 18:27:12 +0300 Subject: [PATCH] Add test for sorting by BPM and Length --- .../SongSelect/TestScenePlaySongSelect.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 962e0fb362..04c75d70e3 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -133,6 +133,9 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); + AddStep(@"Sort by DateAdded", delegate { songSelect.FilterControl.Sort = SortMode.DateAdded; }); + AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.Sort = SortMode.BPM; }); + AddStep(@"Sort by Length", delegate { songSelect.FilterControl.Sort = SortMode.Length; }); AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } @@ -264,20 +267,26 @@ namespace osu.Game.Tests.Visual.SongSelect for (int i = 0; i < 6; i++) { int beatmapId = setId * 10 + i; + int length = RNG.Next(30000, 200000); beatmaps.Add(new BeatmapInfo { Ruleset = getRuleset(), OnlineBeatmapID = beatmapId, Path = "normal.osu", - Version = $"{beatmapId}", + Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss})", BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 3.5f, + }, + OnlineInfo = new BeatmapOnlineInfo + { + Length = length, } }); } + double bpm = RNG.NextSingle(80, 200); return new BeatmapSetInfo { OnlineBeatmapSetID = setId, @@ -286,10 +295,15 @@ namespace osu.Game.Tests.Visual.SongSelect { // Create random metadata, then we can check if sorting works based on these Artist = "Some Artist " + RNG.Next(0, 9), - Title = $"Some Song (set id {setId})", + Title = $"Some Song (set id {setId}, bpm {bpm:0.#})", AuthorString = "Some Guy " + RNG.Next(0, 9), }, - Beatmaps = beatmaps + Beatmaps = beatmaps, + DateAdded = DateTimeOffset.UtcNow, + OnlineInfo = new BeatmapSetOnlineInfo + { + BPM = bpm, + } }; } }