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