Move setting up the ruleset bindable to top-base test scene

This commit is contained in:
Salman Ahmed
2020-06-10 18:23:31 +03:00
parent efd5e14410
commit 4fb71eeb20
4 changed files with 4 additions and 20 deletions

View File

@ -24,20 +24,9 @@ namespace osu.Game.Tests.Visual
protected OsuConfigManager LocalConfig;
private readonly Ruleset ruleset;
protected PlayerTestScene()
{
ruleset = CreatePlayerRuleset();
}
[BackgroundDependencyLoader]
private void load()
{
// There are test scenes using current value of the ruleset bindable
// on their BDLs (example in TestSceneSliderSnaking's BDL)
Ruleset.Value = ruleset.RulesetInfo;
Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage));
LocalConfig.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
}
@ -58,7 +47,7 @@ namespace osu.Game.Tests.Visual
action?.Invoke();
AddStep(ruleset.Description, LoadPlayer);
AddStep(CreatePlayerRuleset().Description, LoadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
}
@ -68,6 +57,7 @@ namespace osu.Game.Tests.Visual
protected void LoadPlayer()
{
var ruleset = Ruleset.Value.CreateInstance();
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
Beatmap.Value = CreateWorkingBeatmap(beatmap);