1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-21 03:39:53 +08:00

Fix tests

This commit is contained in:
Bartłomiej Dach
2025-12-31 12:53:59 +01:00
Unverified
parent 7e823af70b
commit bd29c46bd7
+17 -5
View File
@@ -50,7 +50,8 @@ namespace osu.Game.Screens.Edit
public ExternalEditOperation<BeatmapSetInfo>? EditOperation { get; private set; }
private Task? finishOperation;
private bool operationFinishStarted;
private bool operationFinished;
private FillFlowContainer flow = null!;
@@ -101,14 +102,14 @@ namespace osu.Game.Screens.Edit
return true;
// Similarly do not allow interrupting an ongoing finish.
if (finishOperation?.IsCompleted == false)
if (operationFinishStarted && !operationFinished)
return true;
// If the operation completed successfully, ensure that we finish the operation before exiting.
// The finish() call will subsequently call Exit() when done.
if (EditOperation != null && finishOperation == null)
if (EditOperation != null && !operationFinishStarted)
{
(finishOperation = finish()).FireAndForget();
finish().FireAndForget();
return true;
}
@@ -167,7 +168,7 @@ namespace osu.Game.Screens.Edit
Width = 350,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Action = () => (finishOperation = finish()).FireAndForget(),
Action = () => finish().FireAndForget(),
Enabled = { Value = false }
}
};
@@ -191,6 +192,11 @@ namespace osu.Game.Screens.Edit
private async Task finish()
{
if (operationFinishStarted)
return;
operationFinishStarted = true;
BackButtonVisibility.Value = false;
string originalDifficulty = editor.Beatmap.Value.Beatmap.BeatmapInfo.DifficultyName;
@@ -213,7 +219,11 @@ namespace osu.Game.Screens.Edit
EditOperation = null;
if (beatmap == null)
{
// has to be set before `Exit()` call to ensure the exit isn't blocked in `OnExiting()`
operationFinished = true;
this.Exit();
}
else
{
// the `ImportAsUpdate()` flow will yield beatmap(sets) with online status of `None` if online lookup fails.
@@ -230,6 +240,8 @@ namespace osu.Game.Screens.Edit
beatmap.Value.Beatmaps.FirstOrDefault(b => b.DifficultyName == originalDifficulty)
?? beatmap.Value.Beatmaps.First();
// has to be set before `SwitchToDifficulty()` call to ensure the exit isn't blocked in `OnExiting()`
operationFinished = true;
editor.SwitchToDifficulty(closestMatchingBeatmap);
}
}