Skip to content

Fix rewind incorrectly selecting the same beatmap #26127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,23 @@ public void TestRandom()
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
}

[Test]
public void TestRewind()
{
const int local_set_count = 3;
const int random_select_count = local_set_count * 3;
loadBeatmaps(setCount: local_set_count);

for (int i = 0; i < random_select_count; i++)
nextRandom();

for (int i = 0; i < random_select_count; i++)
{
prevRandom();
AddAssert("correct random last selected", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
}
}

[Test]
public void TestRewindToDeletedBeatmap()
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Select/BeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public void SelectPreviousRandom()
while (randomSelectedBeatmaps.Any())
{
var beatmap = randomSelectedBeatmaps[^1];
randomSelectedBeatmaps.Remove(beatmap);
randomSelectedBeatmaps.RemoveAt(randomSelectedBeatmaps.Count - 1);

if (!beatmap.Filtered.Value && beatmap.BeatmapInfo.BeatmapSet?.DeletePending != true)
{
Expand Down