2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System.IO;
|
2019-01-28 09:19:57 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.IO.Stores;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Resources
|
|
|
|
|
{
|
2019-01-28 09:19:57 +00:00
|
|
|
|
public static class TestResources
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-12-28 13:13:18 +00:00
|
|
|
|
public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly);
|
2019-01-28 09:19:57 +00:00
|
|
|
|
|
2019-12-13 10:00:28 +00:00
|
|
|
|
public static Stream OpenResource(string name) => GetStore().GetStream($"Resources/{name}");
|
|
|
|
|
|
2020-01-02 07:43:32 +00:00
|
|
|
|
public static Stream GetTestBeatmapStream(bool virtualTrack = false) => OpenResource($"Archives/241526 Soleily - Renatus{(virtualTrack ? "_virtual" : "")}.osz");
|
2019-01-28 09:19:57 +00:00
|
|
|
|
|
2019-10-10 08:39:41 +00:00
|
|
|
|
public static string GetTestBeatmapForImport(bool virtualTrack = false)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-01-28 09:19:57 +00:00
|
|
|
|
var temp = Path.GetTempFileName() + ".osz";
|
|
|
|
|
|
2019-10-10 08:39:41 +00:00
|
|
|
|
using (var stream = GetTestBeatmapStream(virtualTrack))
|
2019-01-28 09:19:57 +00:00
|
|
|
|
using (var newFile = File.Create(temp))
|
|
|
|
|
stream.CopyTo(newFile);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-01-28 09:19:57 +00:00
|
|
|
|
Assert.IsTrue(File.Exists(temp));
|
|
|
|
|
return temp;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|