1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge branch 'master' into dangerous-delete-actions

This commit is contained in:
Dean Herbert 2022-04-05 10:55:01 +09:00 committed by GitHub
commit 3ca365ad7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 19 deletions

View File

@ -44,9 +44,6 @@ namespace osu.Game.Tests.Visual.UserInterface
private BeatmapInfo beatmapInfo;
[Resolved]
private RealmAccess realm { get; set; }
[Cached]
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(Realm);
return dependencies;
}
[BackgroundDependencyLoader]
private void load() => Schedule(() =>
{
var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely();
imported?.PerformRead(s =>
@ -115,26 +118,26 @@ namespace osu.Game.Tests.Visual.UserInterface
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]
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
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));
AddUntilStep("wait for drawables", () => leaderboard.ChildrenOfType<LeaderboardScore>().Any());

View File

@ -174,7 +174,7 @@ namespace osu.Game.Screens.Select
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Action == Hotkey)
if (e.Action == Hotkey && !e.Repeat)
{
TriggerClick();
return true;