1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 19:32:55 +08:00

Add test ensuring converter doesn't modify original beatmap

This commit is contained in:
Dean Herbert 2021-09-09 23:54:30 +09:00
parent b16e0cda3d
commit 1c3c32b724
2 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ SliderTickRate:1
[TimingPoints] [TimingPoints]
0,500,4,1,0,100,1,0 0,500,4,1,0,100,1,0
10000,-150,4,1,0,100,1,0
[HitObjects] [HitObjects]
51,192,500,128,0,1500:1:0:0:0: 51,192,500,128,0,1500:1:0:0:0:

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Formats;
using osu.Game.IO; using osu.Game.IO;
using osu.Game.IO.Serialization;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -109,6 +110,8 @@ namespace osu.Game.Tests.Beatmaps
{ {
var beatmap = GetBeatmap(name); var beatmap = GetBeatmap(name);
string beforeConversion = beatmap.Serialize();
var converterResult = new Dictionary<HitObject, IEnumerable<HitObject>>(); var converterResult = new Dictionary<HitObject, IEnumerable<HitObject>>();
var working = new ConversionWorkingBeatmap(beatmap) var working = new ConversionWorkingBeatmap(beatmap)
@ -122,6 +125,10 @@ namespace osu.Game.Tests.Beatmaps
working.GetPlayableBeatmap(CreateRuleset().RulesetInfo, mods); working.GetPlayableBeatmap(CreateRuleset().RulesetInfo, mods);
string afterConversion = beatmap.Serialize();
Assert.AreEqual(beforeConversion, afterConversion, "Conversion altered original beatmap");
return new ConvertResult return new ConvertResult
{ {
Mappings = converterResult.Select(r => Mappings = converterResult.Select(r =>