mirror of https://github.com/ppy/osu
Add failing test coverage of incorrect default preview time
This commit is contained in:
parent
1388f7240e
commit
7220ca34f7
|
@ -33,7 +33,7 @@ public class LegacyBeatmapDecoderTest
|
|||
[Test]
|
||||
public void TestDecodeBeatmapVersion()
|
||||
{
|
||||
using (var resStream = TestResources.OpenResource("beatmap-version.osu"))
|
||||
using (var resStream = TestResources.OpenResource("beatmap-version-6.osu"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var decoder = Decoder.GetDecoder<Beatmap>(stream);
|
||||
|
@ -45,6 +45,25 @@ public void TestDecodeBeatmapVersion()
|
|||
}
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestPreviewPointWithOffsets(bool applyOffsets)
|
||||
{
|
||||
using (var resStream = TestResources.OpenResource("beatmap-version-4.osu"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var decoder = Decoder.GetDecoder<Beatmap>(stream);
|
||||
((LegacyBeatmapDecoder)decoder).ApplyOffsets = applyOffsets;
|
||||
var working = new TestWorkingBeatmap(decoder.Decode(stream));
|
||||
|
||||
Assert.AreEqual(4, working.BeatmapInfo.BeatmapVersion);
|
||||
Assert.AreEqual(4, working.Beatmap.BeatmapInfo.BeatmapVersion);
|
||||
Assert.AreEqual(4, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo, Array.Empty<Mod>()).BeatmapInfo.BeatmapVersion);
|
||||
|
||||
Assert.AreEqual(-1, working.BeatmapInfo.Metadata.PreviewTime);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodeBeatmapGeneral()
|
||||
{
|
||||
|
@ -915,10 +934,11 @@ public void TestSliderLengthExtensionEdgeCase()
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLegacyDefaultsPreserved()
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestLegacyDefaultsPreserved(bool applyOffsets)
|
||||
{
|
||||
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
|
||||
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = applyOffsets };
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
using (var stream = new LineBufferedReader(memoryStream))
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
osu file format v4
|
||||
|
||||
[General]
|
||||
PreviewTime: -1
|
Loading…
Reference in New Issue