1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 04:13:21 +08:00

Add unit test

This commit is contained in:
smoogipoo 2019-05-14 09:46:42 +09:00
parent 92f6f4d21a
commit 7aa10956b5
2 changed files with 39 additions and 0 deletions

View File

@ -194,6 +194,34 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
}
[Test]
public void TestDecodeOverlappingTimingPoints()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("overlapping-control-points.osu"))
using (var stream = new StreamReader(resStream))
{
var controlPoints = decoder.Decode(stream).ControlPointInfo;
Assert.That(controlPoints.DifficultyPoints, Has.Count.EqualTo(2));
Assert.That(controlPoints.DifficultyPoints[0].SpeedMultiplier, Is.EqualTo(1.5).Within(0.1));
Assert.That(controlPoints.DifficultyPoints[1].SpeedMultiplier, Is.EqualTo(0.75).Within(0.1));
Assert.That(controlPoints.EffectPoints, Has.Count.EqualTo(2));
Assert.That(controlPoints.EffectPoints[0].KiaiMode, Is.True);
Assert.That(controlPoints.EffectPoints[1].KiaiMode, Is.True);
Assert.That(controlPoints.SamplePoints, Has.Count.EqualTo(2));
Assert.That(controlPoints.SamplePoints[0].SampleBank, Is.EqualTo("drum"));
Assert.That(controlPoints.SamplePoints[1].SampleBank, Is.EqualTo("normal"));
Assert.That(controlPoints.TimingPoints, Has.Count.EqualTo(2));
Assert.That(controlPoints.TimingPoints[0].BeatLength, Is.EqualTo(500));
Assert.That(controlPoints.TimingPoints[1].BeatLength, Is.EqualTo(250));
}
}
[Test]
public void TestDecodeBeatmapColours()
{

View File

@ -0,0 +1,11 @@
osu file format v14
[TimingPoints]
// Timing -> Inherited
0,500,4,2,0,100,1,0
0,-66.6666666666667,4,3,0,100,0,1
// Inherited -> Timing
1000,-133.333333333333,4,1,0,100,0,1
1000,250,4,2,0,100,1,0