Ejemplo n.º 1
0
        public void IsFocusableTest()
        {
            // Arrange
            var ctrl = new TextBox { Visibility = Visibility.Visible, IsEnabled = true, IsTabStop = true, IsHitTestVisible = true };
            // Act
            var actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(true, actual);

            // Arrange
            ctrl = new TextBox { Visibility = Visibility.Collapsed, IsEnabled = true, IsTabStop = true, IsHitTestVisible = true };
            // Act
            actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(false, actual);

            // Arrange
            ctrl = new TextBox { Visibility = Visibility.Visible, IsEnabled = false, IsTabStop = true, IsHitTestVisible = true };
            // Act
            actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(false, actual);

            // Arrange
            ctrl = new TextBox { Visibility = Visibility.Visible, IsEnabled = true, IsTabStop = false, IsHitTestVisible = true };
            // Act
            actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(false, actual);

            // Arrange
            ctrl = new TextBox { Visibility = Visibility.Visible, IsEnabled = true, IsTabStop = true, IsHitTestVisible = false };
            // Act
            actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(false, actual);

            // Arrange
            ctrl = new TextBox { Visibility = Visibility.Visible, IsEnabled = true, IsTabStop = true, IsHitTestVisible = true };
            var parent = new ContentControl { Content = ctrl, Visibility = Visibility.Collapsed };
            // Act
            actual = ctrl.IsFocusable();
            // Assert
            Assert.AreEqual(false, actual);
        }