mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Merge pull request #12609 from peppy/fix-download-button-import-cancel-state
Fix import cancellation not correctly being forwarded to import notification
This commit is contained in:
commit
71e44a0841
@ -43,7 +43,10 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
createButtonWithBeatmap(createSoleily());
|
createButtonWithBeatmap(createSoleily());
|
||||||
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
||||||
AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
||||||
|
|
||||||
AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526));
|
AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526));
|
||||||
|
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||||
|
|
||||||
createButtonWithBeatmap(createSoleily());
|
createButtonWithBeatmap(createSoleily());
|
||||||
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||||
ensureSoleilyRemoved();
|
ensureSoleilyRemoved();
|
||||||
|
@ -156,6 +156,8 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size;
|
bool isLowPriorityImport = tasks.Length > low_priority_import_batch_size;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
await Task.WhenAll(tasks.Select(async task =>
|
await Task.WhenAll(tasks.Select(async task =>
|
||||||
{
|
{
|
||||||
notification.CancellationToken.ThrowIfCancellationRequested();
|
notification.CancellationToken.ThrowIfCancellationRequested();
|
||||||
@ -183,6 +185,15 @@ namespace osu.Game.Database
|
|||||||
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
|
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
|
||||||
}
|
}
|
||||||
})).ConfigureAwait(false);
|
})).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (imported.Count == 0)
|
||||||
|
{
|
||||||
|
notification.State = ProgressNotificationState.Cancelled;
|
||||||
|
return imported;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (imported.Count == 0)
|
if (imported.Count == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user