예제 #1
0
        public void DoubleRadiosEnabledAfterSelectingBoth()
        {
            var app = new DoubleRadioMenusApp(new DoubleRadioMenusProps
            {
                LeftItems = new[]
                {
                    new ItemData {
                        Name = "Foo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "Bar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "Gra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "Hoh", Description = "Hoh is one letter short."
                    },
                },
                RightItems = new[]
                {
                    new ItemData {
                        Name = "MegaFoo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "MegaBar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "MegaGra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "MegaHoh", Description = "Hoh is one letter short."
                    },
                },
            });

            TestUIDriver driver = new TestUIDriver(app);

            driver.Press(Buttons.A);
            driver.Press(Buttons.DPadRight);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.A);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);

            app.SelectedLeft.Name.Should().Be("Foo");
            app.SelectedRight.Name.Should().Be("MegaGra");

            driver.Focus.Should().BeOfType(typeof(ButtonElement));
        }
예제 #2
0
        public void DoubleRadiosAcceptDisabledByDefault()
        {
            var app = new DoubleRadioMenusApp(new DoubleRadioMenusProps
            {
                LeftItems = new[]
                {
                    new ItemData {
                        Name = "Foo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "Bar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "Gra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "Hoh", Description = "Hoh is one letter short."
                    },
                },
                RightItems = new[]
                {
                    new ItemData {
                        Name = "MegaFoo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "MegaBar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "MegaGra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "MegaHoh", Description = "Hoh is one letter short."
                    },
                },
            });

            TestUIDriver driver = new TestUIDriver(app);

            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);

            // This
            driver.Focus.Should().BeOfType(typeof(RadioButtonElement), "we shouldn't have gotten to the accept button.");
        }
예제 #3
0
        public void DoubleRadiosDownAndBackUp()
        {
            ItemData selectedLeft  = null;
            ItemData selectedRight = null;
            bool     acceptFired   = false;

            var app = new DoubleRadioMenusApp(new DoubleRadioMenusProps
            {
                LeftItems = new[]
                {
                    new ItemData {
                        Name = "Foo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "Bar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "Gra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "Hoh", Description = "Hoh is one letter short."
                    },
                },
                RightItems = new[]
                {
                    new ItemData {
                        Name = "MegaFoo", Description = "Food is good for you."
                    },
                    new ItemData {
                        Name = "MegaBar", Description = "Bars serve drinks."
                    },
                    new ItemData {
                        Name = "MegaGra", Description = "Gra is a nonsense word."
                    },
                    new ItemData {
                        Name = "MegaHoh", Description = "Hoh is one letter short."
                    },
                },
                OnAccept = (left, right) =>
                {
                    acceptFired   = true;
                    selectedLeft  = left;
                    selectedRight = right;
                }
            });

            TestUIDriver driver = new TestUIDriver(app);

            driver.Press(Buttons.DPadRight);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.A);
            driver.Press(Buttons.DPadLeft);
            driver.Press(Buttons.A);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadDown);
            driver.Press(Buttons.DPadUp);
            driver.Press(Buttons.A);

            acceptFired.Should().BeFalse("accept event was not fired.");

            app.SelectedLeft.Name.Should().Be("Hoh");
            app.SelectedRight.Name.Should().Be("MegaGra");
        }