// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Gameplay { /// /// Static class providing a convenience method to retrieve a correctly-initialised instance in testing scenarios. /// public static class TestGameplayState { /// /// Creates a correctly-initialised instance for use in testing. /// public static GameplayState Create(Ruleset ruleset, IReadOnlyList? mods = null, Score? score = null) { var beatmap = new TestBeatmap(ruleset.RulesetInfo); var workingBeatmap = new TestWorkingBeatmap(beatmap); var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); var scoreProcessor = ruleset.CreateScoreProcessor(); scoreProcessor.ApplyBeatmap(playableBeatmap); return new GameplayState(playableBeatmap, ruleset, mods, score, scoreProcessor); } } }