mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:02:55 +08:00
Add test coverage of skip button failure with equal time
This commit is contained in:
parent
0afa775f3f
commit
7ce1cf7560
@ -27,8 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private const double skip_time = 6000;
|
private const double skip_time = 6000;
|
||||||
|
|
||||||
[SetUp]
|
private void createTest(double skipTime = skip_time) => AddStep("create test", () =>
|
||||||
public void SetUp() => Schedule(() =>
|
|
||||||
{
|
{
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
increment = skip_time;
|
increment = skip_time;
|
||||||
@ -40,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
skip = new TestSkipOverlay(skip_time)
|
skip = new TestSkipOverlay(skipTime)
|
||||||
{
|
{
|
||||||
RequestSkip = () =>
|
RequestSkip = () =>
|
||||||
{
|
{
|
||||||
@ -55,9 +54,25 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
gameplayClock = gameplayClockContainer;
|
gameplayClock = gameplayClockContainer;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSkipTimeZero()
|
||||||
|
{
|
||||||
|
createTest(0);
|
||||||
|
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSkipTimeEqualToSkip()
|
||||||
|
{
|
||||||
|
createTest(MasterGameplayClockContainer.MINIMUM_SKIP_TIME);
|
||||||
|
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFadeOnIdle()
|
public void TestFadeOnIdle()
|
||||||
{
|
{
|
||||||
|
createTest();
|
||||||
|
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
|
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||||
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
|
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
|
||||||
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
|
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
|
||||||
@ -70,6 +85,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestClickableAfterFade()
|
public void TestClickableAfterFade()
|
||||||
{
|
{
|
||||||
|
createTest();
|
||||||
|
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha == 0);
|
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha == 0);
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
@ -79,6 +96,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestClickOnlyActuatesOnce()
|
public void TestClickOnlyActuatesOnce()
|
||||||
{
|
{
|
||||||
|
createTest();
|
||||||
|
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
AddStep("click", () =>
|
AddStep("click", () =>
|
||||||
{
|
{
|
||||||
@ -94,6 +113,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestClickOnlyActuatesMultipleTimes()
|
public void TestClickOnlyActuatesMultipleTimes()
|
||||||
{
|
{
|
||||||
|
createTest();
|
||||||
|
|
||||||
AddStep("set increment lower", () => increment = 3000);
|
AddStep("set increment lower", () => increment = 3000);
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
@ -106,6 +127,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestDoesntFadeOnMouseDown()
|
public void TestDoesntFadeOnMouseDown()
|
||||||
{
|
{
|
||||||
|
createTest();
|
||||||
|
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
AddStep("button down", () => InputManager.PressButton(MouseButton.Left));
|
AddStep("button down", () => InputManager.PressButton(MouseButton.Left));
|
||||||
AddUntilStep("wait for overlay disappear", () => !skip.OverlayContent.IsPresent);
|
AddUntilStep("wait for overlay disappear", () => !skip.OverlayContent.IsPresent);
|
||||||
|
Loading…
Reference in New Issue
Block a user