mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Make test load actual beatmap's skin configuration
This commit is contained in:
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
sort(decodedAfterEncode);
|
sort(decodedAfterEncode);
|
||||||
|
|
||||||
Assert.That(decodedAfterEncode.beatmap.Serialize(), Is.EqualTo(decoded.beatmap.Serialize()));
|
Assert.That(decodedAfterEncode.beatmap.Serialize(), Is.EqualTo(decoded.beatmap.Serialize()));
|
||||||
Assert.IsTrue(decoded.beatmapSkin.Configuration.Equals(decodedAfterEncode.beatmapSkin.Configuration));
|
Assert.IsTrue(decodedAfterEncode.beatmapSkin.Configuration.Equals(decoded.beatmapSkin.Configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sort((IBeatmap beatmap, IBeatmapSkin beatmapSkin) tuple)
|
private void sort((IBeatmap beatmap, IBeatmapSkin beatmapSkin) tuple)
|
||||||
@ -55,11 +55,13 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private (IBeatmap beatmap, LegacyBeatmapSkin beatmapSkin) decodeFromLegacy(Stream stream, string name)
|
private (IBeatmap beatmap, TestLegacySkin beatmapSkin) decodeFromLegacy(Stream stream, string name)
|
||||||
{
|
{
|
||||||
using (var reader = new LineBufferedReader(stream))
|
using (var reader = new LineBufferedReader(stream))
|
||||||
{
|
{
|
||||||
var beatmap = new LegacyBeatmapDecoder { ApplyOffsets = false }.Decode(reader);
|
var beatmap = new LegacyBeatmapDecoder { ApplyOffsets = false }.Decode(reader);
|
||||||
|
|
||||||
|
beatmap.BeatmapInfo.Path = name;
|
||||||
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo
|
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
Files = new List<BeatmapSetFileInfo>
|
Files = new List<BeatmapSetFileInfo>
|
||||||
@ -69,14 +71,22 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
Filename = name,
|
Filename = name,
|
||||||
FileInfo = new osu.Game.IO.FileInfo { Hash = name }
|
FileInfo = new osu.Game.IO.FileInfo { Hash = name }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var beatmapSkin = new LegacyBeatmapSkin(beatmap.BeatmapInfo, beatmaps_resource_store, null);
|
var beatmapSkin = new TestLegacySkin(beatmap, beatmaps_resource_store, name);
|
||||||
return (convert(beatmap), beatmapSkin);
|
return (convert(beatmap), beatmapSkin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestLegacySkin : LegacySkin, IBeatmapSkin
|
||||||
|
{
|
||||||
|
public TestLegacySkin(Beatmap beatmap, IResourceStore<byte[]> storage, string fileName)
|
||||||
|
: base(new SkinInfo() { Name = "Test Skin", Creator = "Craftplacer" }, storage, null, fileName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Stream encodeToLegacy((IBeatmap beatmap, IBeatmapSkin beatmapSkin) fullBeatmap)
|
private Stream encodeToLegacy((IBeatmap beatmap, IBeatmapSkin beatmapSkin) fullBeatmap)
|
||||||
{
|
{
|
||||||
var (beatmap, beatmapSkin) = fullBeatmap;
|
var (beatmap, beatmapSkin) = fullBeatmap;
|
||||||
|
Reference in New Issue
Block a user