Ejemplo n.º 1
0
        public void VerifyCommonControlsComply()
        {
            TestElement(new Button());
            TestElement(new TextBlock());
            TestElement(new TextBox());
            TestElement(new ScrollViewer());
            TestElement(new SemanticZoom());
            TestElement(new AutoSuggestBox());
            TestElement(new MenuBar());
            TestElement(new AppBarButton());
            TestElement(new Thumb());
            TestElement(new GridView());
            TestElement(new ScrollBar());
            TestElement(new Button()
            {
                IsEnabled = false
            });

            void TestElement(FrameworkElement element)
            {
                App.Content = element;
                var peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);

                var rule = new ExpectKeyboardFocusableTrueRule();

                Assert.IsTrue(rule.IsValid(element, peer));
            }
        }
Ejemplo n.º 2
0
        public void VerifyFaultyControlsFails()
        {
            TestElement(new Button());
            TestElement(new TextBox());
            TestElement(new AppBarButton());

            void TestElement(FrameworkElement element)
            {
                App.Content = element;
                var elementPeer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
                var peer        = new ControlTypeFocusPeer(element, elementPeer.GetAutomationControlType(), false);

                var rule = new ExpectKeyboardFocusableTrueRule();

                Assert.IsFalse(rule.IsValid(element, peer));
            }
        }