1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Add test for shaking

This commit is contained in:
Dean Herbert 2018-07-06 17:38:58 +09:00
parent 79af5cb0a0
commit 3005259d50
2 changed files with 26 additions and 1 deletions

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Tests
}
}
private class TestDrawableHitCircle : DrawableHitCircle
protected class TestDrawableHitCircle : DrawableHitCircle
{
private readonly bool auto;
@ -96,6 +96,8 @@ namespace osu.Game.Rulesets.Osu.Tests
this.auto = auto;
}
public void TriggerJudgement() => UpdateJudgement(true);
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > 0)

View File

@ -0,0 +1,23 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseShaking : TestCaseHitCircle
{
public override void Add(Drawable drawable)
{
base.Add(drawable);
if (drawable is TestDrawableHitCircle hitObject)
{
Scheduler.AddDelayed(() => hitObject.TriggerJudgement(),
hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
}
}
}
}