2020-02-18 12:21:55 +08: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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-02-18 12:21:55 +08:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Allocation;
|
2020-08-21 14:05:56 +08:00
|
|
|
using osu.Framework.Audio.Track;
|
2022-01-03 16:31:12 +08:00
|
|
|
using osu.Framework.Extensions;
|
2020-02-18 12:21:55 +08:00
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Game.Audio;
|
|
|
|
using osu.Game.Beatmaps;
|
2022-06-20 14:14:57 +08:00
|
|
|
using osu.Game.Database;
|
2020-02-18 12:21:55 +08:00
|
|
|
using osu.Game.Tests.Resources;
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Skins
|
|
|
|
{
|
|
|
|
[HeadlessTest]
|
|
|
|
public partial class TestSceneBeatmapSkinResources : OsuTestScene
|
|
|
|
{
|
|
|
|
[Resolved]
|
|
|
|
private BeatmapManager beatmaps { get; set; }
|
|
|
|
|
2021-11-15 17:46:11 +08:00
|
|
|
private IWorkingBeatmap beatmap;
|
2020-08-21 14:05:56 +08:00
|
|
|
|
2020-02-18 12:21:55 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2022-06-20 14:14:57 +08:00
|
|
|
var imported = beatmaps.Import(new ImportTask(TestResources.OpenResource("Archives/ogg-beatmap.osz"), "ogg-beatmap.osz")).GetResultSafely();
|
2022-01-10 11:39:49 +08:00
|
|
|
|
|
|
|
imported?.PerformRead(s =>
|
|
|
|
{
|
|
|
|
beatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0]);
|
|
|
|
});
|
2020-02-18 12:21:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2020-08-21 14:05:56 +08:00
|
|
|
public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo("sample")) != null);
|
2020-02-18 12:21:55 +08:00
|
|
|
|
|
|
|
[Test]
|
2022-07-28 16:58:13 +08:00
|
|
|
public void TestRetrieveOggTrack() => AddAssert("track is non-null", () =>
|
|
|
|
{
|
|
|
|
using (var track = beatmap.LoadTrack())
|
|
|
|
return track is not TrackVirtual;
|
|
|
|
});
|
2020-02-18 12:21:55 +08:00
|
|
|
}
|
|
|
|
}
|