1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 10:02:59 +08:00

Add ManualInputManager to screen tests

Also sanitises content init order (ctor for content; bdl for other)
This commit is contained in:
Dean Herbert 2019-03-26 13:16:46 +09:00
parent 4c0121a112
commit c403dede20
5 changed files with 16 additions and 7 deletions

View File

@ -27,7 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(Type = typeof(IRoomManager))] [Cached(Type = typeof(IRoomManager))]
private TestRoomManager roomManager = new TestRoomManager(); private TestRoomManager roomManager = new TestRoomManager();
public TestCaseLoungeRoomsContainer() [BackgroundDependencyLoader]
private void load()
{ {
RoomsContainer container; RoomsContainer container;

View File

@ -3,6 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams; using osu.Game.Screens.Tournament.Teams;
@ -11,7 +12,8 @@ namespace osu.Game.Tests.Visual.Tournament
[Description("for tournament use")] [Description("for tournament use")]
public class TestCaseDrawings : ScreenTestCase public class TestCaseDrawings : ScreenTestCase
{ {
public TestCaseDrawings() [BackgroundDependencyLoader]
private void load()
{ {
LoadScreen(new Drawings LoadScreen(new Drawings
{ {

View File

@ -14,8 +14,7 @@ namespace osu.Game.Tests.Visual
protected ManualInputManagerTestCase() protected ManualInputManagerTestCase()
{ {
base.Content.Add(InputManager = new ManualInputManager()); base.Content.Add(InputManager = new ManualInputManager { UseParentInput = true });
ReturnUserInput();
} }
/// <summary> /// <summary>

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Linq; using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing; using osu.Framework.Testing;
@ -23,7 +24,11 @@ namespace osu.Game.Tests.Visual
protected PlayerTestCase(Ruleset ruleset) protected PlayerTestCase(Ruleset ruleset)
{ {
this.ruleset = ruleset; this.ruleset = ruleset;
}
[BackgroundDependencyLoader]
private void load()
{
Add(new Box Add(new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens; using osu.Game.Screens;
@ -9,11 +10,12 @@ namespace osu.Game.Tests.Visual
/// <summary> /// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions). /// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary> /// </summary>
public abstract class ScreenTestCase : OsuTestCase public abstract class ScreenTestCase : ManualInputManagerTestCase
{ {
private readonly OsuScreenStack stack; private OsuScreenStack stack;
protected ScreenTestCase() [BackgroundDependencyLoader]
private void load()
{ {
Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
} }