mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add failing test covering post-converted json serializing
This commit is contained in:
@ -11,6 +11,8 @@ using osu.Game.Beatmaps.Formats;
|
|||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -90,6 +92,38 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
Assert.AreEqual(2, difficulty.SliderTickRate);
|
Assert.AreEqual(2, difficulty.SliderTickRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDecodePostConverted()
|
||||||
|
{
|
||||||
|
var converted = new OsuBeatmapConverter(decodeAsJson(normal), new OsuRuleset()).Convert();
|
||||||
|
|
||||||
|
var processor = new OsuBeatmapProcessor(converted);
|
||||||
|
|
||||||
|
processor.PreProcess();
|
||||||
|
foreach (var o in converted.HitObjects)
|
||||||
|
o.ApplyDefaults(converted.ControlPointInfo, converted.BeatmapInfo.BaseDifficulty);
|
||||||
|
processor.PostProcess();
|
||||||
|
|
||||||
|
var beatmap = converted.Serialize().Deserialize<Beatmap>();
|
||||||
|
|
||||||
|
var curveData = beatmap.HitObjects[0] as IHasPathWithRepeats;
|
||||||
|
var positionData = beatmap.HitObjects[0] as IHasPosition;
|
||||||
|
|
||||||
|
Assert.IsNotNull(positionData);
|
||||||
|
Assert.IsNotNull(curveData);
|
||||||
|
Assert.AreEqual(90, curveData.Path.Distance);
|
||||||
|
Assert.AreEqual(new Vector2(192, 168), positionData.Position);
|
||||||
|
Assert.AreEqual(956, beatmap.HitObjects[0].StartTime);
|
||||||
|
Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == HitSampleInfo.HIT_NORMAL));
|
||||||
|
|
||||||
|
positionData = beatmap.HitObjects[1] as IHasPosition;
|
||||||
|
|
||||||
|
Assert.IsNotNull(positionData);
|
||||||
|
Assert.AreEqual(new Vector2(304, 56), positionData.Position);
|
||||||
|
Assert.AreEqual(1285, beatmap.HitObjects[1].StartTime);
|
||||||
|
Assert.IsTrue(beatmap.HitObjects[1].Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDecodeHitObjects()
|
public void TestDecodeHitObjects()
|
||||||
{
|
{
|
||||||
@ -100,6 +134,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
|
|
||||||
Assert.IsNotNull(positionData);
|
Assert.IsNotNull(positionData);
|
||||||
Assert.IsNotNull(curveData);
|
Assert.IsNotNull(curveData);
|
||||||
|
Assert.AreEqual(90, curveData.Path.Distance);
|
||||||
Assert.AreEqual(new Vector2(192, 168), positionData.Position);
|
Assert.AreEqual(new Vector2(192, 168), positionData.Position);
|
||||||
Assert.AreEqual(956, beatmap.HitObjects[0].StartTime);
|
Assert.AreEqual(956, beatmap.HitObjects[0].StartTime);
|
||||||
Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == HitSampleInfo.HIT_NORMAL));
|
Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == HitSampleInfo.HIT_NORMAL));
|
||||||
|
Reference in New Issue
Block a user