mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Merge pull request #7130 from peppy/fix-song-select-filters
Fix song select filters not reapplied if in a child screen
This commit is contained in:
commit
1ba59d6d5f
@ -95,6 +95,42 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoFilterOnSimpleResume()
|
||||
{
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
|
||||
AddStep("return", () => songSelect.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
|
||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFilterOnResumeAfterChange()
|
||||
{
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
|
||||
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, false));
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
|
||||
AddStep("change convert setting", () => config.Set(OsuSetting.ShowConvertedBeatmaps, true));
|
||||
|
||||
AddStep("return", () => songSelect.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
|
||||
AddAssert("filter count is 2", () => songSelect.FilterCount == 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAudioResuming()
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual
|
||||
AddAssert("Parallax is off", () => stack.ParallaxAmount == 0);
|
||||
}
|
||||
|
||||
private class TestScreen : ScreenWithBeatmapBackground
|
||||
public class TestScreen : ScreenWithBeatmapBackground
|
||||
{
|
||||
private readonly string screenText;
|
||||
|
||||
|
@ -262,8 +262,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
|
||||
{
|
||||
if (this.IsCurrentScreen())
|
||||
Carousel.Filter(criteria);
|
||||
// if not the current screen, we want to get carousel in a good presentation state before displaying (resume or enter).
|
||||
bool shouldDebounce = this.IsCurrentScreen();
|
||||
|
||||
Schedule(() => Carousel.Filter(criteria, shouldDebounce));
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
@ -437,8 +439,6 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
Carousel.Filter(FilterControl.CreateCriteria(), false);
|
||||
|
||||
this.FadeInFromZero(250);
|
||||
FilterControl.Activate();
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual
|
||||
/// </summary>
|
||||
public abstract class ScreenTestScene : ManualInputManagerTestScene
|
||||
{
|
||||
private readonly OsuScreenStack stack;
|
||||
protected readonly OsuScreenStack Stack;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
@ -22,16 +22,16 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
base.Content.AddRange(new Drawable[]
|
||||
{
|
||||
stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
||||
Stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
||||
content = new Container { RelativeSizeAxes = Axes.Both }
|
||||
});
|
||||
}
|
||||
|
||||
protected void LoadScreen(OsuScreen screen)
|
||||
{
|
||||
if (stack.CurrentScreen != null)
|
||||
stack.Exit();
|
||||
stack.Push(screen);
|
||||
if (Stack.CurrentScreen != null)
|
||||
Stack.Exit();
|
||||
Stack.Push(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user