1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Fix intro tests and move steps out of constructor

This commit is contained in:
Dean Herbert 2021-10-07 18:39:48 +09:00
parent f88d898960
commit 189358240d
4 changed files with 12 additions and 10 deletions

View File

@ -5,7 +5,6 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Screens;
using osu.Game.Screens; using osu.Game.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK; using osuTK;
@ -21,6 +20,8 @@ namespace osu.Game.Tests.Visual.Menus
protected OsuScreenStack IntroStack; protected OsuScreenStack IntroStack;
private IntroScreen intro;
protected IntroTestScene() protected IntroTestScene()
{ {
Children = new Drawable[] Children = new Drawable[]
@ -39,7 +40,11 @@ namespace osu.Game.Tests.Visual.Menus
Position = new Vector2(0.5f), Position = new Vector2(0.5f),
} }
}; };
}
[Test]
public void TestPlayIntro()
{
AddStep("restart sequence", () => AddStep("restart sequence", () =>
{ {
logo.FinishTransforms(); logo.FinishTransforms();
@ -52,12 +57,12 @@ namespace osu.Game.Tests.Visual.Menus
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}); });
IntroStack.Push(CreateScreen()); IntroStack.Push(intro = CreateScreen());
}); });
AddUntilStep("wait for menu", () => IntroStack.CurrentScreen is MainMenu); AddUntilStep("wait for menu", () => intro.DidLoadMenu);
} }
protected abstract IScreen CreateScreen(); protected abstract IntroScreen CreateScreen();
} }
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus namespace osu.Game.Tests.Visual.Menus
@ -10,6 +9,6 @@ namespace osu.Game.Tests.Visual.Menus
[TestFixture] [TestFixture]
public class TestSceneIntroCircles : IntroTestScene public class TestSceneIntroCircles : IntroTestScene
{ {
protected override IScreen CreateScreen() => new IntroCircles(); protected override IntroScreen CreateScreen() => new IntroCircles();
} }
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus namespace osu.Game.Tests.Visual.Menus
@ -10,6 +9,6 @@ namespace osu.Game.Tests.Visual.Menus
[TestFixture] [TestFixture]
public class TestSceneIntroTriangles : IntroTestScene public class TestSceneIntroTriangles : IntroTestScene
{ {
protected override IScreen CreateScreen() => new IntroTriangles(); protected override IntroScreen CreateScreen() => new IntroTriangles();
} }
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Screens;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
@ -11,7 +10,7 @@ namespace osu.Game.Tests.Visual.Menus
[TestFixture] [TestFixture]
public class TestSceneIntroWelcome : IntroTestScene public class TestSceneIntroWelcome : IntroTestScene
{ {
protected override IScreen CreateScreen() => new IntroWelcome(); protected override IntroScreen CreateScreen() => new IntroWelcome();
public TestSceneIntroWelcome() public TestSceneIntroWelcome()
{ {