mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Merge branch 'master' into fix-argon-health-bar-flash
This commit is contained in:
commit
6f5f3a1ef4
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
[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 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
[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 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
[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))
|
||||
|
4
osu.Game.Tests/Resources/beatmap-version-4.osu
Normal file
4
osu.Game.Tests/Resources/beatmap-version-4.osu
Normal file
@ -0,0 +1,4 @@
|
||||
osu file format v4
|
||||
|
||||
[General]
|
||||
PreviewTime: -1
|
@ -196,7 +196,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
break;
|
||||
|
||||
case @"PreviewTime":
|
||||
metadata.PreviewTime = getOffsetTime(Parsing.ParseInt(pair.Value));
|
||||
int time = Parsing.ParseInt(pair.Value);
|
||||
metadata.PreviewTime = time == -1 ? time : getOffsetTime(time);
|
||||
break;
|
||||
|
||||
case @"SampleSet":
|
||||
|
Loading…
Reference in New Issue
Block a user