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

Extract wait logic into separate method

Also reduces the required wait time.
This commit is contained in:
Dean Herbert 2019-02-26 10:11:36 +09:00
parent c58d305fc6
commit 217f692798

View File

@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
}); });
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
} }
@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
InputManager.MoveMouseTo(playerLoader.ScreenPos); InputManager.MoveMouseTo(playerLoader.ScreenPos);
}); });
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
} }
@ -130,10 +130,10 @@ namespace osu.Game.Tests.Visual
player.ReplacesBackground.Value = true; player.ReplacesBackground.Value = true;
player.StoryboardEnabled.Value = true; player.StoryboardEnabled.Value = true;
}); });
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Background is invisible", () => songSelect.IsBackgroundInvisible()); AddAssert("Background is invisible", () => songSelect.IsBackgroundInvisible());
AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false);
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible());
} }
@ -159,7 +159,7 @@ namespace osu.Game.Tests.Visual
return true; return true;
}, "Wait for song select is current"); }, "Wait for song select is current");
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible());
} }
@ -171,7 +171,7 @@ namespace osu.Game.Tests.Visual
{ {
performSetup(); performSetup();
AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false);
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
} }
@ -183,7 +183,7 @@ namespace osu.Game.Tests.Visual
{ {
performSetup(); performSetup();
AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true);
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
} }
@ -199,7 +199,7 @@ namespace osu.Game.Tests.Visual
if (!player.IsPaused.Value) if (!player.IsPaused.Value)
player.Exit(); player.Exit();
}); });
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
} }
@ -211,7 +211,7 @@ namespace osu.Game.Tests.Visual
{ {
performSetup(); performSetup();
AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } })));
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
} }
@ -233,10 +233,12 @@ namespace osu.Game.Tests.Visual
return true; return true;
}, "Wait for song select is current"); }, "Wait for song select is current");
AddWaitStep(5, "Wait for dim"); waitForDim();
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
} }
private void waitForDim() => AddWaitStep(3, "Wait for dim");
private void performSetup() private void performSetup()
{ {
createSongSelect(); createSongSelect();