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

Fix loader animation tests failing occasionally (#6655)

Fix loader animation tests failing occasionally
This commit is contained in:
Dean Herbert 2019-10-29 18:18:17 +09:00 committed by GitHub
commit 3de45eb04a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,23 +33,15 @@ namespace osu.Game.Tests.Visual.Menus
[Test] [Test]
public void TestInstantLoad() public void TestInstantLoad()
{ {
bool logoVisible = false; // visual only, very impossible to test this using asserts.
AddStep("begin loading", () => AddStep("load immediately", () =>
{ {
loader = new TestLoader(); loader = new TestLoader();
loader.AllowLoad.Set(); loader.AllowLoad.Set();
LoadScreen(loader); LoadScreen(loader);
}); });
AddUntilStep("loaded", () =>
{
logoVisible = loader.Logo?.Alpha > 0;
return loader.Logo != null && loader.ScreenLoaded;
});
AddAssert("logo was not visible", () => !logoVisible);
} }
[Test] [Test]
@ -58,7 +50,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("begin loading", () => LoadScreen(loader = new TestLoader())); AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0); AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0);
AddStep("finish loading", () => loader.AllowLoad.Set()); AddStep("finish loading", () => loader.AllowLoad.Set());
AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded); AddUntilStep("loaded", () => loader.Logo != null && loader.ScreenLoaded);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0); AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
} }