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

Hide manual input manager cursor in OsuGameTestScenes

Allows checking that the cursor is actually hidden in
`TestSceneOsuGame.TestCursorHidesWhenIdle`.
This commit is contained in:
Salman Ahmed 2022-10-15 00:19:40 +03:00
parent 45f590ca43
commit 241ecb63a1
2 changed files with 23 additions and 8 deletions

View File

@ -17,6 +17,7 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -42,6 +43,8 @@ namespace osu.Game.Tests.Visual
protected override bool CreateNestedActionContainer => false; protected override bool CreateNestedActionContainer => false;
protected override bool DisplayCursorForManualInput => false;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -119,6 +122,8 @@ namespace osu.Game.Tests.Visual
public RealmAccess Realm => Dependencies.Get<RealmAccess>(); public RealmAccess Realm => Dependencies.Get<RealmAccess>();
public new GlobalCursorDisplay GlobalCursorDisplay => base.GlobalCursorDisplay;
public new BackButton BackButton => base.BackButton; public new BackButton BackButton => base.BackButton;
public new BeatmapManager BeatmapManager => base.BeatmapManager; public new BeatmapManager BeatmapManager => base.BeatmapManager;

View File

@ -36,21 +36,31 @@ namespace osu.Game.Tests.Visual
/// </summary> /// </summary>
protected virtual bool CreateNestedActionContainer => true; protected virtual bool CreateNestedActionContainer => true;
/// <summary>
/// Whether a menu cursor controlled by the manual input manager should be displayed.
/// True by default, but is disabled for <see cref="OsuGameTestScene"/>s as they provide their own global cursor.
/// </summary>
protected virtual bool DisplayCursorForManualInput => true;
protected OsuManualInputManagerTestScene() protected OsuManualInputManagerTestScene()
{ {
GlobalCursorDisplay cursorDisplay; var mainContent = content = new Container { RelativeSizeAxes = Axes.Both };
CompositeDrawable mainContent = cursorDisplay = new GlobalCursorDisplay { RelativeSizeAxes = Axes.Both }; if (DisplayCursorForManualInput)
cursorDisplay.Child = content = new OsuTooltipContainer(cursorDisplay.MenuCursor)
{ {
RelativeSizeAxes = Axes.Both var cursorDisplay = new GlobalCursorDisplay { RelativeSizeAxes = Axes.Both };
};
cursorDisplay.Add(new OsuTooltipContainer(cursorDisplay.MenuCursor)
{
RelativeSizeAxes = Axes.Both,
Child = mainContent
});
mainContent = cursorDisplay;
}
if (CreateNestedActionContainer) if (CreateNestedActionContainer)
{
mainContent = new GlobalActionContainer(null).WithChild(mainContent); mainContent = new GlobalActionContainer(null).WithChild(mainContent);
}
base.Content.AddRange(new Drawable[] base.Content.AddRange(new Drawable[]
{ {