Ejemplo n.º 1
0
        private void TimePickerDensityTest_Click(object sender, RoutedEventArgs e)
        {
            SimpleVerify simpleVerify     = new SimpleVerify();
            var          root             = (FrameworkElement)VisualTreeHelper.GetChild(TimePicker, 0);
            var          contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");

            simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");

            string expectedHeaderMargin = "0,0,0,4";
            string expectTimePickerFlyoutPresenterItemPadding = "0,3,0,6";

            if (contentPresenter != null)
            {
                simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
            }

            // Down-level need to change code, so RS5 have different ItemPadding, see bug 19373347, but we will not fix it
            if (!PlatformConfiguration.IsOsVersionGreaterThan(OSVersion.Redstone4))
            {
                var textBlock = (TextBlock)root.FindName("HourTextBlock");
                simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "HourTextBlock.Padding");

                textBlock = (TextBlock)root.FindName("MinuteTextBlock");
                simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "MinuteTextBlock.Padding");

                textBlock = (TextBlock)root.FindName("PeriodTextBlock");
                simpleVerify.IsEqual(textBlock.Padding.ToString(), expectTimePickerFlyoutPresenterItemPadding, "PeriodTextBlock.Padding");
            }
            DensityTestResult.Text = simpleVerify.ToString();
        }
Ejemplo n.º 2
0
        private void ToggleSwitchDensityTest_Click(object sender, RoutedEventArgs e)
        {
            SimpleVerify simpleVerify     = new SimpleVerify();
            var          root             = (FrameworkElement)VisualTreeHelper.GetChild(ToggleSwitch, 0);
            var          contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");

            simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");

            string expectedHeaderMargin = "0,0,0,0";
            string expectToggleSwitchPreContentMargin  = "6";
            string expectToggleSwitchPostContentMargin = "6";

            if (contentPresenter != null)
            {
                simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
            }

            var grid = (Grid)root;

            if (grid != null)
            {
                var rowDefinitions = grid.RowDefinitions;

                // layout has been changed since RS5 and it's not 4 rows anymore. We expect RS5  will be covered by UIElement tree test case in os repo.
                if (rowDefinitions.Count == 4)
                {
                    simpleVerify.IsEqual(rowDefinitions[1].Height.ToString(), expectToggleSwitchPreContentMargin, "rowDefinitions[1].Height");
                    simpleVerify.IsEqual(rowDefinitions[3].Height.ToString(), expectToggleSwitchPostContentMargin, "rowDefinitions[3].Height");
                }
            }
            DensityTestResult.Text = simpleVerify.ToString();
        }
        private void RunTest_Click(object sender, RoutedEventArgs e)
        {           
            SimpleVerify simpleVerify = new SimpleVerify();
            FrameworkElement item = ListView.FindElementOfTypeInSubtree<ListViewItem>();
            VerifyHeight(simpleVerify, item, 32, "ListViewItem");
            item = TreeView.FindElementOfTypeInSubtree<TreeViewItem>();
            VerifyHeight(simpleVerify, item, 24, "TreeViewItem");

            VerifyHeight(simpleVerify, NavItem1, 32, "NavigationViewItem");

            VerifyChildHeight(simpleVerify, TextBox, "BorderElement", 24, "TextBox");
            VerifyChildHeight(simpleVerify, PasswordBox, "BorderElement", 24, "PasswordBox");

            // AutoSuggestBox used TextBox directly, so we check TextBox
            FrameworkElement child = GetChild(AutoSuggestBox, "TextBox");
            VerifyChildHeight(simpleVerify, child, "BorderElement", 24, "AutoSuggestBox.TextBox");

            VerifyChildHeight(simpleVerify, RichEditBox, "BorderElement", 24, "RichEditBox");
            VerifyChildHeight(simpleVerify, ComboBox, "Background", 24, "TextBox");

            VerifyChildHeight(simpleVerify, TimePicker, "FlyoutButton", 24, "TimePicker");
            VerifyChildHeight(simpleVerify, DatePicker, "FlyoutButton", 24, "DatePicker");

            CompactTestResult.Text = simpleVerify.ToString();
        }
Ejemplo n.º 4
0
        private void AppBarToggleButtonDensityTest_Click(object sender, RoutedEventArgs e)
        {
            SimpleVerify simpleVerify = new SimpleVerify();

            FrameworkElement[] iconCollapsedElements = { AppBarToggleButton1, AppBarToggleButton3 };
            VerifyHeight(iconCollapsedElements, simpleVerify, 48);

            DensityTestResult.Text = simpleVerify.ToString();
        }
