Skip to content

Commit

Permalink
Fix sort direction being flipped
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 23, 2025
1 parent 54efefa commit 8712fe4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ protected void AddBeatmaps(int count) => AddStep($"add {count} beatmaps", () =>
BeatmapSets.Add(TestResources.CreateTestBeatmapSetInfo(RNG.Next(1, 4)));
});

protected void RemoveLastBeatmap() =>
AddStep("remove last beatmap", () =>
protected void RemoveFirstBeatmap() =>
AddStep("remove first beatmap", () =>
{
if (BeatmapSets.Count == 0) return;

BeatmapSets.Remove(BeatmapSets.Last());
BeatmapSets.Remove(BeatmapSets.First());
});

private void updateStats()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void TestBasics()
{
AddBeatmaps(1);
AddBeatmaps(10);
RemoveLastBeatmap();
RemoveFirstBeatmap();
AddStep("remove all beatmaps", () => BeatmapSets.Clear());
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public void TestScrollPositionMaintainedOnAddSecondSelected()

AddStep("save selected screen position", () => positionBefore = Carousel.ChildrenOfType<BeatmapCarouselPanel>().FirstOrDefault(p => p.Selected.Value)!.ScreenSpaceDrawQuad);

RemoveLastBeatmap();
RemoveFirstBeatmap();
WaitForSorting();

AddAssert("select screen position unchanged", () => Carousel.ChildrenOfType<BeatmapCarouselPanel>().Single(p => p.Selected.Value).ScreenSpaceDrawQuad,
Expand All @@ -79,13 +79,13 @@ public void TestScrollPositionMaintainedOnAddLastSelected()

AddStep("scroll to last item", () => Scroll.ScrollToEnd(false));

AddStep("select last beatmap", () => Carousel.CurrentSelection = BeatmapSets.First());
AddStep("select last beatmap", () => Carousel.CurrentSelection = BeatmapSets.Last());

WaitForScrolling();

AddStep("save selected screen position", () => positionBefore = Carousel.ChildrenOfType<BeatmapCarouselPanel>().FirstOrDefault(p => p.Selected.Value)!.ScreenSpaceDrawQuad);

RemoveLastBeatmap();
RemoveFirstBeatmap();
WaitForSorting();
AddAssert("select screen position unchanged", () => Carousel.ChildrenOfType<BeatmapCarouselPanel>().Single(p => p.Selected.Value).ScreenSpaceDrawQuad,
() => Is.EqualTo(positionBefore));
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task<IEnumerable<CarouselItem>> Run(IEnumerable<CarouselItem> items
{
var criteria = getCriteria();

return items.OrderDescending(Comparer<CarouselItem>.Create((a, b) =>
return items.Order(Comparer<CarouselItem>.Create((a, b) =>
{
int comparison;

Expand Down

0 comments on commit 8712fe4

Please sign in to comment.