1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Add test coverage for characters which are invalid in zip storage

This commit is contained in:
Dean Herbert 2021-11-03 16:45:16 +09:00
parent 900549a771
commit 601b218119

View File

@ -846,6 +846,42 @@ namespace osu.Game.Tests.Beatmaps.IO
} }
} }
// TODO: needs to be pulled across to realm implementation when this file is nuked.
[Test]
public void TestSaveRemovesInvalidCharactersFromPath()
{
// unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(ImportBeatmapTest)))
{
try
{
var osu = LoadOsuIntoHost(host);
var manager = osu.Dependencies.Get<BeatmapManager>();
var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER);
var beatmap = working.Beatmap;
beatmap.BeatmapInfo.Version = "difficulty";
beatmap.BeatmapInfo.Metadata = new BeatmapMetadata
{
Artist = "Artist/With\\Slashes",
Title = "Title",
AuthorString = "mapper",
};
manager.Save(beatmap.BeatmapInfo, working.Beatmap);
Assert.AreEqual("Artist_With_Slashes - Title (mapper) [difficulty].osu", beatmap.BeatmapInfo.Path);
}
finally
{
host.Exit();
}
}
}
[Test] [Test]
public void TestCreateNewEmptyBeatmap() public void TestCreateNewEmptyBeatmap()
{ {