mirror of https://github.com/ppy/osu
Add texts to make test more visually confirmable, add no parallax screen.
This commit is contained in:
parent
dcae86e39a
commit
9a466d97ed
|
@ -2,32 +2,35 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseOsuScreenStack : OsuTestCase
|
||||
{
|
||||
private TestScreen baseScreen;
|
||||
private NoParallaxTestScreen baseScreen;
|
||||
private TestOsuScreenStack stack;
|
||||
|
||||
[SetUpSteps]
|
||||
public void Setup()
|
||||
{
|
||||
AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; });
|
||||
AddStep("Push new base screen", () => stack.Push(baseScreen = new TestScreen()));
|
||||
AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX.")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParallaxAssignmentTest()
|
||||
{
|
||||
AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen()));
|
||||
AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX.")));
|
||||
AddAssert("Parallax is correct", () => stack.IsParallaxSet);
|
||||
AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); });
|
||||
AddAssert("Parallax is correct", () => stack.IsParallaxSet);
|
||||
|
@ -35,6 +38,32 @@ public void ParallaxAssignmentTest()
|
|||
|
||||
private class TestScreen : ScreenWithBeatmapBackground
|
||||
{
|
||||
private readonly string screenText;
|
||||
|
||||
public TestScreen(string screenText)
|
||||
{
|
||||
this.screenText = screenText;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(new SpriteText
|
||||
{
|
||||
Text = screenText,
|
||||
Colour = Color4.White
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private class NoParallaxTestScreen : TestScreen
|
||||
{
|
||||
public NoParallaxTestScreen(string screenText)
|
||||
: base(screenText)
|
||||
{
|
||||
}
|
||||
|
||||
public override float BackgroundParallaxAmount => 0.0f;
|
||||
}
|
||||
|
||||
private class TestOsuScreenStack : OsuScreenStack
|
||||
|
|
Loading…
Reference in New Issue