mirror of
https://github.com/ppy/osu
synced 2024-12-13 10:28:17 +00:00
Add testcase for editor compose
This commit is contained in:
parent
8c30fd490c
commit
2ec24f58c8
47
osu.Game.Tests/Visual/TestCaseEditorCompose.cs
Normal file
47
osu.Game.Tests/Visual/TestCaseEditorCompose.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
nextBeatmap();
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -105,6 +105,7 @@
|
|||||||
<Compile Include="Visual\TestCaseDrawableRoom.cs" />
|
<Compile Include="Visual\TestCaseDrawableRoom.cs" />
|
||||||
<Compile Include="Visual\TestCaseDrawings.cs" />
|
<Compile Include="Visual\TestCaseDrawings.cs" />
|
||||||
<Compile Include="Visual\TestCaseEditor.cs" />
|
<Compile Include="Visual\TestCaseEditor.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseEditorCompose.cs" />
|
||||||
<Compile Include="Visual\TestCaseEditorComposeTimeline.cs" />
|
<Compile Include="Visual\TestCaseEditorComposeTimeline.cs" />
|
||||||
<Compile Include="Visual\TestCaseEditorMenuBar.cs" />
|
<Compile Include="Visual\TestCaseEditorMenuBar.cs" />
|
||||||
<Compile Include="Visual\TestCaseEditorSummaryTimeline.cs" />
|
<Compile Include="Visual\TestCaseEditorSummaryTimeline.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user