osu/osu.Game/Tests/Visual/ScreenTestCase.cs

33 lines
902 B
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 09:19:50 +00:00
2019-01-31 02:00:44 +00:00
using osu.Framework.Graphics;
2018-04-13 09:19:50 +00: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 02:00:44 +00:00
private readonly ScreenStack stack;
2018-04-13 09:19:50 +00:00
protected ScreenTestCase()
{
2019-01-31 02:00:44 +00:00
Add(stack = new ScreenStack
2018-04-13 09:19:50 +00:00
{
2019-01-31 02:00:44 +00:00
RelativeSizeAxes = Axes.Both,
2018-04-13 09:19:50 +00:00
});
2019-01-31 02:00:44 +00:00
}
2018-04-13 09:19:50 +00:00
2019-01-31 02:00:44 +00:00
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
2018-04-13 09:19:50 +00:00
}
}
}