1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:26:07 +08:00

Replace weird import handling

This commit is contained in:
Dean Herbert 2021-10-28 17:10:04 +09:00
parent b096bf6cd1
commit 8076e22e70
2 changed files with 9 additions and 18 deletions

View File

@ -38,8 +38,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
{ {
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
manager.Import(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Wait();
} }
[Test] [Test]
@ -204,7 +202,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Test] [Test]
public void TestDownloadButtonHiddenWhenBeatmapExists() public void TestDownloadButtonHiddenWhenBeatmapExists()
{ {
createPlaylist(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo); var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
AddStep("import beatmap", () => manager.Import(beatmap.BeatmapSet).Wait());
createPlaylist(beatmap);
assertDownloadButtonVisible(false); assertDownloadButtonVisible(false);

View File

@ -91,27 +91,16 @@ namespace osu.Game.Tests.Visual.Playlists
{ {
BeatmapSetInfo importedSet = null; BeatmapSetInfo importedSet = null;
// this step is required to make sure the further imports actually get online IDs.
// all the playlist logic relies on online ID matching.
AddStep("remove all matching online IDs", () =>
{
var existing = manager.QueryBeatmapSets(s => s.OnlineBeatmapSetID == importedBeatmap.Value.OnlineBeatmapSetID).ToList();
foreach (var s in existing)
{
s.OnlineBeatmapSetID = null;
foreach (var b in s.Beatmaps)
b.OnlineBeatmapID = null;
manager.Update(s);
}
});
AddStep("import altered beatmap", () => AddStep("import altered beatmap", () =>
{ {
IBeatmap beatmap = CreateBeatmap(new OsuRuleset().RulesetInfo); IBeatmap beatmap = CreateBeatmap(new OsuRuleset().RulesetInfo);
beatmap.BeatmapInfo.BaseDifficulty.CircleSize = 1; beatmap.BeatmapInfo.BaseDifficulty.CircleSize = 1;
// intentionally increment online IDs to clash with import below.
beatmap.BeatmapInfo.OnlineBeatmapID++;
beatmap.BeatmapInfo.BeatmapSet.OnlineBeatmapSetID++;
importedSet = manager.Import(beatmap.BeatmapInfo.BeatmapSet).Result.Value; importedSet = manager.Import(beatmap.BeatmapInfo.BeatmapSet).Result.Value;
}); });