1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 07:27:51 +08:00
osu-lazer/osu.Game.Tests/Visual/TestCaseEditorCompose.cs
2018-03-02 15:34:31 +09:00

49 lines
1.3 KiB
C#

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Screens.Compose;
namespace osu.Game.Tests.Visual
{
[TestFixture]
public class TestCaseEditorCompose : OsuTestCase
{
private readonly Random random;
private readonly Compose compose;
public TestCaseEditorCompose()
{
random = new Random(1337);
Add(compose = new Compose());
AddStep("Next beatmap", nextBeatmap);
}
private OsuGameBase osuGame;
private BeatmapManager beatmaps;
[BackgroundDependencyLoader]
private void load(OsuGameBase osuGame, BeatmapManager beatmaps)
{
this.osuGame = osuGame;
this.beatmaps = beatmaps;
compose.Beatmap.BindTo(osuGame.Beatmap);
}
private void nextBeatmap()
{
var sets = beatmaps.GetAllUsableBeatmapSets();
if (sets.Count == 0)
return;
var b = sets[random.Next(0, sets.Count)].Beatmaps[0];
osuGame.Beatmap.Value = beatmaps.GetWorkingBeatmap(b);
}
}
}