From b3d60c6d4fd037e28bc36b5c284aff974458e382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 16 Oct 2023 13:40:45 +0200 Subject: [PATCH] Add inline commentary about workarounds in beatmap conversion test --- .../OsuBeatmapConversionTest.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index ea07b69e78..3e0a86d39c 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -39,6 +39,14 @@ namespace osu.Game.Rulesets.Osu.Tests foreach (var nested in slider.NestedHitObjects) objects.Add(createConvertValue((OsuHitObject)nested, slider)); + // stable does slider tail leniency by offsetting the last tick 36ms back. + // based on player feedback, we're doing this a little different in lazer, + // and the lazer method does not require offsetting the last tick + // (see `DrawableSliderTail.CheckForResult()`). + // however, in conversion tests, just so the output matches, we're bringing + // the 36ms offset back locally. + // in particular, on some sliders, this may rearrange nested objects, + // so we sort them again by start time to prevent test failures. foreach (var obj in objects.OrderBy(cv => cv.StartTime)) yield return obj; @@ -55,6 +63,10 @@ namespace osu.Game.Rulesets.Osu.Tests double startTime = obj.StartTime; double endTime = obj.GetEndTime(); + // as stated in the inline comment above, this is locally bringing back + // the stable treatment of the "legacy last tick" just to make sure + // that the conversion output matches. + // compare: `SliderEventGenerator.Generate()`, and the calculation of `legacyLastTickTime`. if (obj is SliderTailCircle && parent is Slider slider) { startTime = Math.Max(startTime + SliderEventGenerator.TAIL_LENIENCY, slider.StartTime + slider.Duration / 2);