Add test for sorting by BPM and Length

This commit is contained in:
iiSaLMaN
2019-07-07 18:27:12 +03:00
parent b4ef64fa61
commit 31e1d204d4

View File

@ -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,
}
};
}
}