Example #1
0
        public void VerifyVisualTreeForCommandBarCornerRadius()
        {
            if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
            {
                return;
            }

            var xaml =
                @"<StackPanel Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
                    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                        <CommandBar Background='Green' CornerRadius='10,10,10,10' IsOpen='True'>
                        <AppBarToggleButton Icon='Shuffle' Label='Shuffle'  />
                        <AppBarToggleButton Icon='RepeatAll' Label='Repeat' />
                        <AppBarSeparator Margin='20,10,20,0' Foreground='Yellow'/>
        
                        <CommandBar.Content>
                            <TextBlock Text='Now playing...' Margin='12,14'/>
                        </CommandBar.Content>
                        </CommandBar>

                        <CommandBar Background='Green' CornerRadius='5,10,5,10' IsOpen='False'>
                        <AppBarToggleButton Icon='Shuffle' Label='Shuffle'  />
                        <AppBarToggleButton Icon='RepeatAll' Label='Repeat' />
                        <AppBarSeparator Margin='20,10,20,0' Padding='16,12,15,12' Foreground='Yellow'/>

                        <CommandBar.Content>
                            <TextBlock Text='Now playing...' Margin='12,14'/>
                        </CommandBar.Content>
                        </CommandBar>
                    </StackPanel>";

            VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
                                                  verificationFileNamePrefix: "VerifyVisualTreeForCommandBarCornerRadius");
        }
Example #2
0
        public void VerifyVisualTreeForControlsInCommonStyles()
        {
            var controlsToVerify = new List <string> {
                "AppBarButton", /*"AppBarToggleButton",*/ "Button", "CheckBox",
                "CommandBar", "ContentDialog", "DatePicker", "FlipView", "ListViewItem",
                "PasswordBox", "Pivot", "PivotItem", "RichEditBox", "Slider", "SplitView",
                "TextBox", "TimePicker", "ToolTip", "ToggleButton", "ToggleSwitch"
            };

            bool failed = false;

            foreach (var control in controlsToVerify)
            {
                try
                {
                    Log.Comment($"Verify visual tree for {control}");
                    VisualTreeTestHelper.VerifyVisualTree(xaml: XamlStringForControl(control), verificationFileNamePrefix: control);
                }
                catch (Exception e)
                {
                    failed = true;
                    Log.Error(e.Message);
                }
            }

            if (failed)
            {
                Verify.Fail("One or more visual tree verification failed, see details above");
            }
        }
        private void VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode paneDisplayMode, string masterFilePrefix)
        {
            NavigationView navView       = null;
            UIElement      headerContent = null;

            RunOnUIThread.Execute(() =>
            {
                navView = new NavigationView()
                {
                    Header = "HEADER", PaneDisplayMode = paneDisplayMode, Width = 400.0
                };
                MUXControlsTestApp.App.TestContentRoot = navView;
            });

            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                Grid rootGrid = VisualTreeHelper.GetChild(navView, 0) as Grid;
                if (rootGrid != null)
                {
                    headerContent = rootGrid.FindName("HeaderContent") as UIElement;
                }
            });

            VisualTreeTestHelper.VerifyVisualTree(
                root: headerContent,
                masterFilePrefix: masterFilePrefix);
        }
        public void VerifyVisualTree()
        {
            var comboBox = SetupComboBox();

            RunOnUIThread.Execute(() =>
            {
                comboBox.IsDropDownOpen = true;
            });
            IdleSynchronizer.Wait();

            VisualTreeTestHelper.VerifyVisualTree(root: comboBox, masterFilePrefix: "ComboBox");
        }
Example #5
0
 public void VerifyVisualTreeNoException(UIElement root, string verificationFileNamePrefix, Theme theme = Theme.None, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null)
 {
     try
     {
         VisualTreeTestHelper.VerifyVisualTree(root, verificationFileNamePrefix, theme, translator, filter, logger);
     }
     catch (Exception e)
     {
         Log.Error(e.Message);
         hasFailed = true;
     }
 }
Example #6
0
        public void VerifyVisualTree()
        {
            var comboBox = SetupComboBox(useContent: false);

            RunOnUIThread.Execute(() =>
            {
                comboBox.IsDropDownOpen = true;
            });
            IdleSynchronizer.Wait();

            VisualTreeTestHelper.VerifyVisualTree(root: comboBox, verificationFileNamePrefix: "ComboBox");
        }
