mirror of https://github.com/ppy/osu
Also ensure filter is applied when returning to song select
This commit is contained in:
parent
c192a6a1d5
commit
743d509241
|
@ -150,6 +150,7 @@ public void TestEnterGameplayWhileFilteringToNoSelection()
|
|||
TestPlaySongSelect songSelect = null;
|
||||
|
||||
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
|
||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||
|
||||
|
@ -158,6 +159,11 @@ public void TestEnterGameplayWhileFilteringToNoSelection()
|
|||
songSelect.FinaliseSelection();
|
||||
songSelect.FilterControl.CurrentTextSearch.Value = "test";
|
||||
});
|
||||
|
||||
AddUntilStep("wait for player", () => !songSelect.IsCurrentScreen());
|
||||
AddStep("return to song select", () => songSelect.MakeCurrent());
|
||||
|
||||
AddUntilStep("wait for selection lost", () => songSelect.Beatmap.IsDefault);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -127,6 +127,8 @@ public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBind
|
|||
private Sample sampleChangeDifficulty = null!;
|
||||
private Sample sampleChangeBeatmap = null!;
|
||||
|
||||
private bool pendingFilterApplication;
|
||||
|
||||
private Container carouselContainer = null!;
|
||||
|
||||
protected BeatmapDetailArea BeatmapDetails { get; private set; } = null!;
|
||||
|
@ -328,7 +330,20 @@ private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog
|
|||
GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
|
||||
}, c => carouselContainer.Child = c);
|
||||
|
||||
FilterControl.FilterChanged = Carousel.Filter;
|
||||
FilterControl.FilterChanged = criteria =>
|
||||
{
|
||||
// If a filter operation is applied when we're in a state that doesn't allow selection,
|
||||
// we might end up in an unexpected state. This is because currently carousel panels are in charge
|
||||
// of updating the global selection (which is very hard to deal with).
|
||||
//
|
||||
// For now let's just avoid filtering when selection isn't allowed locally.
|
||||
// This should be nuked from existence when we get around to fixing the complexity of song select <-> beatmap carousel.
|
||||
// The debounce part of BeatmapCarousel's filtering should probably also be removed and handled locally.
|
||||
if (Carousel.AllowSelection)
|
||||
Carousel.Filter(criteria);
|
||||
else
|
||||
pendingFilterApplication = true;
|
||||
};
|
||||
|
||||
if (ShowSongSelectFooter)
|
||||
{
|
||||
|
@ -701,6 +716,12 @@ public override void OnResuming(ScreenTransitionEvent e)
|
|||
|
||||
Carousel.AllowSelection = true;
|
||||
|
||||
if (pendingFilterApplication)
|
||||
{
|
||||
Carousel.Filter(FilterControl.CreateCriteria());
|
||||
pendingFilterApplication = false;
|
||||
}
|
||||
|
||||
BeatmapDetails.Refresh();
|
||||
|
||||
beginLooping();
|
||||
|
|
Loading…
Reference in New Issue