public void TestColumnHiding() { AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay { RelativeSizeAxes = Axes.Both, State = { Value = Visibility.Visible }, SelectedMods = { BindTarget = SelectedMods }, IsValidMod = mod => mod.Type == ModType.DifficultyIncrease || mod.Type == ModType.Conversion }); waitForColumnLoad(); changeRuleset(0); AddAssert("two columns visible", () => this.ChildrenOfType <ModColumn>().Count(col => col.IsPresent) == 2); AddStep("unset filter", () => modSelectOverlay.IsValidMod = _ => true); AddAssert("all columns visible", () => this.ChildrenOfType <ModColumn>().All(col => col.IsPresent)); AddStep("filter out everything", () => modSelectOverlay.IsValidMod = _ => false); AddAssert("no columns visible", () => this.ChildrenOfType <ModColumn>().All(col => !col.IsPresent)); AddStep("hide", () => modSelectOverlay.Hide()); AddStep("set filter for 3 columns", () => modSelectOverlay.IsValidMod = mod => mod.Type == ModType.DifficultyReduction || mod.Type == ModType.Automation || mod.Type == ModType.Conversion); AddStep("show", () => modSelectOverlay.Show()); AddUntilStep("3 columns visible", () => this.ChildrenOfType <ModColumn>().Count(col => col.IsPresent) == 3); }
public void TestSettingsNotCrossPolluting() { Bindable <IReadOnlyList <Mod> > selectedMods2 = null; ModSelectOverlay modSelectOverlay2 = null; createScreen(); AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() }); AddStep("set setting", () => modSelectOverlay.ChildrenOfType <SettingsSlider <float> >().First().Current.Value = 8); AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == 8); AddStep("create second bindable", () => selectedMods2 = new Bindable <IReadOnlyList <Mod> >(new Mod[] { new OsuModDifficultyAdjust() })); AddStep("create second overlay", () => { Add(modSelectOverlay2 = new UserModSelectOverlay().With(d => { d.Origin = Anchor.TopCentre; d.Anchor = Anchor.TopCentre; d.SelectedMods.BindTarget = selectedMods2; })); }); AddStep("show", () => modSelectOverlay2.Show()); AddAssert("ensure first is unchanged", () => SelectedMods.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == 8); AddAssert("ensure second is default", () => selectedMods2.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == null); }
private void createScreen() { AddStep("create screen", () => Child = modSelectOverlay = new UserModSelectOverlay { RelativeSizeAxes = Axes.Both, State = { Value = Visibility.Visible }, SelectedMods = { BindTarget = SelectedMods } }); waitForColumnLoad(); }