mirror of
https://github.com/ppy/osu.git
synced 2026-05-25 21:21:42 +08:00
Add failing test showing double filter on entering song select
This commit is contained in:
@@ -356,7 +356,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
""");
|
||||
createHeader("carousel");
|
||||
stats.AddParagraph($"""
|
||||
sorting: {Carousel.IsFiltering}
|
||||
filtering: {Carousel.IsFiltering} (total {Carousel.FilterCount} times)
|
||||
tracked: {Carousel.ItemsTracked}
|
||||
displayable: {Carousel.DisplayableItems}
|
||||
displayed: {Carousel.VisibleItems}
|
||||
|
||||
@@ -78,6 +78,15 @@ namespace osu.Game.Tests.Visual.SongSelectV2
|
||||
AddUntilStep("wait for results screen", () => Stack.CurrentScreen is ResultsScreen);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSingleFilterWhenEntering()
|
||||
{
|
||||
ImportBeatmapForRuleset(0);
|
||||
LoadSongSelect();
|
||||
|
||||
AddAssert("single filter", () => Carousel.FilterCount, () => Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCookieDoesNothingIfNothingSelected()
|
||||
{
|
||||
|
||||
@@ -71,6 +71,11 @@ namespace osu.Game.Graphics.Carousel
|
||||
/// </summary>
|
||||
public bool IsFiltering => !filterTask.IsCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// The number of times filter operations have been triggered.
|
||||
/// </summary>
|
||||
internal int FilterCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of displayable items currently being tracked (before filtering).
|
||||
/// </summary>
|
||||
@@ -187,6 +192,8 @@ namespace osu.Game.Graphics.Carousel
|
||||
/// <param name="clearExistingPanels">Whether all existing drawable panels should be reset post filter.</param>
|
||||
protected virtual Task<IEnumerable<CarouselItem>> FilterAsync(bool clearExistingPanels = false)
|
||||
{
|
||||
FilterCount++;
|
||||
|
||||
if (clearExistingPanels)
|
||||
filterReusesPanels.Invalidate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user