Example #7
0
 public void VerifyVisualTreeNoException(string xaml, string masterFilePrefix, Theme theme = Theme.None, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null)
 {
     try
     {
         VisualTreeTestHelper.VerifyVisualTree(xaml, masterFilePrefix, theme, translator, filter, logger);
     }
     catch (Exception e)
     {
         Log.Error(e.Message);
         hasFailed = true;
     }
 }
        public void VerifyPersonPictureVisualTree()
        {
            PersonPicture personPicture = null;

            RunOnUIThread.Execute(() =>
            {
                personPicture = new PersonPicture {
                    Initials = "LC", Width = 100, Height = 100
                };
            });
            TestUtilities.SetAsVisualTreeRoot(personPicture);

            VisualTreeTestHelper.VerifyVisualTree(root: personPicture, verificationFileNamePrefix: "PersonPicture");
        }
        public void VerifyVisualTree()
        {
            ColorPicker colorPicker = null;

            RunOnUIThread.Execute(() =>
            {
                colorPicker = new ColorPicker {
                    IsAlphaEnabled = true, Width = 300, Height = 600
                };
            });
            TestUtilities.SetAsVisualTreeRoot(colorPicker);

            VisualTreeTestHelper.VerifyVisualTree(root: colorPicker, masterFilePrefix: "ColorPicker");
        }
        public void VerifyVisualTreeExampleLoadAndVerifyForAllThemes()
        {
            if (!PlatformConfiguration.IsOsVersion(OSVersion.Redstone5))
            {
                return;
            }

            var xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                       </Grid>";

            VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
                                                  masterFilePrefix: "VerifyVisualTreeExampleLoadAndVerifyForAllThemes",
                                                  theme: Theme.All);
        }
        public void VerifyVisualTreeForCommandBarOverflowMenu()
        {
            StackPanel root            = null;
            CommandBar commandBar      = null;
            UIElement  overflowContent = null;

            RunOnUIThread.Execute(() => {
                root = (StackPanel)XamlReader.Load(
                    @"<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
                        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                            <CommandBar x:Name='TestCommandBar'>
                                <AppBarButton Icon='AddFriend'/>
                                <AppBarButton Icon='World' Label='World'/>
                                <AppBarToggleButton Icon='Volume' Label='Volume'/>
                                <CommandBar.SecondaryCommands>
                                    <AppBarButton Label='Like'/>
                                    <AppBarButton Label='Dislike'/>
                                    <AppBarToggleButton Label='Toggle'/>
                                </CommandBar.SecondaryCommands>
                                <CommandBar.Content>
                                    <TextBlock Text='Hello World' Margin='12'/>
                                </CommandBar.Content>
                            </CommandBar>
                      </StackPanel>");

                commandBar = (CommandBar)root.FindName("TestCommandBar");
                Verify.IsNotNull(commandBar);
            });

            TestUtilities.SetAsVisualTreeRoot(root);

            RunOnUIThread.Execute(() => {
                commandBar.IsOpen = true;
            });

            MUXControlsTestApp.Utilities.IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() => {
                var popup = VisualTreeHelper.GetOpenPopups(Window.Current).Last();
                Verify.IsNotNull(popup);
                overflowContent = popup.Child;
            });

            var visualTreeDumperFilter = new VisualTreeDumper.DefaultFilter();

            visualTreeDumperFilter.PropertyNameWhiteList.Remove("MaxWidth");
            visualTreeDumperFilter.PropertyNameWhiteList.Remove("MaxHeight");
            VisualTreeTestHelper.VerifyVisualTree(root: overflowContent, masterFilePrefix: "CommandBarOverflowMenu", filter: visualTreeDumperFilter);
        }
Example #12
0
 public void VerifyVisualTree(UIElement root, string masterFilePrefix, Theme theme = Theme.None, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null)
 {
     Verify.DisableVerifyFailureExceptions = true;
     try
     {
         if (!VisualTreeTestHelper.VerifyVisualTree(root, masterFilePrefix, theme, translator, filter, logger))
         {
             hasFailed = true;
         }
     }
     finally
     {
         Verify.DisableVerifyFailureExceptions = false;
     }
 }
        public void VerifyVisualTreeExampleWithCustomerPropertyValueTranslator()
        {
            if (!PlatformConfiguration.IsOsVersion(OSVersion.Redstone5))
            {
                return;
            }

            var xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                            <TextBlock Text='Abc' />
                       </Grid>";

            VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
                                                  masterFilePrefix: "VerifyVisualTreeExampleWithCustomerPropertyValueTranslator",
                                                  translator: new CustomizedTranslator());
        }
