mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add back skip button actuation count tests
This commit is contained in:
@ -18,27 +18,41 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private SkipOverlay skip;
|
private SkipOverlay skip;
|
||||||
private int requestCount;
|
private int requestCount;
|
||||||
|
|
||||||
|
private FramedOffsetClock offsetClock;
|
||||||
|
private StopwatchClock stopwatchClock;
|
||||||
|
|
||||||
|
private double increment;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() =>
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
|
increment = 6000;
|
||||||
|
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Clock = new FramedOffsetClock(Clock)
|
Clock = offsetClock = new FramedOffsetClock(stopwatchClock = new StopwatchClock(true)),
|
||||||
{
|
|
||||||
Offset = -Clock.CurrentTime,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
skip = new SkipOverlay(6000)
|
skip = new SkipOverlay(6000)
|
||||||
{
|
{
|
||||||
RequestSkip = () => requestCount++
|
RequestSkip = () =>
|
||||||
|
{
|
||||||
|
requestCount++;
|
||||||
|
offsetClock.Offset += increment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
if (stopwatchClock != null)
|
||||||
|
stopwatchClock.Rate = Clock.Rate;
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFadeOnIdle()
|
public void TestFadeOnIdle()
|
||||||
{
|
{
|
||||||
@ -60,6 +74,33 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
checkRequestCount(1);
|
checkRequestCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestClickOnlyActuatesOnce()
|
||||||
|
{
|
||||||
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
|
AddStep("click", () =>
|
||||||
|
{
|
||||||
|
increment = 6000 - offsetClock.CurrentTime - GameplayClockContainer.MINIMUM_SKIP_TIME / 2;
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
checkRequestCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestClickOnlyActuatesMultipleTimes()
|
||||||
|
{
|
||||||
|
AddStep("set increment lower", () => increment = 3000);
|
||||||
|
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||||
|
checkRequestCount(2);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDoesntFadeOnMouseDown()
|
public void TestDoesntFadeOnMouseDown()
|
||||||
{
|
{
|
||||||
|
@ -124,6 +124,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint);
|
remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint);
|
||||||
|
|
||||||
|
button.Enabled.Value = Time.Current < startTime - GameplayClockContainer.MINIMUM_SKIP_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
Reference in New Issue
Block a user