mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge pull request #19924 from peppy/fix-playlist-overlay-test-failures
Fix intermittent test failures in `TestScenePlaylistOverlay`
This commit is contained in:
@ -75,7 +75,14 @@ namespace osu.Game.Collections
|
||||
// changes. It's not great but honestly the whole dropdown menu structure isn't great. This needs to be fixed, but I'll issue
|
||||
// a warning that it's going to be a frustrating journey.
|
||||
Current.Value = allBeatmaps;
|
||||
Schedule(() => Current.Value = filters.SingleOrDefault(f => f.Collection != null && f.Collection.ID == selectedItem?.ID) ?? filters[0]);
|
||||
Schedule(() =>
|
||||
{
|
||||
// current may have changed before the scheduled call is run.
|
||||
if (Current.Value != allBeatmaps)
|
||||
return;
|
||||
|
||||
Current.Value = filters.SingleOrDefault(f => f.Collection != null && f.Collection.ID == selectedItem?.ID) ?? filters[0];
|
||||
});
|
||||
|
||||
// Trigger a re-filter if the current item was in the change set.
|
||||
if (selectedItem != null && changes != null)
|
||||
|
@ -27,6 +27,12 @@ namespace osu.Game.Overlays.Music
|
||||
set => base.Padding = value;
|
||||
}
|
||||
|
||||
protected override void OnItemsChanged()
|
||||
{
|
||||
base.OnItemsChanged();
|
||||
Filter(currentCriteria);
|
||||
}
|
||||
|
||||
public void Filter(FilterCriteria criteria)
|
||||
{
|
||||
var items = (SearchContainer<RearrangeableListItem<Live<BeatmapSetInfo>>>)ListContainer;
|
||||
@ -44,12 +50,12 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
public Live<BeatmapSetInfo>? FirstVisibleSet => Items.FirstOrDefault(i => ((PlaylistItem)ItemMap[i]).MatchingFilter);
|
||||
|
||||
protected override OsuRearrangeableListItem<Live<BeatmapSetInfo>> CreateOsuDrawable(Live<BeatmapSetInfo> item) => new PlaylistItem(item)
|
||||
{
|
||||
InSelectedCollection = currentCriteria.Collection?.PerformRead(c => item.Value.Beatmaps.Select(b => b.MD5Hash).Any(c.BeatmapMD5Hashes.Contains)) != false,
|
||||
SelectedSet = { BindTarget = SelectedSet },
|
||||
RequestSelection = set => RequestSelection?.Invoke(set)
|
||||
};
|
||||
protected override OsuRearrangeableListItem<Live<BeatmapSetInfo>> CreateOsuDrawable(Live<BeatmapSetInfo> item) =>
|
||||
new PlaylistItem(item)
|
||||
{
|
||||
SelectedSet = { BindTarget = SelectedSet },
|
||||
RequestSelection = set => RequestSelection?.Invoke(set)
|
||||
};
|
||||
|
||||
protected override FillFlowContainer<RearrangeableListItem<Live<BeatmapSetInfo>>> CreateListFillFlowContainer() => new SearchContainer<RearrangeableListItem<Live<BeatmapSetInfo>>>
|
||||
{
|
||||
|
Reference in New Issue
Block a user