mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 09:02:58 +08:00
Merge pull request #22449 from Joehuu/fix-clicking-metadata-relevance-sort
Fix beatmap listing potentially not sorting by relevance when searching via metadata
This commit is contained in:
commit
a8a6a28422
@ -563,6 +563,18 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddUntilStep("featured artist filter is off", () => !getBeatmapListingOverlay().ChildrenOfType<BeatmapSearchGeneralFilterRow>().First().Current.Contains(SearchGeneral.FeaturedArtists));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapListingLinkSearchOnInitialOpen()
|
||||
{
|
||||
BeatmapListingOverlay getBeatmapListingOverlay() => Game.ChildrenOfType<BeatmapListingOverlay>().FirstOrDefault();
|
||||
|
||||
AddStep("open beatmap overlay with test query", () => Game.SearchBeatmapSet("test"));
|
||||
|
||||
AddUntilStep("wait for beatmap overlay to load", () => getBeatmapListingOverlay()?.State.Value == Visibility.Visible);
|
||||
|
||||
AddAssert("beatmap overlay sorted by relevance", () => getBeatmapListingOverlay().ChildrenOfType<BeatmapListingSortTabControl>().Single().Current.Value == SortCriteria.Relevance);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMainOverlaysClosesNotificationOverlay()
|
||||
{
|
||||
|
@ -17,18 +17,21 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>(Overlays.SortDirection.Descending);
|
||||
|
||||
private SearchCategory? lastCategory;
|
||||
private bool? lastHasQuery;
|
||||
private (SearchCategory category, bool hasQuery)? currentParameters;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Reset(SearchCategory.Leaderboard, false);
|
||||
|
||||
if (currentParameters == null)
|
||||
Reset(SearchCategory.Leaderboard, false);
|
||||
}
|
||||
|
||||
public void Reset(SearchCategory category, bool hasQuery)
|
||||
{
|
||||
if (category != lastCategory || hasQuery != lastHasQuery)
|
||||
var newParameters = (category, hasQuery);
|
||||
|
||||
if (currentParameters != newParameters)
|
||||
{
|
||||
TabControl.Clear();
|
||||
|
||||
@ -63,8 +66,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
// see: https://github.com/ppy/osu-framework/issues/5412
|
||||
TabControl.Current.TriggerChange();
|
||||
|
||||
lastCategory = category;
|
||||
lastHasQuery = hasQuery;
|
||||
currentParameters = newParameters;
|
||||
}
|
||||
|
||||
protected override SortTabControl CreateControl() => new BeatmapSortTabControl
|
||||
|
Loading…
Reference in New Issue
Block a user