1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:02:54 +08:00

Fix Loader and TestCaseLoaderAnimation

This commit is contained in:
Dean Herbert 2019-03-27 22:27:53 +09:00
parent a14701619e
commit 5c4f2cefea
2 changed files with 14 additions and 7 deletions

View File

@ -2,6 +2,7 @@
// 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.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.Framework.Screens;
@ -12,19 +13,24 @@ using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Menus namespace osu.Game.Tests.Visual.Menus
{ {
[TestFixture] [TestFixture]
public class TestCaseLoaderAnimation : OsuTestCase public class TestCaseLoaderAnimation : ScreenTestCase
{ {
private TestLoader loader; private TestLoader loader;
[Cached]
private OsuLogo logo;
public TestCaseLoaderAnimation()
{
Add(logo = new OsuLogo { Depth = float.MinValue });
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
// required to preload the logo in a headless run (so it doesn't delay the loading itself).
Add(new OsuLogo());
bool logoVisible = false; bool logoVisible = false;
AddStep("almost instant display", () => Child = loader = new TestLoader(250)); AddStep("almost instant display", () => LoadScreen(loader = new TestLoader(250)));
AddUntilStep("loaded", () => AddUntilStep("loaded", () =>
{ {
logoVisible = loader.Logo?.Alpha > 0; logoVisible = loader.Logo?.Alpha > 0;
@ -32,7 +38,7 @@ namespace osu.Game.Tests.Visual.Menus
}); });
AddAssert("logo not visible", () => !logoVisible); AddAssert("logo not visible", () => !logoVisible);
AddStep("short load", () => Child = loader = new TestLoader(800)); AddStep("short load", () => LoadScreen(loader = new TestLoader(800)));
AddUntilStep("loaded", () => AddUntilStep("loaded", () =>
{ {
logoVisible = loader.Logo?.Alpha > 0; logoVisible = loader.Logo?.Alpha > 0;
@ -41,7 +47,7 @@ namespace osu.Game.Tests.Visual.Menus
AddAssert("logo visible", () => logoVisible); AddAssert("logo visible", () => logoVisible);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
AddStep("longer load", () => Child = loader = new TestLoader(1400)); AddStep("longer load", () => LoadScreen(loader = new TestLoader(1400)));
AddUntilStep("loaded", () => AddUntilStep("loaded", () =>
{ {
logoVisible = loader.Logo?.Alpha > 0; logoVisible = loader.Logo?.Alpha > 0;

View File

@ -36,6 +36,7 @@ namespace osu.Game.Screens
logo.BeatMatching = false; logo.BeatMatching = false;
logo.Triangles = false; logo.Triangles = false;
logo.RelativePositionAxes = Axes.None;
logo.Origin = Anchor.BottomRight; logo.Origin = Anchor.BottomRight;
logo.Anchor = Anchor.BottomRight; logo.Anchor = Anchor.BottomRight;
logo.Position = new Vector2(-40); logo.Position = new Vector2(-40);