Fix various crashes due to bindable being disabled

This commit is contained in:
smoogipoo
2019-04-09 12:44:03 +09:00
parent ad124bfeec
commit cbb3fdaca8
5 changed files with 13 additions and 25 deletions

View File

@ -35,10 +35,6 @@ namespace osu.Game.Tests.Visual.SongSelect
private WorkingBeatmap defaultBeatmap;
private DatabaseContextFactory factory;
[Cached]
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Screens.Select.SongSelect),
@ -185,7 +181,7 @@ namespace osu.Game.Tests.Visual.SongSelect
});
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
AddAssert("empty mods", () => !selectedMods.Value.Any());
AddAssert("empty mods", () => !SelectedMods.Value.Any());
void onModChange(ValueChangedEvent<IEnumerable<Mod>> e) => modChangeIndex = actionIndex++;
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
@ -218,7 +214,7 @@ namespace osu.Game.Tests.Visual.SongSelect
private static int importId;
private int getImportId() => ++importId;
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => selectedMods.Value = mods);
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => SelectedMods.Value = mods);
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));