1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Update test assertions to match stable expectations

These changes were taken from https://github.com/ppy/osu/pull/22582.

Minor adjustments were applied to match stable expectations, which is to
say there cannot be an inherited control point with omit barline
specification (in the editor the setting is greyed out when inheritance
is turned on).
This commit is contained in:
Dean Herbert 2023-02-28 19:27:46 +09:00
parent 3c45ab677a
commit 1250c1f0c1
3 changed files with 69 additions and 8 deletions

View File

@ -181,16 +181,19 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(956, timingPoint.Time);
Assert.AreEqual(329.67032967033, timingPoint.BeatLength);
Assert.AreEqual(TimeSignature.SimpleQuadruple, timingPoint.TimeSignature);
Assert.IsFalse(timingPoint.OmitFirstBarLine);
timingPoint = controlPoints.TimingPointAt(48428);
Assert.AreEqual(956, timingPoint.Time);
Assert.AreEqual(329.67032967033d, timingPoint.BeatLength);
Assert.AreEqual(TimeSignature.SimpleQuadruple, timingPoint.TimeSignature);
Assert.IsFalse(timingPoint.OmitFirstBarLine);
timingPoint = controlPoints.TimingPointAt(119637);
Assert.AreEqual(119637, timingPoint.Time);
Assert.AreEqual(659.340659340659, timingPoint.BeatLength);
Assert.AreEqual(TimeSignature.SimpleQuadruple, timingPoint.TimeSignature);
Assert.IsFalse(timingPoint.OmitFirstBarLine);
var difficultyPoint = controlPoints.DifficultyPointAt(0);
Assert.AreEqual(0, difficultyPoint.Time);
@ -222,17 +225,14 @@ namespace osu.Game.Tests.Beatmaps.Formats
var effectPoint = controlPoints.EffectPointAt(0);
Assert.AreEqual(0, effectPoint.Time);
Assert.IsFalse(effectPoint.KiaiMode);
Assert.IsFalse(effectPoint.OmitFirstBarLine);
effectPoint = controlPoints.EffectPointAt(53703);
Assert.AreEqual(53703, effectPoint.Time);
Assert.IsTrue(effectPoint.KiaiMode);
Assert.IsFalse(effectPoint.OmitFirstBarLine);
effectPoint = controlPoints.EffectPointAt(116637);
Assert.AreEqual(95901, effectPoint.Time);
Assert.IsFalse(effectPoint.KiaiMode);
Assert.IsFalse(effectPoint.OmitFirstBarLine);
}
}
@ -273,6 +273,28 @@ namespace osu.Game.Tests.Beatmaps.Formats
}
}
[Test]
public void TestDecodeOmitBarLineEffect()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("omit-barline-control-points.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var controlPoints = (LegacyControlPointInfo)decoder.Decode(stream).ControlPointInfo;
Assert.That(controlPoints.TimingPoints.Count, Is.EqualTo(6));
Assert.That(controlPoints.EffectPoints.Count, Is.EqualTo(0));
Assert.That(controlPoints.TimingPointAt(500).OmitFirstBarLine, Is.False);
Assert.That(controlPoints.TimingPointAt(1500).OmitFirstBarLine, Is.True);
Assert.That(controlPoints.TimingPointAt(2500).OmitFirstBarLine, Is.False);
Assert.That(controlPoints.TimingPointAt(3500).OmitFirstBarLine, Is.False);
Assert.That(controlPoints.TimingPointAt(4500).OmitFirstBarLine, Is.False);
Assert.That(controlPoints.TimingPointAt(5500).OmitFirstBarLine, Is.True);
}
}
[Test]
public void TestTimingPointResetsSpeedMultiplier()
{

View File

@ -43,6 +43,18 @@ namespace osu.Game.Tests.NonVisual
Assert.That(cpi.Groups.Count, Is.EqualTo(2));
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(2));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(2));
cpi.Add(1200, new TimingControlPoint { OmitFirstBarLine = true }); // is not redundant
Assert.That(cpi.Groups.Count, Is.EqualTo(3));
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(3));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(3));
cpi.Add(1500, new TimingControlPoint { OmitFirstBarLine = true }); // is not redundant
Assert.That(cpi.Groups.Count, Is.EqualTo(4));
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(4));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(4));
}
[Test]
@ -95,12 +107,12 @@ namespace osu.Game.Tests.NonVisual
Assert.That(cpi.EffectPoints.Count, Is.EqualTo(0));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(0));
cpi.Add(1000, new EffectControlPoint { KiaiMode = true, OmitFirstBarLine = true }); // is not redundant
cpi.Add(1400, new EffectControlPoint { KiaiMode = true, OmitFirstBarLine = true }); // same settings, but is not redundant
cpi.Add(1000, new EffectControlPoint { KiaiMode = true }); // is not redundant
cpi.Add(1400, new EffectControlPoint { KiaiMode = true }); // is redundant
Assert.That(cpi.Groups.Count, Is.EqualTo(2));
Assert.That(cpi.EffectPoints.Count, Is.EqualTo(2));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(2));
Assert.That(cpi.Groups.Count, Is.EqualTo(1));
Assert.That(cpi.EffectPoints.Count, Is.EqualTo(1));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(1));
}
[Test]

View File

@ -0,0 +1,27 @@
osu file format v14
[TimingPoints]
// Uninherited: none, inherited: none
0,500,4,2,0,100,1,0
0,-50,4,3,0,100,0,0
// Uninherited: omit, inherited: none
1000,500,4,2,0,100,1,8
1000,-50,4,3,0,100,0,0
// Uninherited: none, inherited: omit (should be ignored, inheriting cannot omit)
2000,500,4,2,0,100,1,0
2000,-50,4,3,0,100,0,8
// Inherited: none, uninherited: none
3000,-50,4,3,0,100,0,0
3000,500,4,2,0,100,1,0
// Inherited: omit, uninherited: none (should be ignored, inheriting cannot omit)
4000,-50,4,3,0,100,0,8
4000,500,4,2,0,100,1,0
// Inherited: none, uninherited: omit
5000,-50,4,3,0,100,0,0
5000,500,4,2,0,100,1,8