mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Replace a couple more local test beatmap cases which can instead use TestResources
methods
This commit is contained in:
parent
220d7bc6db
commit
d17890ca9a
@ -8,12 +8,10 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
@ -28,6 +26,7 @@ using osu.Game.Rulesets.Taiko.Mods;
|
|||||||
using osu.Game.Screens.OnlinePlay;
|
using osu.Game.Screens.OnlinePlay;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
@ -49,41 +48,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default));
|
||||||
Dependencies.Cache(Realm);
|
Dependencies.Cache(Realm);
|
||||||
|
|
||||||
var metadata = new BeatmapMetadata
|
importedBeatmapSet = manager.Import(TestResources.CreateTestBeatmapSetInfo(8, rulesets.AvailableRulesets.ToArray()));
|
||||||
{
|
|
||||||
Artist = "Some Artist",
|
|
||||||
Title = "Some Beatmap",
|
|
||||||
Author = { Username = "Some Author" },
|
|
||||||
};
|
|
||||||
|
|
||||||
var beatmapSetInfo = new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
OnlineID = 10,
|
|
||||||
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
|
||||||
DateAdded = DateTimeOffset.UtcNow
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
|
||||||
{
|
|
||||||
int beatmapId = 10 * 10 + i;
|
|
||||||
|
|
||||||
int length = RNG.Next(30000, 200000);
|
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
|
||||||
|
|
||||||
var beatmap = new BeatmapInfo
|
|
||||||
{
|
|
||||||
Ruleset = rulesets.GetRuleset(i % 4) ?? throw new InvalidOperationException(),
|
|
||||||
OnlineID = beatmapId,
|
|
||||||
Length = length,
|
|
||||||
BPM = bpm,
|
|
||||||
Metadata = metadata,
|
|
||||||
Difficulty = new BeatmapDifficulty()
|
|
||||||
};
|
|
||||||
|
|
||||||
beatmapSetInfo.Beatmaps.Add(beatmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
importedBeatmapSet = manager.Import(beatmapSetInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -17,7 +16,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Models;
|
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -60,20 +58,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Size = new Vector2(550f, 450f),
|
Size = new Vector2(550f, 450f),
|
||||||
Scope = BeatmapLeaderboardScope.Local,
|
Scope = BeatmapLeaderboardScope.Local,
|
||||||
BeatmapInfo = new BeatmapInfo
|
BeatmapInfo = TestResources.CreateTestBeatmapSetInfo().Beatmaps.First()
|
||||||
{
|
|
||||||
ID = Guid.NewGuid(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Title = "TestSong",
|
|
||||||
Artist = "TestArtist",
|
|
||||||
Author = new RealmUser
|
|
||||||
{
|
|
||||||
Username = "TestAuthor"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
DifficultyName = "Insane"
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dialogOverlay = new DialogOverlay()
|
dialogOverlay = new DialogOverlay()
|
||||||
|
Loading…
Reference in New Issue
Block a user