mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +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:
@ -5,6 +5,7 @@ using System;
|
||||
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 @@ namespace osu.Game.Tests.Beatmaps
|
||||
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,
|
||||
|
Reference in New Issue
Block a user