Esempio n. 1
0
        public void VerifyElementsWithAutomationNameNotMarked()
        {
            VerifyControlMarked(new Button()
            {
                Content = "Text"
            });
            VerifyControlMarked(new TextBlock()
            {
                Text = "Text"
            });
            VerifyControlMarked(new TextBox()
            {
                PlaceholderText = "Text"
            });
            VerifyControlMarked(new TextBox()
            {
                Header = "Text"
            });

            void VerifyControlMarked(FrameworkElement element)
            {
                App.Content = element;

                var peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
                var rule = new ControlNonEmptyNameRule();

                Assert.IsTrue(rule.IsValid(element, peer));
            }
        }
Esempio n. 2
0
        public void VerifyNonFocusableControlIsNotMarked()
        {
            var button = new Button()
            {
                IsTabStop = false
            };

            var peer = FrameworkElementAutomationPeer.CreatePeerForElement(button);
            var rule = new ControlNonEmptyNameRule();

            Assert.IsTrue(rule.IsValid(button, peer));
        }
Esempio n. 3
0
        public void VerifyNonFocusableElementsShoudNotBeMarked()
        {
            VerifyControlNotMarked(new StackPanel());
            VerifyControlNotMarked(new Rectangle());
            VerifyControlNotMarked(new Grid());
            VerifyControlNotMarked(new Canvas());

            void VerifyControlNotMarked(FrameworkElement element)
            {
                App.Content = element;

                var peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
                var rule = new ControlNonEmptyNameRule();

                Assert.IsTrue(rule.IsValid(element, peer));
            }
        }
Esempio n. 4
0
        public void VerifyEmptyAutomationNameIsMarked()
        {
            VerifyControlMarked(new Button());
            VerifyControlMarked(new TextBlock());
            VerifyControlMarked(new TextBlock()
            {
                Text = ""
            });
            VerifyControlMarked(new TextBox()
            {
                Header = ""
            });

            void VerifyControlMarked(FrameworkElement element)
            {
                App.Content = element;

                var peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
                var rule = new ControlNonEmptyNameRule();

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