mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Add back skip button actuation count tests
This commit is contained in:
parent
2dd2e3d861
commit
29d2374928
@ -18,27 +18,41 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private SkipOverlay skip;
|
||||
private int requestCount;
|
||||
|
||||
private FramedOffsetClock offsetClock;
|
||||
private StopwatchClock stopwatchClock;
|
||||
|
||||
private double increment;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
requestCount = 0;
|
||||
increment = 6000;
|
||||
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = new FramedOffsetClock(Clock)
|
||||
{
|
||||
Offset = -Clock.CurrentTime,
|
||||
},
|
||||
Clock = offsetClock = new FramedOffsetClock(stopwatchClock = new StopwatchClock(true)),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
skip = new SkipOverlay(6000)
|
||||
{
|
||||
RequestSkip = () => requestCount++
|
||||
RequestSkip = () =>
|
||||
{
|
||||
requestCount++;
|
||||
offsetClock.Offset += increment;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (stopwatchClock != null)
|
||||
stopwatchClock.Rate = Clock.Rate;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFadeOnIdle()
|
||||
{
|
||||
@ -60,6 +74,33 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
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]
|
||||
public void TestDoesntFadeOnMouseDown()
|
||||
{
|
||||
|
@ -124,6 +124,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.Update();
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user