Add gameplay test coverage around last tick of slider

This includes proposed changes as per
https://github.com/ppy/osu/issues/22805#issuecomment-1740377493.
This commit is contained in:
Dean Herbert 2023-09-29 15:15:39 +09:00
parent 55c623ff02
commit 135d2497e7
1 changed files with 66 additions and 15 deletions

View File

@ -37,6 +37,58 @@ public partial class TestSceneSliderInput : RateAdjustedBeatmapTestScene
private readonly List<JudgementResult> judgementResults = new List<JudgementResult>();
[Test]
public void TestTrackingAtTailButNotLastTick()
{
performTest(new List<ReplayFrame>
{
new OsuReplayFrame { Position = Vector2.Zero, Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start },
new OsuReplayFrame { Position = new Vector2(200, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start + 50 },
new OsuReplayFrame { Position = new Vector2(200, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start + 350 },
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_slider_start + 380 },
}, new Slider
{
StartTime = time_slider_start,
Position = new Vector2(0, 0),
SliderVelocityMultiplier = 10f,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
new Vector2(slider_path_length * 10, 0),
new Vector2(slider_path_length * 10, slider_path_length),
new Vector2(0, slider_path_length),
}),
});
AddAssert("Full judgement awarded", assertMaxJudge);
}
[Test]
public void TestTrackingAtLastTickButNotTail()
{
performTest(new List<ReplayFrame>
{
new OsuReplayFrame { Position = Vector2.Zero, Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start },
new OsuReplayFrame { Position = new Vector2(200, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start + 50 },
new OsuReplayFrame { Position = new Vector2(200, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start + 350 },
new OsuReplayFrame { Position = new Vector2(100, 0), Actions = { OsuAction.RightButton }, Time = time_slider_start + 380 },
}, new Slider
{
StartTime = time_slider_start,
Position = new Vector2(0, 0),
SliderVelocityMultiplier = 10f,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
new Vector2(slider_path_length * 10, 0),
new Vector2(slider_path_length * 10, slider_path_length),
new Vector2(0, slider_path_length),
}),
});
AddAssert("Full judgement awarded", assertMaxJudge);
}
[Test]
public void TestPressBothKeysSimultaneouslyAndReleaseOne()
{
@ -335,26 +387,25 @@ public void TestTrackingAreaOutsideEdge()
private bool assertMidSliderJudgementFail() => judgementResults[^2].Type == HitResult.SmallTickMiss;
private void performTest(List<ReplayFrame> frames)
private void performTest(List<ReplayFrame> frames, Slider? slider = null)
{
slider ??= new Slider
{
StartTime = time_slider_start,
Position = new Vector2(0, 0),
SliderVelocityMultiplier = 0.1f,
Path = new SliderPath(PathType.PerfectCurve, new[]
{
Vector2.Zero,
new Vector2(slider_path_length, 0),
}, slider_path_length),
};
AddStep("load player", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new Beatmap<OsuHitObject>
{
HitObjects =
{
new Slider
{
StartTime = time_slider_start,
Position = new Vector2(0, 0),
SliderVelocityMultiplier = 0.1f,
Path = new SliderPath(PathType.PerfectCurve, new[]
{
Vector2.Zero,
new Vector2(slider_path_length, 0),
}, slider_path_length),
}
},
HitObjects = { slider },
BeatmapInfo =
{
Difficulty = new BeatmapDifficulty { SliderTickRate = 3 },