1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-30 21:07:35 +08:00
osu-lazer/osu.Game/Tests/Visual/ScreenTestCase.cs

38 lines
1.1 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
2019-01-31 13:55:48 +08:00
using osu.Framework.Allocation;
2019-01-31 10:00:44 +08:00
using osu.Framework.Graphics;
2018-04-13 17:19:50 +08:00
using osu.Framework.Screens;
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 : OsuTestCase
{
2019-01-31 10:00:44 +08:00
private readonly ScreenStack stack;
2018-04-13 17:19:50 +08:00
2019-01-31 13:55:48 +08:00
[Cached]
private BackgroundScreenStack backgroundStack;
2018-04-13 17:19:50 +08:00
protected ScreenTestCase()
{
2019-01-31 13:55:48 +08:00
Children = new Drawable[]
2018-04-13 17:19:50 +08:00
{
2019-01-31 13:55:48 +08:00
backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
stack = new ScreenStack { RelativeSizeAxes = Axes.Both }
};
2019-01-31 10:00:44 +08:00
}
2018-04-13 17:19:50 +08:00
2019-01-31 10:00:44 +08:00
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
2018-04-13 17:19:50 +08:00
}
}
}