Wait for screen current

This commit is contained in:
David Zhao 2019-03-22 15:20:06 +09:00
parent 9a466d97ed
commit 8fb4de101f

View File

@ -18,6 +18,7 @@ namespace osu.Game.Tests.Visual
public class TestCaseOsuScreenStack : OsuTestCase
{
private NoParallaxTestScreen baseScreen;
private TestScreen newScreen;
private TestOsuScreenStack stack;
[SetUpSteps]
@ -25,14 +26,17 @@ namespace osu.Game.Tests.Visual
{
AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; });
AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX.")));
AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen);
}
[Test]
public void ParallaxAssignmentTest()
{
AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX.")));
AddStep("Push new screen to base screen", () => baseScreen.Push(newScreen = new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX.")));
AddUntilStep("Wait for Screen 2 to be current", newScreen.IsCurrentScreen);
AddAssert("Parallax is correct", () => stack.IsParallaxSet);
AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); });
AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen);
AddAssert("Parallax is correct", () => stack.IsParallaxSet);
}