1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 07:32:54 +08:00
osu-lazer/osu.Game/Tests/Visual/ScreenTestCase.cs
Dean Herbert 868367511e Add ManualInputManager to screen tests
Also sanitises content init order (ctor for content; bdl for other)
2019-03-26 13:26:55 +09:00

31 lines
909 B
C#

// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : ManualInputManagerTestCase
{
private OsuScreenStack stack;
[BackgroundDependencyLoader]
private void load()
{
Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both };
}
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
}
}
}