1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Fix breadcrumb testcase failures

This commit is contained in:
smoogipoo 2018-07-31 13:42:47 +09:00
parent 70edca4474
commit ae8bf34fd1

View File

@ -54,11 +54,11 @@ namespace osu.Game.Tests.Visual
breadcrumbs.Current.TriggerChange(); breadcrumbs.Current.TriggerChange();
assertCurrent(); waitForCurrent();
pushNext(); pushNext();
assertCurrent(); waitForCurrent();
pushNext(); pushNext();
assertCurrent(); waitForCurrent();
AddStep(@"make start current", () => AddStep(@"make start current", () =>
{ {
@ -66,8 +66,9 @@ namespace osu.Game.Tests.Visual
currentScreen = startScreen; currentScreen = startScreen;
}); });
assertCurrent(); waitForCurrent();
pushNext(); pushNext();
waitForCurrent();
AddAssert(@"only 2 items", () => breadcrumbs.Items.Count() == 2); AddAssert(@"only 2 items", () => breadcrumbs.Items.Count() == 2);
AddStep(@"exit current", () => changedScreen.Exit()); AddStep(@"exit current", () => changedScreen.Exit());
AddAssert(@"current screen is first", () => startScreen == changedScreen); AddAssert(@"current screen is first", () => startScreen == changedScreen);
@ -80,7 +81,7 @@ namespace osu.Game.Tests.Visual
} }
private void pushNext() => AddStep(@"push next screen", () => currentScreen = ((TestScreen)currentScreen).PushNext()); private void pushNext() => AddStep(@"push next screen", () => currentScreen = ((TestScreen)currentScreen).PushNext());
private void assertCurrent() => AddAssert(@"changedScreen correct", () => currentScreen == changedScreen); private void waitForCurrent() => AddUntilStep(() => currentScreen.IsCurrentScreen, "current screen");
private abstract class TestScreen : OsuScreen private abstract class TestScreen : OsuScreen
{ {