1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:43:21 +08:00

Make tests use new OsuScreenStack

This commit is contained in:
David Zhao 2019-03-12 16:33:35 +09:00
parent e3567a5507
commit 921c4ce242
6 changed files with 11 additions and 33 deletions

View File

@ -9,7 +9,6 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
@ -54,7 +53,7 @@ namespace osu.Game.Tests.Visual
private BeatmapManager manager;
private RulesetStore rulesets;
private ScreenStackCacheContainer screenStackContainer;
private OsuScreenStack screenStack;
[BackgroundDependencyLoader]
private void load(GameHost host)
@ -85,8 +84,8 @@ namespace osu.Game.Tests.Visual
manager.Delete(manager.GetAllUsableBeatmapSets());
var temp = TestResources.GetTestBeatmapForImport();
manager.Import(temp);
Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both };
screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect());
Child = screenStack = new OsuScreenStack() { RelativeSizeAxes = Axes.Both };
screenStack.Push(songSelect = new DummySongSelect());
});
}
@ -354,20 +353,6 @@ namespace osu.Game.Tests.Visual
}
}
private class ScreenStackCacheContainer : Container
{
[Cached]
private BackgroundScreenStack backgroundScreenStack;
public readonly ScreenStack ScreenStack;
public ScreenStackCacheContainer()
{
Add(backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both });
Add(ScreenStack = new ScreenStack { RelativeSizeAxes = Axes.Both });
}
}
private class DimAccessiblePlayerLoader : PlayerLoader
{
public VisualSettings VisualSettingsPos => VisualSettings;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual
{
int index = 0;
ScreenStack screenStack = new ScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both };
OsuScreenStack screenStack = new OsuScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both };
Children = new Drawable[]
{

View File

@ -14,15 +14,11 @@ namespace osu.Game.Tests.Visual
public class TestCasePlayerLoader : ManualInputManagerTestCase
{
private PlayerLoader loader;
private readonly ScreenStack stack;
[Cached]
private BackgroundScreenStack backgroundStack;
private readonly OsuScreenStack stack;
public TestCasePlayerLoader()
{
InputManager.Add(backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both });
InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both });
InputManager.Add(stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both });
}
[BackgroundDependencyLoader]

View File

@ -19,14 +19,14 @@ namespace osu.Game.Tests.Visual
public class TestCaseScreenBreadcrumbControl : OsuTestCase
{
private readonly ScreenBreadcrumbControl breadcrumbs;
private readonly ScreenStack screenStack;
private readonly OsuScreenStack screenStack;
public TestCaseScreenBreadcrumbControl()
{
OsuSpriteText titleText;
IScreen startScreen = new TestScreenOne();
screenStack = new ScreenStack(startScreen) { RelativeSizeAxes = Axes.Both };
screenStack = new OsuScreenStack(startScreen) { RelativeSizeAxes = Axes.Both };
Children = new Drawable[]
{

View File

@ -6,6 +6,7 @@ using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Screens;
using osu.Game.Screens.Backgrounds;
namespace osu.Game.Tests

View File

@ -13,17 +13,13 @@ namespace osu.Game.Tests.Visual
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
{
private readonly ScreenStack stack;
[Cached]
private BackgroundScreenStack backgroundStack;
private readonly OsuScreenStack stack;
protected ScreenTestCase()
{
Children = new Drawable[]
{
backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
stack = new ScreenStack { RelativeSizeAxes = Axes.Both }
stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }
};
}