Esempio n. 1
0
        public void TestDimmedState()
        {
            createScreen();
            changeRuleset(0);

            AddUntilStep("any column dimmed", () => this.ChildrenOfType <ModColumn>().Any(column => !column.Active.Value));

            ModColumn lastColumn = null;

            AddAssert("last column dimmed", () => !this.ChildrenOfType <ModColumn>().Last().Active.Value);
            AddStep("request scroll to last column", () =>
            {
                var lastDimContainer = this.ChildrenOfType <ModSelectOverlay.ColumnDimContainer>().Last();
                lastColumn           = lastDimContainer.Column;
                lastDimContainer.RequestScroll?.Invoke(lastDimContainer);
            });
            AddUntilStep("column undimmed", () => lastColumn.Active.Value);

            AddStep("click panel", () =>
            {
                InputManager.MoveMouseTo(lastColumn.ChildrenOfType <ModPanel>().First());
                InputManager.Click(MouseButton.Left);
            });
            AddUntilStep("panel selected", () => lastColumn.ChildrenOfType <ModPanel>().First().Active.Value);
        }
Esempio n. 2
0
        public void TestKeyboardSelection()
        {
            ModColumn column = null !;

            AddStep("create content", () => Child = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Padding          = new MarginPadding(30),
                Child            = column = new ModColumn(ModType.DifficultyReduction, true, new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P })
                {
                    Anchor        = Anchor.Centre,
                    Origin        = Anchor.Centre,
                    AvailableMods = getExampleModsFor(ModType.DifficultyReduction)
                }
            });

            AddUntilStep("wait for panel load", () => column.IsLoaded && column.ItemsLoaded);

            AddStep("press W", () => InputManager.Key(Key.W));
            AddAssert("NF panel selected", () => this.ChildrenOfType <ModPanel>().Single(panel => panel.Mod.Acronym == "NF").Active.Value);

            AddStep("press W again", () => InputManager.Key(Key.W));
            AddAssert("NF panel deselected", () => !this.ChildrenOfType <ModPanel>().Single(panel => panel.Mod.Acronym == "NF").Active.Value);

            AddStep("set filter to NF", () => setFilter(mod => mod.Acronym == "NF"));

            AddStep("press W", () => InputManager.Key(Key.W));
            AddAssert("NF panel selected", () => this.ChildrenOfType <ModPanel>().Single(panel => panel.Mod.Acronym == "NF").Active.Value);

            AddStep("press W again", () => InputManager.Key(Key.W));
            AddAssert("NF panel deselected", () => !this.ChildrenOfType <ModPanel>().Single(panel => panel.Mod.Acronym == "NF").Active.Value);

            AddStep("filter out everything", () => setFilter(_ => false));

            AddStep("press W", () => InputManager.Key(Key.W));
            AddAssert("NF panel not selected", () => !this.ChildrenOfType <ModPanel>().Single(panel => panel.Mod.Acronym == "NF").Active.Value);

            AddStep("clear filter", () => setFilter(null));
        }
Esempio n. 3
0
        public void TestMultiSelection()
        {
            ModColumn column = null !;

            AddStep("create content", () => Child = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Padding          = new MarginPadding(30),
                Child            = column = new ModColumn(ModType.DifficultyIncrease, true)
                {
                    Anchor        = Anchor.Centre,
                    Origin        = Anchor.Centre,
                    AvailableMods = getExampleModsFor(ModType.DifficultyIncrease)
                }
            });

            AddUntilStep("wait for panel load", () => column.IsLoaded && column.ItemsLoaded);

            clickToggle();
            AddUntilStep("all panels selected", () => this.ChildrenOfType <ModPanel>().All(panel => panel.Active.Value));

            clickToggle();
            AddUntilStep("all panels deselected", () => this.ChildrenOfType <ModPanel>().All(panel => !panel.Active.Value));

            AddStep("manually activate all panels", () => this.ChildrenOfType <ModPanel>().ForEach(panel => panel.Active.Value = true));
            AddUntilStep("checkbox selected", () => this.ChildrenOfType <OsuCheckbox>().Single().Current.Value);

            AddStep("deselect first panel", () => this.ChildrenOfType <ModPanel>().First().Active.Value = false);
            AddUntilStep("checkbox not selected", () => !this.ChildrenOfType <OsuCheckbox>().Single().Current.Value);

            void clickToggle() => AddStep("click toggle", () =>
            {
                var checkbox = this.ChildrenOfType <OsuCheckbox>().Single();
                InputManager.MoveMouseTo(checkbox);
                InputManager.Click(MouseButton.Left);
            });
        }
Esempio n. 4
0
 public ColumnDimContainer(ModColumn column)
 {
     Child = Column = column;
     column.Active.BindTo(Active);
 }