Example #14
0
        public void VerifyVisualTree()
        {
            CalendarView calendarView = null;

            RunOnUIThread.Execute(() =>
            {
                calendarView        = new CalendarView();
                calendarView.Width  = 400;
                calendarView.Height = 400;
                calendarView.SetDisplayDate(new DateTime(2000, 1, 1));
            });
            TestUtilities.SetAsVisualTreeRoot(calendarView);

            VisualTreeTestHelper.VerifyVisualTree(root: calendarView, masterFilePrefix: "CalendarView");
        }
        public void VerifyVisualTreeExampleForLightTheme()
        {
            if (!PlatformConfiguration.IsOsVersion(OSVersion.Redstone5))
            {
                return;
            }

            var       xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                       </Grid>";
            UIElement root = VisualTreeTestHelper.SetupVisualTree(xaml);

            VisualTreeTestHelper.VerifyVisualTree(root: root,
                                                  masterFilePrefix: "VerifyVisualTreeExampleForLightTheme",
                                                  theme: Theme.Light);
        }
        public void VerifyVisualTreeForAppBarAndAppBarToggleButton()
        {
            if (!PlatformConfiguration.IsOsVersion(OSVersion.Redstone5))
            {
                return;
            }

            var xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                            <StackPanel>
                                <AppBarButton Icon='Accept' Label='Accept'/>
                                <AppBarToggleButton Icon='Dislike' Label='Dislike'/>
                            </StackPanel>
                       </Grid>";

            VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
                                                  masterFilePrefix: "VerifyVisualTreeForAppBarAndAppBarToggleButton");
        }
        public void VerifyVisualTreeExampleLoadAndVerifyForDarkThemeWithCustomName()
        {
            if (!PlatformConfiguration.IsOsVersion(OSVersion.Redstone5))
            {
                return;
            }

            var       xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> 
                       </Grid>";
            UIElement root = VisualTreeTestHelper.SetupVisualTree(xaml);

            RunOnUIThread.Execute(() =>
            {
                (root as FrameworkElement).RequestedTheme = ElementTheme.Dark;
            });
            VisualTreeTestHelper.VerifyVisualTree(root: root,
                                                  masterFilePrefix: "VerifyVisualTreeExampleLoadAndVerifyForDarkThemeWithCustomName");
        }
Example #18
0
        public void VerifyVisualTree()
        {
            TreeView treeView = null;

            RunOnUIThread.Execute(() =>
            {
                treeView = new TreeView()
                {
                    Width = 400, Height = 400
                };
                var node1 = new TreeViewNode()
                {
                    Content = "Node1"
                };
                treeView.RootNodes.Add(node1);
            });
            TestUtilities.SetAsVisualTreeRoot(treeView);

            VisualTreeTestHelper.VerifyVisualTree(root: treeView, verificationFileNamePrefix: "TreeView");
        }
Example #19
0
        private void VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode paneDisplayMode, string masterFilePrefix)
        {
            UIElement headerContent = null;

            RunOnUIThread.Execute(() =>
            {
                var navView = new NavigationView()
                {
                    Header = "HEADER", PaneDisplayMode = paneDisplayMode, Width = 400.0
                };
                Content = navView;
                Content.UpdateLayout();
                Grid rootGrid = VisualTreeHelper.GetChild(navView, 0) as Grid;
                if (rootGrid != null)
                {
                    headerContent = rootGrid.FindName("HeaderContent") as UIElement;
                }
            });

            VisualTreeTestHelper.VerifyVisualTree(
                root: headerContent,
                masterFilePrefix: masterFilePrefix);
        }
Example #20
0
        // Disabling flaky test
        // https://github.com/microsoft/microsoft-ui-xaml/issues/2363
        //[TestMethod]
        public void VerifyVisualTree()
        {
            var autoSuggestBox = SetupAutoSuggestBox();

            VisualTreeTestHelper.VerifyVisualTree(root: autoSuggestBox, masterFilePrefix: "AutoSuggestBox");
        }
        public void VerifyVisualTree()
        {
            var navigationView = SetupNavigationView();

            VisualTreeTestHelper.VerifyVisualTree(root: navigationView, masterFilePrefix: "NavigationView");
        }
        public void VerifyVisualTree()
        {
            var autoSuggestBox = SetupAutoSuggestBox();

            VisualTreeTestHelper.VerifyVisualTree(root: autoSuggestBox, verificationFileNamePrefix: "AutoSuggestBox");
        }