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

Added tests for difficulty clamping

This commit is contained in:
Aurelian 2024-05-22 13:26:00 +02:00
parent b25987ffe7
commit f3cae73e2e
3 changed files with 45 additions and 0 deletions

View File

@ -1188,5 +1188,35 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(beatmap.HitObjects[0].GetEndTime(), Is.EqualTo(3153));
}
}
[Test]
public void TestBeatmapDifficultyIsClamped()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("out-of-range-difficulties.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream).Difficulty;
Assert.That(decoded.DrainRate, Is.EqualTo(10));
Assert.That(decoded.CircleSize, Is.EqualTo(10));
Assert.That(decoded.OverallDifficulty, Is.EqualTo(10));
Assert.That(decoded.ApproachRate, Is.EqualTo(10));
Assert.That(decoded.SliderMultiplier, Is.EqualTo(3.6));
Assert.That(decoded.SliderTickRate, Is.EqualTo(8));
}
}
[Test]
public void TestManiaBeatmapDifficultyCircleSizeClamp()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("out-of-range-difficulties-mania.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream).Difficulty;
Assert.That(decoded.CircleSize, Is.EqualTo(14));
}
}
}
}

View File

@ -0,0 +1,5 @@
[General]
Mode: 3
[Difficulty]
CircleSize:14

View File

@ -0,0 +1,10 @@
[General]
Mode: 0
[Difficulty]
HPDrainRate:25
CircleSize:25
OverallDifficulty:25
ApproachRate:30
SliderMultiplier:30
SliderTickRate:30