diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs
index bf08097ffd..e0572e604c 100644
--- a/osu.Game.Tests/Resources/TestResources.cs
+++ b/osu.Game.Tests/Resources/TestResources.cs
@@ -85,8 +85,7 @@ namespace osu.Game.Tests.Resources
///
/// Number of difficulties. If null, a random number between 1 and 20 will be used.
/// Rulesets to cycle through when creating difficulties. If null, osu! ruleset will be used.
- /// Whether to randomise metadata to create a better distribution.
- public static BeatmapSetInfo CreateTestBeatmapSetInfo(int? difficultyCount = null, RulesetInfo[] rulesets = null, bool randomiseMetadata = false)
+ public static BeatmapSetInfo CreateTestBeatmapSetInfo(int? difficultyCount = null, RulesetInfo[] rulesets = null)
{
int j = 0;
@@ -96,27 +95,13 @@ namespace osu.Game.Tests.Resources
int setId = GetNextTestID();
- char getRandomCharacter()
+ var metadata = new BeatmapMetadata
{
- const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz*";
- return chars[RNG.Next(chars.Length)];
- }
-
- var metadata = randomiseMetadata
- ? new BeatmapMetadata
- {
- // Create random metadata, then we can check if sorting works based on these
- Artist = $"{getRandomCharacter()}ome Artist " + RNG.Next(0, 9),
- Title = $"{getRandomCharacter()}ome Song (set id {setId:000}) {Guid.NewGuid()}",
- Author = { Username = $"{getRandomCharacter()}ome Guy " + RNG.Next(0, 9) },
- }
- : new BeatmapMetadata
- {
- // 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:000}) {Guid.NewGuid()}",
- Author = { Username = "Some Guy " + RNG.Next(0, 9) },
- };
+ // 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:000}) {Guid.NewGuid()}",
+ Author = { Username = "Some Guy " + RNG.Next(0, 9) },
+ };
Logger.Log($"🛠️ Generating beatmap set \"{metadata}\" for test consumption.");
diff --git a/osu.Game.Tests/Visual/SongSelect/BeatmapCarouselV2TestScene.cs b/osu.Game.Tests/Visual/SongSelect/BeatmapCarouselV2TestScene.cs
index f5ea959c51..a55f79c42e 100644
--- a/osu.Game.Tests/Visual/SongSelect/BeatmapCarouselV2TestScene.cs
+++ b/osu.Game.Tests/Visual/SongSelect/BeatmapCarouselV2TestScene.cs
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@@ -190,12 +191,37 @@ namespace osu.Game.Tests.Visual.SongSelect
///
/// The count of beatmap sets to add.
/// If not null, the number of difficulties per set. If null, randomised difficulty count will be used.
- protected void AddBeatmaps(int count, int? fixedDifficultiesPerSet = null) => AddStep($"add {count} beatmaps", () =>
+ /// Whether to randomise the metadata to make groupings more uniform.
+ protected void AddBeatmaps(int count, int? fixedDifficultiesPerSet = null, bool randomMetadata = false) => AddStep($"add {count} beatmaps{(randomMetadata ? " with random data" : "")}", () =>
{
for (int i = 0; i < count; i++)
- BeatmapSets.Add(TestResources.CreateTestBeatmapSetInfo(fixedDifficultiesPerSet ?? RNG.Next(1, 4), randomiseMetadata: true));
+ {
+ var beatmapSetInfo = TestResources.CreateTestBeatmapSetInfo(fixedDifficultiesPerSet ?? RNG.Next(1, 4));
+
+ if (randomMetadata)
+ {
+ var metadata = new BeatmapMetadata
+ {
+ // Create random metadata, then we can check if sorting works based on these
+ Artist = $"{getRandomCharacter()}ome Artist " + RNG.Next(0, 9),
+ Title = $"{getRandomCharacter()}ome Song (set id {beatmapSetInfo.OnlineID:000}) {Guid.NewGuid()}",
+ Author = { Username = $"{getRandomCharacter()}ome Guy " + RNG.Next(0, 9) },
+ };
+
+ foreach (var beatmap in beatmapSetInfo.Beatmaps)
+ beatmap.Metadata = metadata.DeepClone();
+ }
+
+ BeatmapSets.Add(beatmapSetInfo);
+ }
});
+ private static char getRandomCharacter()
+ {
+ const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz*";
+ return chars[RNG.Next(chars.Length)];
+ }
+
protected void RemoveAllBeatmaps() => AddStep("clear all beatmaps", () => BeatmapSets.Clear());
protected void RemoveFirstBeatmap() =>
diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarouselV2Basics.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarouselV2Basics.cs
index a173920dc6..41ceff3183 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarouselV2Basics.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarouselV2Basics.cs
@@ -26,8 +26,9 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test]
public void TestBasics()
{
- AddBeatmaps(1);
AddBeatmaps(10);
+ AddBeatmaps(10, randomMetadata: true);
+ AddBeatmaps(1);
RemoveFirstBeatmap();
RemoveAllBeatmaps();
}