2019-01-24 16:43:03 +08:00
|
|
|
|
// 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 10:00:44 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-29 13:34:58 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
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>
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public abstract class ScreenTestScene : ManualInputManagerTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-12-10 01:30:23 +08:00
|
|
|
|
protected readonly OsuScreenStack Stack;
|
2019-01-31 13:55:48 +08:00
|
|
|
|
|
2019-03-29 13:34:58 +08:00
|
|
|
|
private readonly Container content;
|
|
|
|
|
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
protected ScreenTestScene()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-29 13:34:58 +08:00
|
|
|
|
base.Content.AddRange(new Drawable[]
|
|
|
|
|
{
|
2019-12-10 01:30:23 +08:00
|
|
|
|
Stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
2019-03-29 13:34:58 +08:00
|
|
|
|
content = new Container { 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)
|
|
|
|
|
{
|
2019-12-10 01:30:23 +08:00
|
|
|
|
if (Stack.CurrentScreen != null)
|
|
|
|
|
Stack.Exit();
|
|
|
|
|
Stack.Push(screen);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|