1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Test import twice in a row

This commit is contained in:
Dean Herbert 2018-02-09 18:23:06 +09:00
parent 623ba652ed
commit 541068235d

View File

@ -58,6 +58,35 @@ namespace osu.Game.Tests.Beatmaps.IO
} }
} }
[Test]
public void TestImportThenImport()
{
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportThenDeleteThenImport"))
{
try
{
var osu = loadOsu(host);
var imported = loadOszIntoOsu(osu);
var importedSecondTime = loadOszIntoOsu(osu);
// check the newly "imported" beatmap is actually just the restored previous import. since it matches hash.
Assert.IsTrue(imported.ID == importedSecondTime.ID);
Assert.IsTrue(imported.Beatmaps.First().ID == importedSecondTime.Beatmaps.First().ID);
var manager = osu.Dependencies.Get<BeatmapManager>();
Assert.IsTrue(manager.GetAllUsableBeatmapSets().Count == 1);
Assert.IsTrue(manager.QueryBeatmapSets(_ => true).ToList().Count == 1);
}
finally
{
host.Exit();
}
}
}
[Test] [Test]
public void TestImportThenDeleteThenImport() public void TestImportThenDeleteThenImport()
{ {