mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 05:53:10 +08:00
Simplfiy and share notification dimsiss method across test scenes
Might as well inline, but I feel like it will require adding the same comment across all usages, because just `State.Value = Hidden` in an until step feels off, dunno.
This commit is contained in:
parent
c2f5376e82
commit
daadc3fc21
@ -59,8 +59,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// dismiss any notifications that may appear (ie. muted notification).
|
DismissAnyNotifications();
|
||||||
clickMouseInCentre();
|
|
||||||
return player != null;
|
return player != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,12 +72,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddAssert("key counter did increase", () => keyCounter.CountPresses == 1);
|
AddAssert("key counter did increase", () => keyCounter.CountPresses == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickMouseInCentre()
|
|
||||||
{
|
|
||||||
InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre);
|
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
}
|
|
||||||
|
|
||||||
private KeyBindingsSubsection osuBindingSubsection => keyBindingPanel
|
private KeyBindingsSubsection osuBindingSubsection => keyBindingPanel
|
||||||
.ChildrenOfType<VariantBindingsSubsection>()
|
.ChildrenOfType<VariantBindingsSubsection>()
|
||||||
.FirstOrDefault(s => s.Ruleset.ShortName == "osu");
|
.FirstOrDefault(s => s.Ruleset.ShortName == "osu");
|
||||||
|
@ -89,18 +89,11 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// dismiss any notifications that may appear (ie. muted notification).
|
DismissAnyNotifications();
|
||||||
clickMouseInCentre();
|
|
||||||
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for play time active", () => !player.IsBreakTime.Value);
|
AddUntilStep("wait for play time active", () => !player.IsBreakTime.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickMouseInCentre()
|
|
||||||
{
|
|
||||||
InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre);
|
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// dismiss any notifications that may appear (ie. muted notification).
|
DismissAnyNotifications();
|
||||||
clickMouseInCentre();
|
|
||||||
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -280,8 +279,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// dismiss any notifications that may appear (ie. muted notification).
|
DismissAnyNotifications();
|
||||||
clickMouseInCentre();
|
|
||||||
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -596,8 +594,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// dismiss any notifications that may appear (ie. muted notification).
|
DismissAnyNotifications();
|
||||||
clickMouseInCentre();
|
|
||||||
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
return (player = Game.ScreenStack.CurrentScreen as Player) != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -607,12 +604,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
return () => player;
|
return () => player;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickMouseInCentre()
|
|
||||||
{
|
|
||||||
InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre);
|
|
||||||
InputManager.Click(MouseButton.Left);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pushEscape() =>
|
private void pushEscape() =>
|
||||||
AddStep("Press escape", () => InputManager.Key(Key.Escape));
|
AddStep("Press escape", () => InputManager.Key(Key.Escape));
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osuTK.Input;
|
||||||
using IntroSequence = osu.Game.Configuration.IntroSequence;
|
using IntroSequence = osu.Game.Configuration.IntroSequence;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -106,6 +108,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected void ConfirmAtMainMenu() => AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
protected void ConfirmAtMainMenu() => AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu menu && menu.IsLoaded);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dismisses any notifications pushed which block from interacting with the game (or block screens from loading, e.g. <see cref="Player"/>).
|
||||||
|
/// </summary>
|
||||||
|
protected void DismissAnyNotifications() => Game.Notifications.State.Value = Visibility.Hidden;
|
||||||
|
|
||||||
public class TestOsuGame : OsuGame
|
public class TestOsuGame : OsuGame
|
||||||
{
|
{
|
||||||
public new const float SIDE_OVERLAY_OFFSET_RATIO = OsuGame.SIDE_OVERLAY_OFFSET_RATIO;
|
public new const float SIDE_OVERLAY_OFFSET_RATIO = OsuGame.SIDE_OVERLAY_OFFSET_RATIO;
|
||||||
|
Loading…
Reference in New Issue
Block a user