mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 11:12:59 +08:00
Also ensure filter is applied when returning to song select
This commit is contained in:
parent
c192a6a1d5
commit
743d509241
@ -150,6 +150,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
TestPlaySongSelect songSelect = null;
|
TestPlaySongSelect songSelect = null;
|
||||||
|
|
||||||
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||||
|
AddUntilStep("wait for song select", () => songSelect.BeatmapSetsLoaded);
|
||||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
@ -158,6 +159,11 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
songSelect.FinaliseSelection();
|
songSelect.FinaliseSelection();
|
||||||
songSelect.FilterControl.CurrentTextSearch.Value = "test";
|
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]
|
[Test]
|
||||||
|
@ -127,6 +127,8 @@ namespace osu.Game.Screens.Select
|
|||||||
private Sample sampleChangeDifficulty = null!;
|
private Sample sampleChangeDifficulty = null!;
|
||||||
private Sample sampleChangeBeatmap = null!;
|
private Sample sampleChangeBeatmap = null!;
|
||||||
|
|
||||||
|
private bool pendingFilterApplication;
|
||||||
|
|
||||||
private Container carouselContainer = null!;
|
private Container carouselContainer = null!;
|
||||||
|
|
||||||
protected BeatmapDetailArea BeatmapDetails { get; private set; } = null!;
|
protected BeatmapDetailArea BeatmapDetails { get; private set; } = null!;
|
||||||
@ -328,7 +330,20 @@ namespace osu.Game.Screens.Select
|
|||||||
GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
|
GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
|
||||||
}, c => carouselContainer.Child = c);
|
}, 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)
|
if (ShowSongSelectFooter)
|
||||||
{
|
{
|
||||||
@ -701,6 +716,12 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Carousel.AllowSelection = true;
|
Carousel.AllowSelection = true;
|
||||||
|
|
||||||
|
if (pendingFilterApplication)
|
||||||
|
{
|
||||||
|
Carousel.Filter(FilterControl.CreateCriteria());
|
||||||
|
pendingFilterApplication = false;
|
||||||
|
}
|
||||||
|
|
||||||
BeatmapDetails.Refresh();
|
BeatmapDetails.Refresh();
|
||||||
|
|
||||||
beginLooping();
|
beginLooping();
|
||||||
|
Loading…
Reference in New Issue
Block a user