mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
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:
@ -144,10 +144,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importBeatmap()
|
private void importBeatmap() => AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Result);
|
||||||
{
|
|
||||||
AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestPlaylistsRoomSubScreen : PlaylistsRoomSubScreen
|
private class TestPlaylistsRoomSubScreen : PlaylistsRoomSubScreen
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
@ -16,6 +17,9 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
{
|
{
|
||||||
public class TestBeatmap : Beatmap
|
public class TestBeatmap : Beatmap
|
||||||
{
|
{
|
||||||
|
private static int onlineSetID;
|
||||||
|
private static int onlineBeatmapID;
|
||||||
|
|
||||||
public TestBeatmap(RulesetInfo ruleset, bool withHitObjects = true)
|
public TestBeatmap(RulesetInfo ruleset, bool withHitObjects = true)
|
||||||
{
|
{
|
||||||
var baseBeatmap = CreateBeatmap();
|
var baseBeatmap = CreateBeatmap();
|
||||||
@ -31,8 +35,10 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
||||||
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
||||||
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
||||||
|
BeatmapInfo.BeatmapSet.OnlineBeatmapSetID = Interlocked.Increment(ref onlineSetID);
|
||||||
BeatmapInfo.Length = 75000;
|
BeatmapInfo.Length = 75000;
|
||||||
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
||||||
|
BeatmapInfo.OnlineBeatmapID = Interlocked.Increment(ref onlineBeatmapID);
|
||||||
BeatmapInfo.BeatmapSet.OnlineInfo = new APIBeatmapSet
|
BeatmapInfo.BeatmapSet.OnlineInfo = new APIBeatmapSet
|
||||||
{
|
{
|
||||||
Status = BeatmapSetOnlineStatus.Ranked,
|
Status = BeatmapSetOnlineStatus.Ranked,
|
||||||
|
Reference in New Issue
Block a user