diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelect.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelect.cs index 8419684b27..e4f05b2e49 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelect.cs @@ -213,7 +213,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 AddAssert("mods selected", () => SelectedMods.Value, () => Has.Count.EqualTo(1)); AddStep("right click mod button", () => { - InputManager.MoveMouseTo(Footer.ChildrenOfType().Single()); + InputManager.MoveMouseTo(ScreenFooter.ChildrenOfType().Single()); InputManager.Click(MouseButton.Right); }); AddAssert("not mods selected", () => SelectedMods.Value, () => Has.Count.EqualTo(0)); @@ -620,7 +620,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 AddAssert("previous random invoked", () => previousRandomCalled && !nextRandomCalled); } - private FooterButtonRandom randomButton => Footer.ChildrenOfType().Single(); + private FooterButtonRandom randomButton => ScreenFooter.ChildrenOfType().Single(); [Test] public void TestFooterOptions() diff --git a/osu.Game/Tests/Visual/ScreenTestScene.cs b/osu.Game/Tests/Visual/ScreenTestScene.cs index 42199faa4d..7d28ee1d1d 100644 --- a/osu.Game/Tests/Visual/ScreenTestScene.cs +++ b/osu.Game/Tests/Visual/ScreenTestScene.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Logging; -using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Overlays; @@ -34,12 +33,16 @@ namespace osu.Game.Tests.Visual protected DialogOverlay DialogOverlay { get; private set; } [Cached] - protected ScreenFooter Footer { get; private set; } + protected ScreenFooter ScreenFooter { get; private set; } protected ScreenTestScene() { + ScreenStackFooter screenStackFooter; + ScreenFooter.BackReceptor backReceptor; + base.Content.AddRange(new Drawable[] { + backReceptor = new ScreenFooter.BackReceptor(), Stack = new OsuScreenStack { Name = nameof(ScreenTestScene), @@ -51,7 +54,10 @@ namespace osu.Game.Tests.Visual Children = new Drawable[] { content = new Container { RelativeSizeAxes = Axes.Both }, - Footer = new ScreenFooter(), + screenStackFooter = new ScreenStackFooter(Stack, backReceptor) + { + BackButtonPressed = () => Stack.Exit() + } } }, overlayContent = new Container @@ -61,16 +67,10 @@ namespace osu.Game.Tests.Visual }, }); - Stack.ScreenPushed += (oldScreen, newScreen) => - { - updateFooter(oldScreen, newScreen); - Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}"); - }; - Stack.ScreenExited += (oldScreen, newScreen) => - { - updateFooter(oldScreen, newScreen); - Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}"); - }; + ScreenFooter = screenStackFooter.Footer; + + Stack.ScreenPushed += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed → {newScreen}"); + Stack.ScreenExited += (_, newScreen) => Logger.Log($"{nameof(ScreenTestScene)} screen changed ← {newScreen}"); } protected void LoadScreen(OsuScreen screen) => Stack.Push(screen); @@ -96,39 +96,6 @@ namespace osu.Game.Tests.Visual }); } - private void updateFooter(IScreen? _, IScreen? newScreen) - { - if (newScreen is OsuScreen osuScreen && osuScreen.ShowFooter) - { - Footer.Show(); - - if (osuScreen.IsLoaded) - updateFooterButtons(); - else - { - // ensure the current buttons are immediately disabled on screen change (so they can't be pressed). - Footer.SetButtons(Array.Empty()); - - osuScreen.OnLoadComplete += _ => updateFooterButtons(); - } - - void updateFooterButtons() - { - var buttons = osuScreen.CreateFooterButtons(); - - osuScreen.LoadComponentsAgainstScreenDependencies(buttons); - - Footer.SetButtons(buttons); - Footer.Show(); - } - } - else - { - Footer.Hide(); - Footer.SetButtons(Array.Empty()); - } - } - #region IOverlayManager IBindable IOverlayManager.OverlayActivationMode { get; } = new Bindable(OverlayActivation.All);