Ejemplo n.º 5
0
        private void ListViewItemDensityTest_Click(object sender, RoutedEventArgs e)
        {
            var          item         = ListView1.FindVisualChildByType <ListViewItem>();
            SimpleVerify simpleVerify = new SimpleVerify();

            if (item != null)
            {
                simpleVerify.IsEqual(item.MinHeight.ToString(), "40", "ListViewItem minHeight is 40");
            }
            else
            {
                simpleVerify.IsTrue(false, "Can't find ListViewItem");
            }
            DensityTestResult.Text = simpleVerify.ToString();
        }
Ejemplo n.º 6
0
        private void HeaderContentPresenterMarginTest(DependencyObject control)
        {
            SimpleVerify simpleVerify     = new SimpleVerify();
            var          root             = (FrameworkElement)VisualTreeHelper.GetChild(control, 0);
            var          contentPresenter = (ContentPresenter)root.FindName("HeaderContentPresenter");

            simpleVerify.IsTrue(contentPresenter != null, "HeaderContentPresenter can't be found");

            string expectedHeaderMargin = control == ComboBox ? "0,0,0,8" : "0,0,0,4";

            if (contentPresenter != null)
            {
                simpleVerify.IsEqual(contentPresenter.Margin.ToString(), expectedHeaderMargin, "HeaderContentPresenter.Margin");
            }

            DensityTestResult.Text = simpleVerify.ToString();
        }
        private void AppBarToggleButtonDensityTest_Click(object sender, RoutedEventArgs e)
        {
            SimpleVerify simpleVerify = new SimpleVerify();

            FrameworkElement[] iconCollapsedElements = { AppBarToggleButton1, AppBarToggleButton3 };
            VerifyHeight(iconCollapsedElements, simpleVerify, 40);

            // Bug 19741281: Density: AppBarButton/AppBarToggleButton Reveal style height is 60 other than 56 on RS1
            // Bug 19767717: AppBarToggleButtonDensityTest fail on RS4
            if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2) &&
                PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone4))
            {
                FrameworkElement[] iconVisibleElements = { AppBarToggleButton2, AppBarToggleButton4 };
                VerifyHeight(iconVisibleElements, simpleVerify, 56);
            }

            DensityTestResult.Text = simpleVerify.ToString();
        }
Ejemplo n.º 8
0
        private void SliderDensityTest_Click(object sender, RoutedEventArgs e)
        {
            string expectSliderPreContentMargin  = "15";
            string expectSliderPostContentMargin = "15";
            string expectSliderHorizontalHeight  = "32";
            string expectSliderVerticalWidth     = "32";

            SimpleVerify simpleVerify = new SimpleVerify();
            // Horizontal Slider
            var root = (FrameworkElement)VisualTreeHelper.GetChild(Slider1, 0);
            var grid = (Grid)root.FindName("HorizontalTemplate");

            simpleVerify.IsTrue(grid != null, "HorizontalTemplate can't be found");
            if (grid != null)
            {
                simpleVerify.IsEqual(grid.MinHeight.ToString(), expectSliderHorizontalHeight, "HorizontalTemplate|MinHeight=SliderHorizontalHeight");
                var rowDefinitions = grid.RowDefinitions;
                if (rowDefinitions.Count == 3)
                {
                    simpleVerify.IsEqual(rowDefinitions[0].Height.ToString(), expectSliderPreContentMargin, "HorizontalTemplate.RowDefinitions[0].Height=SliderPreContentMargin");
                    simpleVerify.IsEqual(rowDefinitions[2].Height.ToString(), expectSliderPostContentMargin, "HorizontalTemplate.RowDefinitions[2].Height=SliderPostContentMargin");
                }
            }

            // Vertical Slider
            root = (FrameworkElement)VisualTreeHelper.GetChild(Slider2, 0);
            grid = (Grid)root.FindName("VerticalTemplate");
            simpleVerify.IsTrue(grid != null, "VerticalTemplate can't be found");
            if (grid != null)
            {
                simpleVerify.IsEqual(grid.MinWidth.ToString(), expectSliderVerticalWidth, "VerticalTemplate|MinWidth=SliderVerticalWidth");
                var columnDefinitions = grid.ColumnDefinitions;
                if (columnDefinitions.Count == 3)
                {
                    simpleVerify.IsEqual(columnDefinitions[0].Width.ToString(), expectSliderPreContentMargin, "VerticalTemplate.columnDefinitions[0].Width=SliderPreContentMargin");
                    simpleVerify.IsEqual(columnDefinitions[2].Width.ToString(), expectSliderPostContentMargin, "VerticalTemplate.columnDefinitions[2].Width=SliderPostContentMargin");
                }
            }
            DensityTestResult.Text = simpleVerify.ToString();
        }