mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Fix test failures by waiting for panel load
This commit is contained in:
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -56,6 +57,9 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private Colour4 accentColour;
|
||||
|
||||
private Task? latestLoadTask;
|
||||
internal bool ItemsLoaded => latestLoadTask == null;
|
||||
|
||||
private const float header_height = 42;
|
||||
|
||||
public ModColumn(ModType modType, bool allowBulkSelection, Key[]? toggleKeys = null)
|
||||
@ -234,7 +238,9 @@ namespace osu.Game.Overlays.Mods
|
||||
Shear = new Vector2(-ModPanel.SHEAR_X, 0)
|
||||
});
|
||||
|
||||
LoadComponentsAsync(panels, loaded =>
|
||||
Task? loadTask;
|
||||
|
||||
latestLoadTask = loadTask = LoadComponentsAsync(panels, loaded =>
|
||||
{
|
||||
panelFlow.ChildrenEnumerable = loaded;
|
||||
|
||||
@ -244,6 +250,11 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
updateFilter();
|
||||
}, (cancellationTokenSource = new CancellationTokenSource()).Token);
|
||||
loadTask.ContinueWith(_ =>
|
||||
{
|
||||
if (loadTask == latestLoadTask)
|
||||
latestLoadTask = null;
|
||||
});
|
||||
}
|
||||
|
||||
#region Bulk select / deselect
|
||||
|
Reference in New Issue
Block a user