From 2a70e2485b701353c2b6f23fbcd76878c0b7d336 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Mon, 19 May 2025 22:25:48 +0300 Subject: [PATCH 1/3] Add failing test case --- .../TestSceneBeatmapCarouselFiltering.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs index 805d5d3213..146d042ca0 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs @@ -290,5 +290,26 @@ namespace osu.Game.Tests.Visual.SongSelectV2 CheckDisplayedBeatmapsCount(local_set_count); } + + [Test] + public void TestFirstDifficultyFiltered() + { + AddBeatmaps(2, 3); + WaitForDrawablePanels(); + + SelectNextGroup(); + WaitForSelection(0, 0); + + CheckDisplayedBeatmapsCount(6); + + ApplyToFilter("filter first away", c => c.UserStarDifficulty.Min = 3); + WaitForFiltering(); + + CheckDisplayedBeatmapsCount(4); + + SelectNextGroup(); + SelectPrevGroup(); + WaitForSelection(0, 1); + } } } From e2e156c6ba5ca88e857c73bae0d2b42a65cd2b26 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Mon, 19 May 2025 22:26:38 +0300 Subject: [PATCH 2/3] Fix carousel potentially selecting filtered diff when clicking set panel --- osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index 4c70b8c58f..858f278887 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -181,8 +181,9 @@ namespace osu.Game.Screens.SelectV2 return; case BeatmapSetInfo setInfo: - // Selecting a set isn't valid – let's re-select the first difficulty. - CurrentSelection = setInfo.Beatmaps.First(); + // Selecting a set isn't valid – let's re-select the first visible difficulty. + if (grouping.SetItems.TryGetValue(setInfo, out var items)) + CurrentSelection = items.ElementAt(1).Model; return; case BeatmapInfo beatmapInfo: From 59b0ab7f4695db16cef449d8e319a5a1490a92c3 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Tue, 20 May 2025 21:42:19 +0300 Subject: [PATCH 3/3] Use better method to select first difficulty --- osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index 858f278887..4784eaeb32 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -183,7 +183,8 @@ namespace osu.Game.Screens.SelectV2 case BeatmapSetInfo setInfo: // Selecting a set isn't valid – let's re-select the first visible difficulty. if (grouping.SetItems.TryGetValue(setInfo, out var items)) - CurrentSelection = items.ElementAt(1).Model; + CurrentSelection = items.Select(i => i.Model).OfType().First(); + return; case BeatmapInfo beatmapInfo: