1
0
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:
Dan Balasescu 2019-12-10 13:42:22 +09:00 committed by GitHub
commit 1ba59d6d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}
}
}