Centralise and update WorkingBeatmap creation in test cases

This commit is contained in:
Dean Herbert
2019-05-31 14:40:53 +09:00
parent 80d65f9a3b
commit f33a5bc54c
34 changed files with 278 additions and 250 deletions

View File

@ -4,12 +4,10 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
{
@ -39,15 +37,13 @@ namespace osu.Game.Tests.Visual
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
}
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
protected virtual bool AllowFail => false;
private void loadPlayer()
{
var beatmap = CreateBeatmap(ruleset);
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
Beatmap.Value = CreateWorkingBeatmap(beatmap);
if (!AllowFail)
Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };