1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00

Fix song select filters not reapplied if in a child screen

Closes https://github.com/ppy/osu/issues/6980.
This commit is contained in:
Dean Herbert 2019-12-10 02:30:23 +09:00
parent 428065ff43
commit cdde5d1d69
4 changed files with 46 additions and 10 deletions

View File

@ -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()
{

View File

@ -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;

View File

@ -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();
}

View File

@ -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);
}
}
}