mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 05:13:22 +08:00
Fix various breakage in delete local score test scene
This commit is contained in:
parent
cbcbcd1a4a
commit
a1ded66fd8
@ -44,9 +44,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private BeatmapInfo beatmapInfo;
|
private BeatmapInfo beatmapInfo;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private RealmAccess realm { get; set; }
|
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly DialogOverlay dialogOverlay;
|
private readonly DialogOverlay dialogOverlay;
|
||||||
|
|
||||||
@ -92,6 +89,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RulesetStore>(), () => beatmapManager, LocalStorage, Realm, Scheduler));
|
dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RulesetStore>(), () => beatmapManager, LocalStorage, Realm, Scheduler));
|
||||||
Dependencies.Cache(Realm);
|
Dependencies.Cache(Realm);
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load() => Schedule(() =>
|
||||||
|
{
|
||||||
var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely();
|
var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely();
|
||||||
|
|
||||||
imported?.PerformRead(s =>
|
imported?.PerformRead(s =>
|
||||||
@ -115,26 +118,26 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
importedScores.Add(scoreManager.Import(score).Value);
|
importedScores.Add(scoreManager.Import(score).Value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup() => Schedule(() =>
|
|
||||||
{
|
|
||||||
realm.Run(r =>
|
|
||||||
{
|
|
||||||
// Due to soft deletions, we can re-use deleted scores between test runs
|
|
||||||
scoreManager.Undelete(r.All<ScoreInfo>().Where(s => s.DeletePending).ToList());
|
|
||||||
});
|
|
||||||
|
|
||||||
leaderboard.BeatmapInfo = beatmapInfo;
|
|
||||||
leaderboard.RefetchScores(); // Required in the case that the beatmap hasn't changed
|
|
||||||
});
|
});
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetupSteps()
|
public void SetupSteps()
|
||||||
{
|
{
|
||||||
|
AddUntilStep("ensure scores imported", () => importedScores.Count == 50);
|
||||||
|
AddStep("undelete scores", () =>
|
||||||
|
{
|
||||||
|
Realm.Run(r =>
|
||||||
|
{
|
||||||
|
// Due to soft deletions, we can re-use deleted scores between test runs
|
||||||
|
scoreManager.Undelete(r.All<ScoreInfo>().Where(s => s.DeletePending).ToList());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
AddStep("set up leaderboard", () =>
|
||||||
|
{
|
||||||
|
leaderboard.BeatmapInfo = beatmapInfo;
|
||||||
|
leaderboard.RefetchScores(); // Required in the case that the beatmap hasn't changed
|
||||||
|
});
|
||||||
|
|
||||||
// Ensure the leaderboard items have finished showing up
|
// Ensure the leaderboard items have finished showing up
|
||||||
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));
|
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));
|
||||||
AddUntilStep("wait for drawables", () => leaderboard.ChildrenOfType<LeaderboardScore>().Any());
|
AddUntilStep("wait for drawables", () => leaderboard.ChildrenOfType<LeaderboardScore>().Any());
|
||||||
|
Loading…
Reference in New Issue
Block a user