Skip to content

Commit 548b442

Browse files
authored
Merge pull request #33883 from smoogipoo/add-test
Add test hitting next circle during tail window
2 parents 5a01b76 + 5dc08d4 commit 548b442

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,47 @@ public void TestRewindHandling()
484484
AddAssert("no miss judgements recorded", () => judgementResults.All(r => r.Type.IsHit()));
485485
}
486486

487+
/// <summary>
488+
/// Sliders are common to by 1/2 or 1/4 beat length in order to place the circle on the next beat.
489+
/// This tests a user pressing the next circle in the window between the last tick and the end of the slider (<see cref="SliderEventGenerator.TAIL_LENIENCY"/>).
490+
/// </summary>
491+
[Test]
492+
public void TestHitNextCircleDuringTailLeniency()
493+
{
494+
const double bpm = 240;
495+
const double beat_length = 60000 / bpm;
496+
const double slider_start = time_slider_start;
497+
const double slider_end = slider_start + beat_length;
498+
const double last_tick_time = slider_end + SliderEventGenerator.TAIL_LENIENCY;
499+
const double next_circle_time = slider_end + beat_length / 4;
500+
501+
performTest(new List<ReplayFrame>
502+
{
503+
new OsuReplayFrame { Position = Vector2.Zero, Actions = { OsuAction.LeftButton }, Time = time_slider_start },
504+
new OsuReplayFrame { Position = new Vector2(140, 0), Actions = { OsuAction.RightButton }, Time = last_tick_time + 20 },
505+
},
506+
[
507+
new Slider
508+
{
509+
StartTime = slider_start,
510+
Position = new Vector2(0, 0),
511+
TickDistanceMultiplier = 10, // no ticks
512+
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
513+
{
514+
Vector2.Zero,
515+
new Vector2(100, 0),
516+
}, 100),
517+
},
518+
new HitCircle
519+
{
520+
StartTime = next_circle_time,
521+
Position = new Vector2(140, 0)
522+
}
523+
], bpm: bpm);
524+
525+
AddAssert("all judgements are hit", () => judgementResults.All(j => j.Type.IsHit()));
526+
}
527+
487528
private void assertAllMaxJudgements()
488529
{
489530
AddAssert("All judgements max", () =>
@@ -522,6 +563,11 @@ private void performTest(List<ReplayFrame> frames, Slider? slider = null, double
522563
}, slider_path_length),
523564
};
524565

566+
performTest(frames, [slider], bpm, tickRate);
567+
}
568+
569+
private void performTest(List<ReplayFrame> frames, List<OsuHitObject> objects, double? bpm = null, int? tickRate = null)
570+
{
525571
AddStep("load player", () =>
526572
{
527573
var cpi = new ControlPointInfo();
@@ -531,7 +577,7 @@ private void performTest(List<ReplayFrame> frames, Slider? slider = null, double
531577

532578
Beatmap.Value = CreateWorkingBeatmap(new Beatmap<OsuHitObject>
533579
{
534-
HitObjects = { slider },
580+
HitObjects = objects,
535581
BeatmapInfo =
536582
{
537583
Difficulty = new BeatmapDifficulty

0 commit comments

Comments
 (0)