mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
fix tests
This commit is contained in:
@ -13,8 +13,10 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
@ -25,6 +27,8 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
private GameHost gameHost;
|
private GameHost gameHost;
|
||||||
private TestOsuGame osuGame;
|
private TestOsuGame osuGame;
|
||||||
|
|
||||||
|
private Vector2 backButtonPosition => osuGame.ToScreenSpace(new Vector2(0, osuGame.LayoutRectangle.Bottom));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost gameHost)
|
private void load(GameHost gameHost)
|
||||||
{
|
{
|
||||||
@ -50,7 +54,8 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
|
|
||||||
Add(osuGame);
|
Add(osuGame);
|
||||||
});
|
});
|
||||||
AddUntilStep("Wait for main menu", () => osuGame.IsLoaded && osuGame.ScreenStack.CurrentScreen is MainMenu);
|
AddUntilStep("Wait for load", () => osuGame.IsLoaded);
|
||||||
|
AddUntilStep("Wait for main menu", () => osuGame.ScreenStack.CurrentScreen is MainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -80,7 +85,7 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == osuGame.BackButton));
|
AddUntilStep("Back button is hovered", () => InputManager.HoveredDrawables.Any(d => d.Parent == osuGame.BackButton));
|
||||||
|
|
||||||
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
AddStep("Click back button", () => InputManager.Click(MouseButton.Left));
|
||||||
AddAssert("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
|
AddUntilStep("Overlay was hidden", () => songSelect.ModSelectOverlay.State.Value == Visibility.Hidden);
|
||||||
exitViaBackButtonAndConfirm();
|
exitViaBackButtonAndConfirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +107,7 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
{
|
{
|
||||||
Screen screen = null;
|
Screen screen = null;
|
||||||
AddStep($"Push new {screenName}", () => osuGame.ScreenStack.Push(screen = newScreen()));
|
AddStep($"Push new {screenName}", () => osuGame.ScreenStack.Push(screen = newScreen()));
|
||||||
AddUntilStep($"Wait for new {screenName}", () => screen.IsCurrentScreen());
|
AddUntilStep($"Wait for new {screenName}", () => osuGame.ScreenStack.CurrentScreen == screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitViaEscapeAndConfirm()
|
private void exitViaEscapeAndConfirm()
|
||||||
@ -129,11 +134,23 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
public new ScreenStack ScreenStack => base.ScreenStack;
|
public new ScreenStack ScreenStack => base.ScreenStack;
|
||||||
|
|
||||||
public new BackButton BackButton => base.BackButton;
|
public new BackButton BackButton => base.BackButton;
|
||||||
|
|
||||||
|
protected override Loader CreateLoader() => new TestLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestSongSelect : PlaySongSelect
|
private class TestSongSelect : PlaySongSelect
|
||||||
{
|
{
|
||||||
public ModSelectOverlay ModSelectOverlay => ModSelect;
|
public ModSelectOverlay ModSelectOverlay => ModSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestLoader : Loader
|
||||||
|
{
|
||||||
|
protected override ShaderPrecompiler CreateShaderPrecompiler() => new TestShaderPrecompiler();
|
||||||
|
|
||||||
|
private class TestShaderPrecompiler : ShaderPrecompiler
|
||||||
|
{
|
||||||
|
protected override bool AllLoaded => true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
|
protected virtual Loader CreateLoader() => new Loader();
|
||||||
|
|
||||||
public OsuGame(string[] args = null)
|
public OsuGame(string[] args = null)
|
||||||
{
|
{
|
||||||
this.args = args;
|
this.args = args;
|
||||||
@ -439,10 +441,7 @@ namespace osu.Game
|
|||||||
logoContainer.Add(logo);
|
logoContainer.Add(logo);
|
||||||
|
|
||||||
// Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering.
|
// Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering.
|
||||||
ScreenStack.Push(new Loader
|
ScreenStack.Push(CreateLoader().With(l => l.RelativeSizeAxes = Axes.Both));
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
loadComponentSingleFile(Toolbar = new Toolbar
|
loadComponentSingleFile(Toolbar = new Toolbar
|
||||||
|
@ -316,7 +316,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
if (impact)
|
if (impact)
|
||||||
logo.Impact();
|
logo?.Impact();
|
||||||
|
|
||||||
game?.Toolbar.Show();
|
game?.Toolbar.Show();
|
||||||
}, 200);
|
}, 200);
|
||||||
|
Reference in New Issue
Block a user