mirror of https://github.com/ppy/osu
Ensure all test beatmaps have unique OnlineIDs to avoid import conflicts
The order of operation of imports means that the already-imported instances are considered most correct (they have usually been populated using an online source, although that is skipped in tests), so on two consecutive test imports in a test scene, the second will lose its online IDs completely. This aims to ensure that all test beatmaps will have online IDs, which is the general expected behaviour.
This commit is contained in:
parent
887f1c2c5c
commit
b096bf6cd1
|
@ -144,10 +144,7 @@ private void setupAndCreateRoom(Action<Room> room)
|
|||
});
|
||||
}
|
||||
|
||||
private void importBeatmap()
|
||||
{
|
||||
AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Result);
|
||||
}
|
||||
private void importBeatmap() => AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Result);
|
||||
|
||||
private class TestPlaylistsRoomSubScreen : PlaylistsRoomSubScreen
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO;
|
||||
|
@ -16,6 +17,9 @@ namespace osu.Game.Tests.Beatmaps
|
|||
{
|
||||
public class TestBeatmap : Beatmap
|
||||
{
|
||||
private static int onlineSetID;
|
||||
private static int onlineBeatmapID;
|
||||
|
||||
public TestBeatmap(RulesetInfo ruleset, bool withHitObjects = true)
|
||||
{
|
||||
var baseBeatmap = CreateBeatmap();
|
||||
|
@ -31,8 +35,10 @@ public TestBeatmap(RulesetInfo ruleset, bool withHitObjects = true)
|
|||
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
||||
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
||||
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
||||
BeatmapInfo.BeatmapSet.OnlineBeatmapSetID = Interlocked.Increment(ref onlineSetID);
|
||||
BeatmapInfo.Length = 75000;
|
||||
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
||||
BeatmapInfo.OnlineBeatmapID = Interlocked.Increment(ref onlineBeatmapID);
|
||||
BeatmapInfo.BeatmapSet.OnlineInfo = new APIBeatmapSet
|
||||
{
|
||||
Status = BeatmapSetOnlineStatus.Ranked,
|
||||
|
|
Loading…
Reference in New Issue