1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 06:53:21 +08:00

Fix multiple tests with incorrect access to beatmap imports

This commit is contained in:
Dean Herbert 2022-01-10 14:36:21 +09:00
parent f4a1fa85a1
commit 8ecfb9172e
2 changed files with 25 additions and 15 deletions

View File

@ -39,7 +39,10 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("import beatmap with track", () => AddStep("import beatmap with track", () =>
{ {
var setWithTrack = Game.BeatmapManager.Import(new ImportTask(TestResources.GetTestBeatmapForImport())).GetResultSafely(); var setWithTrack = Game.BeatmapManager.Import(new ImportTask(TestResources.GetTestBeatmapForImport())).GetResultSafely();
Beatmap.Value = Game.BeatmapManager.GetWorkingBeatmap(setWithTrack.Value.Beatmaps.First()); setWithTrack?.PerformRead(s =>
{
Beatmap.Value = Game.BeatmapManager.GetWorkingBeatmap(s.Beatmaps.First());
});
}); });
AddStep("bind to track change", () => AddStep("bind to track change", () =>

View File

@ -22,6 +22,7 @@ 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;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Tests.Resources; using osu.Game.Tests.Resources;
@ -90,7 +91,11 @@ namespace osu.Game.Tests.Visual.UserInterface
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RulesetStore>(), () => beatmapManager, LocalStorage, dependencies.Get<RealmContextFactory>(), Scheduler)); dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RulesetStore>(), () => beatmapManager, LocalStorage, dependencies.Get<RealmContextFactory>(), Scheduler));
beatmapInfo = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely().Value.Beatmaps[0]; var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely();
imported?.PerformRead(s =>
{
beatmapInfo = s.Beatmaps[0].Detach();
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
{ {
@ -103,10 +108,12 @@ namespace osu.Game.Tests.Visual.UserInterface
MaxCombo = RNG.Next(1, 1000), MaxCombo = RNG.Next(1, 1000),
Rank = ScoreRank.XH, Rank = ScoreRank.XH,
User = new APIUser { Username = "TestUser" }, User = new APIUser { Username = "TestUser" },
Ruleset = new OsuRuleset().RulesetInfo,
}; };
importedScores.Add(scoreManager.Import(score).GetResultSafely().Value); importedScores.Add(scoreManager.Import(score).GetResultSafely().Value);
} }
});
return dependencies; return dependencies;
} }