Ejemplo n.º 1
0
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            // Get the base Control dependency property tests
            IList <DependencyPropertyTestMethod> tests = TagInherited(base.GetDependencyPropertyTests());

            tests.Add(ItemsSourceProperty.CheckDefaultValueTest);
            tests.Add(ItemsSourceProperty.ChangeClrSetterTest);
            tests.Add(ItemsSourceProperty.ChangeSetValueTest);
            tests.Add(ItemsSourceProperty.ClearValueResetsDefaultTest);
            tests.Add(ItemsSourceProperty.SetXamlAttributeTest);
            tests.Add(ItemsSourceProperty.SetXamlElementTest);

            tests.Add(CurrentIndexProperty.ChangeClrSetterTest);
            tests.Add(CurrentIndexProperty.ChangeSetValueTest);
            tests.Add(CurrentIndexProperty.SetXamlAttributeTest.Bug("TODO: find out why this fails."));
            tests.Add(CurrentIndexProperty.SetXamlElementTest.Bug("TODO: find out why this fails."));

            tests.Add(IsCyclicProperty.ChangeClrSetterTest);
            tests.Add(IsCyclicProperty.ChangeSetValueTest);
            tests.Add(IsCyclicProperty.ClearValueResetsDefaultTest);

            tests.Add(ItemTemplateProperty.CheckDefaultValueTest);
            tests.Add(ItemTemplateProperty.ChangeClrSetterTest);
            tests.Add(ItemTemplateProperty.ChangeSetValueTest);
            tests.Add(ItemTemplateProperty.SetNullTest);
            tests.Add(ItemTemplateProperty.ClearValueResetsDefaultTest);
            tests.Add(ItemTemplateProperty.CanBeStyledTest);
            tests.Add(ItemTemplateProperty.TemplateBindTest);

            tests.Add(AcceptsInvalidInputProperty.CheckDefaultValueTest);
            tests.Add(AcceptsInvalidInputProperty.ChangeClrSetterTest);

            tests.Add(FallbackItemProperty.CheckDefaultValueTest);
            tests.Add(FallbackItemProperty.ChangeClrSetterTest);

            DependencyPropertyTestMethod buggedTestA = tests.FirstOrDefault(a => a.Name == ValueProperty.SetXamlAttributeTest.Name);

            if (buggedTestA != null)
            {
                buggedTestA.Bug("Find out why this fails for DomainUpDown and not for UpDownBase.");
            }
            DependencyPropertyTestMethod buggedTestB = tests.FirstOrDefault(a => a.Name == ValueProperty.SetXamlElementTest.Name);

            if (buggedTestB != null)
            {
                buggedTestB.Bug("Find out why this fails for DomainUpDown and not for UpDownBase.");
            }

            return(tests);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            IList <DependencyPropertyTestMethod> tests = TagInherited(base.GetDependencyPropertyTests());

            tests.Add(IsEnabledProperty.ChangesVisualStateTest(false, true, "Normal"));
            tests.Add(IsEnabledProperty.ChangesVisualStateTest(true, false, "Disabled"));
            tests.Add(IsEnabledProperty.DoesNotChangeVisualStateTest(true, true));
            tests.Add(IsEnabledProperty.DoesNotChangeVisualStateTest(false, false));

            // IsExpandedProperty tests
            tests.Add(IsExpandedProperty.CheckDefaultValueTest);
            tests.Add(IsExpandedProperty.ChangeClrSetterTest);
            tests.Add(IsExpandedProperty.ChangeSetValueTest);
            tests.Add(IsExpandedProperty.ClearValueResetsDefaultTest);
            tests.Add(IsExpandedProperty.CanBeStyledTest);
            DependencyPropertyTestMethod focusTest = IsExpandedProperty.TemplateBindTest;

            focusTest.Tags.Add(new TagAttribute(Tags.RequiresFocus));
            tests.Add(focusTest);
            tests.Add(IsExpandedProperty.ChangesVisualStateTest(false, true, "Expanded"));
            tests.Add(IsExpandedProperty.ChangesVisualStateTest(true, false, "Collapsed"));
            tests.Add(IsExpandedProperty.SetXamlAttributeTest);
            tests.Add(IsExpandedProperty.SetXamlElementTest.Bug("TODO: XAML Parser?"));

            // ExpandDirectionProperty tests
            tests.Add(ExpandDirectionProperty.CheckDefaultValueTest);
            tests.Add(ExpandDirectionProperty.ChangeClrSetterTest);
            tests.Add(ExpandDirectionProperty.ChangeSetValueTest);
            tests.Add(ExpandDirectionProperty.ClearValueResetsDefaultTest);
            tests.Add(ExpandDirectionProperty.InvalidValueFailsTest);
            tests.Add(ExpandDirectionProperty.InvalidValueIsIgnoredTest);
            tests.Add(ExpandDirectionProperty.CanBeStyledTest);
            tests.Add(ExpandDirectionProperty.TemplateBindTest);
            tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Down, ExpandDirection.Up, "ExpandUp"));
            tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Up, ExpandDirection.Left, "ExpandLeft"));
            tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Left, ExpandDirection.Right, "ExpandRight"));
            tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Right, ExpandDirection.Down, "ExpandDown"));
            tests.Add(ExpandDirectionProperty.SetXamlAttributeTest);
            tests.Add(ExpandDirectionProperty.SetXamlElementTest);

            return(tests);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Remove all instances of a specific test from the list of tests.
        /// </summary>
        /// <param name="tests">List of tests.</param>
        /// <param name="test">Type of tests to remove.</param>
        public static void RemoveTests(this ICollection <DependencyPropertyTestMethod> tests, DependencyPropertyTestMethod test)
        {
            Assert.IsNotNull(tests, "List of tests should not be null!");
            Assert.IsNotNull(test, "Test should not be null!");

            // Get the tests to remove
            DependencyPropertyTestMethod[] remove =
                (from t in tests
                 where t.Method == test.Method &&
                 string.Compare(t.PropertyName, test.PropertyName, StringComparison.Ordinal) == 0
                 select t).ToArray();

            // Remove the tests
            foreach (DependencyPropertyTestMethod t in remove)
            {
                tests.Remove(t);
            }
        }
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            // Get the base Control dependency property tests
            IList <DependencyPropertyTestMethod> tests = TagInherited(base.GetDependencyPropertyTests());

            tests.Add(IsEnabledProperty.ChangesVisualStateTest(false, true, "Normal"));
            tests.Add(IsEnabledProperty.ChangesVisualStateTest(true, false, "Disabled"));
            tests.Add(IsEnabledProperty.DoesNotChangeVisualStateTest(true, true));
            tests.Add(IsEnabledProperty.DoesNotChangeVisualStateTest(false, false));

            // ExpandDirection tests
            // TODO: uncomment these tests if we decide to open up ExpandDirection.
            // tests.Add(ExpandDirectionProperty.CheckDefaultValueTest);
            // tests.Add(ExpandDirectionProperty.ChangeClrSetterTest);
            // tests.Add(ExpandDirectionProperty.ChangeSetValueTest);
            // tests.Add(ExpandDirectionProperty.ClearValueResetsDefaultTest);
            // tests.Add(ExpandDirectionProperty.InvalidValueFailsTest);
            // tests.Add(ExpandDirectionProperty.InvalidValueIsIgnoredTest);
            // tests.Add(ExpandDirectionProperty.CanBeStyledTest);
            // tests.Add(ExpandDirectionProperty.TemplateBindTest);
            // tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Down, ExpandDirection.Up, "ExpandUp"));
            // tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Up, ExpandDirection.Left, "ExpandLeft"));
            // tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Left, ExpandDirection.Right, "ExpandRight"));
            // tests.Add(ExpandDirectionProperty.ChangesVisualStateTest(ExpandDirection.Right, ExpandDirection.Down, "ExpandDown"));
            // tests.Add(ExpandDirectionProperty.SetXamlAttributeTest);
            // tests.Add(ExpandDirectionProperty.SetXamlElementTest);

            // IsSelected tests
            tests.Add(IsSelectedProperty.CheckDefaultValueTest);
            tests.Add(IsSelectedProperty.ChangeClrSetterTest);
            tests.Add(IsSelectedProperty.ChangeSetValueTest);
            tests.Add(IsSelectedProperty.ClearValueResetsDefaultTest);
            tests.Add(IsSelectedProperty.CanBeStyledTest);
            tests.Add(IsSelectedProperty.TemplateBindTest.Tag(Tags.RequiresFocus));
            tests.Add(IsSelectedProperty.ChangesVisualStateTest(false, true, "Expanded"));
            tests.Add(IsSelectedProperty.ChangesVisualStateTest(true, false, "Collapsed"));
            tests.Add(IsSelectedProperty.SetXamlAttributeTest);
            tests.Add(IsSelectedProperty.SetXamlElementTest);

            // AccordionButtonStyleProperty tests
            tests.Add(AccordionButtonStyleProperty.CheckDefaultValueTest);
            tests.Add(AccordionButtonStyleProperty.ChangeClrSetterTest);
            tests.Add(AccordionButtonStyleProperty.ChangeSetValueTest);
            tests.Add(AccordionButtonStyleProperty.SetNullTest);
            tests.Add(AccordionButtonStyleProperty.ClearValueResetsDefaultTest);
            tests.Add(AccordionButtonStyleProperty.CanBeStyledTest);
            tests.Add(AccordionButtonStyleProperty.TemplateBindTest);
            tests.Add(AccordionButtonStyleProperty.SetXamlAttributeTest.Bug("TODO: XAML Parser?"));
            tests.Add(AccordionButtonStyleProperty.SetXamlElementTest.Bug("TODO: XAML Parser?"));

            // ExpandableContentControlStyleProperty tests
            tests.Add(ExpandableContentControlStyleProperty.CheckDefaultValueTest);
            tests.Add(ExpandableContentControlStyleProperty.ChangeClrSetterTest);
            tests.Add(ExpandableContentControlStyleProperty.ChangeSetValueTest);
            tests.Add(ExpandableContentControlStyleProperty.SetNullTest);
            tests.Add(ExpandableContentControlStyleProperty.ClearValueResetsDefaultTest);
            tests.Add(ExpandableContentControlStyleProperty.CanBeStyledTest);
            tests.Add(ExpandableContentControlStyleProperty.TemplateBindTest);
            tests.Add(ExpandableContentControlStyleProperty.SetXamlAttributeTest.Bug("TODO: XAML Parser?"));
            tests.Add(ExpandableContentControlStyleProperty.SetXamlElementTest.Bug("TODO: XAML Parser?"));

            // ContentTargetSize tests
            tests.Add(ContentTargetSizeProperty.CheckDefaultValueTest);

            DependencyPropertyTestMethod buggedTest = tests.FirstOrDefault(a => a.Name == HeaderProperty.TemplateBindTest.Name);

            if (buggedTest != null)
            {
                buggedTest.Bug("Find out why this fails for AccordionItem and not for HeaderedContentControl.");
            }

            DependencyPropertyTestMethod datatemplateWithUIElementFailsTest = tests.FirstOrDefault(a => a.Name == ContentProperty.DataTemplateWithUIElementFailsTest.Name);

            if (datatemplateWithUIElementFailsTest != null)
            {
                // remove this test. It fails because the content starts out not visible, thus having no elements
                // to find.
                tests.Remove(datatemplateWithUIElementFailsTest);
            }

            return(tests);
        }