diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index cb12d03620..d37e09aa29 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -775,5 +775,22 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.That(seventh.ControlPoints[4].Type == null); } } + + [Test] + public void TestSliderLengthExtensionEdgeCase() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + + using (var resStream = TestResources.OpenResource("duplicate-last-position-slider.osu")) + using (var stream = new LineBufferedReader(resStream)) + { + var decoded = decoder.Decode(stream); + + var path = ((IHasPath)decoded.HitObjects[0]).Path; + + Assert.That(path.ExpectedDistance.Value, Is.EqualTo(2)); + Assert.That(path.Distance, Is.EqualTo(1)); + } + } } } diff --git a/osu.Game.Tests/Resources/duplicate-last-position-slider.osu b/osu.Game.Tests/Resources/duplicate-last-position-slider.osu new file mode 100644 index 0000000000..782dd4263e --- /dev/null +++ b/osu.Game.Tests/Resources/duplicate-last-position-slider.osu @@ -0,0 +1,19 @@ +osu file format v14 + +[Difficulty] +HPDrainRate:7 +CircleSize:10 +OverallDifficulty:9 +ApproachRate:10 +SliderMultiplier:0.4 +SliderTickRate:1 + +[TimingPoints] +382,923.076923076923,3,2,1,75,1,0 +382,-1000,3,2,1,75,0,0 + +[HitObjects] + +// Importantly, the last position is specified twice. +// In this case, osu-stable doesn't extend the slider length even when the "expected" length is higher than the actual. +261,171,25305,6,0,B|262:171|262:171|262:171,1,2,8|0,0:0|0:0,0:0:0:0: