Exemplo n.º 1
0
        public void RightClickHelp(string serverName, string folderName, string projectName)
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5);

            Mouse.Move(p);
            Thread.Sleep(500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Thread.Sleep(500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Thread.Sleep(500);
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Down}");
            Keyboard.SendKeys("{Enter}");
        }
        public UITestControl GetActivity()
        {
            UITestControl control       = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "DropPoint");
            var           uiTestControl = control.GetChildren()[0];

            return(uiTestControl.FriendlyName == "Drop Activity Here" ? null : uiTestControl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Navigates to a Workflow Item in the Explorer, Right Clicks it, and clicks Properties
        /// </summary>
        /// <param name="serverName">The name of the server (EG: localhost)</param>
        /// <param name="serviceType">The name of the service (EG: WORKFLOWS)</param>
        /// <param name="folderName">The name of the folder (AKA: Category - EG: BARNEY (Or CODEDUITESTCATEGORY for the CodedUI Test Default))</param>
        /// <param name="projectName">The name of the project (EG: MyWorkflow)</param>
        public void RightClickProperties(string serverName, string folderName, string projectName)
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5);

            Mouse.Move(p);
            Playback.Wait(500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Playback.Wait(1500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Playback.Wait(1500);
            SendKeys.SendWait("{UP}");
            Playback.Wait(100);
            SendKeys.SendWait("{ENTER}");
            Playback.Wait(100);
        }
Exemplo n.º 4
0
        public void RightClickDeployProject(string folderName, string projectName, string serverName = "localhost")
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5);

            Mouse.Move(p);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Thread.Sleep(1500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Thread.Sleep(1500);
            SendKeys.SendWait("{DOWN}");
            Thread.Sleep(100);
            SendKeys.SendWait("{DOWN}");
            Thread.Sleep(100);
            SendKeys.SendWait("{ENTER}");

            // Add some focus, and dleay to make sure everything is fine
            Thread.Sleep(2500);
            Mouse.Click(new Point(Screen.PrimaryScreen.WorkingArea.Width - 10, Screen.PrimaryScreen.WorkingArea.Height / 2));
            Thread.Sleep(2500);
        }
Exemplo n.º 5
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            foreach (TextBox tb in VisualTreeWalker.FindVisualChildren <TextBox>(this))
            {
                var be = tb.GetBindingExpression(TextBox.TextProperty);
                if (be != null)
                {
                    be.UpdateSource();
                }
            }

            if (string.IsNullOrEmpty(((ViewModels.Clients)DataContext).CurrentClient.IdCode))
            {
                MessageBox.Show("Tunniste ei voi olla tyhjä.", "Puuttuvia tietoja", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }
            if (string.IsNullOrEmpty(((ViewModels.Clients)DataContext).CurrentClient.Name))
            {
                MessageBox.Show("Nimi ei voi olla tyhjä.", "Puuttuvia tietoja", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }
            try
            {
                ((ViewModels.Clients)DataContext).SaveCurrentClient();
            }
            catch (Exception x)
            {
                Console.WriteLine(x.Message);
                MessageBox.Show("Tallennus epäonnistui." + Environment.NewLine + "Virhe: " + x.Message);
            }
        }
Exemplo n.º 6
0
 private void GetExplorerTree()
 {
     try
     {
         _explorerTree = VisualTreeWalker.GetControl(
             "UI_DocManager_AutoID",
             "Z91e998e0ee8c4f069cdab9d2cd3f544e",
             "Z306a8df47193448e9dd2228d905d49cd",
             "UI_ExplorerPane_AutoID",
             "Uia.ExplorerView",
             "UI_NavigationViewUserControl_AutoID",
             "UI_ExplorerTree_AutoID");
     }
     catch (UITestControlNotFoundException)
     //_explorerTree = VisualTreeWalker.GetControlFromRoot(0, false, 0, "Uia.SplitPane", "Z306a8df47193448e9dd2228d905d49cd", "UI_ExplorerPane_AutoID", "Explorer", "TheNavigationView", "Navigation");
     //if(_explorerTree == null)
     {
         _explorerTree = VisualTreeWalker.GetControl(
             "UI_DocManager_AutoID",
             "Zc30a7af8e0c54bb5bccfbea116f8ab0d",
             "Zf1166e575b5d43bb89f15f346eccb7b1",
             "Z3d0e8544bdbd4fbc8b0369ecfce4e928",
             "Explorer",
             "UI_ExplorerPane_AutoID",
             "Uia.ExplorerView",
             "UI_NavigationViewUserControl_AutoID",
             "UI_ExplorerTree_AutoID");
         //_explorerTree = VisualTreeWalker.GetControlFromRoot(0, false, 1, "Uia.SplitPane", "Zf1166e575b5d43bb89f15f346eccb7b1", "Z3d0e8544bdbd4fbc8b0369ecfce4e928", "Explorer", "UI_ExplorerPane_AutoID", "Explorer", "TheNavigationView", "Navigation");
     }
 }
Exemplo n.º 7
0
        public void DoubleClickOpenProject(string serverName, string folderName, string projectName, int waitAmt = 0)
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            if (theControl != null)
            {
                Point p = new Point(theControl.BoundingRectangle.X + 60, theControl.BoundingRectangle.Y + 7);
                Playback.Wait(50);
                Mouse.Click(p);
                Playback.Wait(150);
                try
                {
                    Mouse.DoubleClick(p);
                    // ReSharper disable EmptyGeneralCatchClause
                }
                catch
                // ReSharper restore EmptyGeneralCatchClause
                {
                    // this darn double click keeps bombing out ;)
                }
                Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads;
                theControl.WaitForControlReady();
                Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly;
                Playback.Wait(waitAmt);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Rights the click rename project.
        /// </summary>
        /// <param name="resourceName"></param>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="categoryName"></param>
        /// <param name="newName"></param>
        /// <param name="serverName"></param>
        public void RightClickRenameResource(string resourceName, string categoryName, string newName, string serverName = "localhost")
        {
            EnterExplorerSearchText(resourceName);
            UITestControl theControl = null;

            if (categoryName != "Unassigned" && categoryName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName);
            }
            Point p = new Point(theControl.BoundingRectangle.X + 100, theControl.BoundingRectangle.Y + 5);

            Mouse.Move(p);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Playback.Wait(500);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(50);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(50);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(50);
            SendKeys.SendWait("{ENTER}");
            Playback.Wait(50);
            SendKeys.SendWait(newName);
            Playback.Wait(50);
            SendKeys.SendWait("{TAB}");
            Playback.Wait(150);
            SendKeys.SendWait("{TAB}");
        }
Exemplo n.º 9
0
        public void StoppingTimerStopsTimer()
        {
            var analyzer = new AnalyzeInvokeCountAnalyzer();
            VisualTreeWalker      walker = null;
            VisualTreeWalkerTimer timer  = null;

            RunOnUIThread.Execute(() =>
            {
                walker = new VisualTreeWalker(new Button(), analyzer);
                timer  = new VisualTreeWalkerTimer(walker, 10);
                timer.Start();
            });
            RunOnUIThread.WaitMilliSeconds(300);
            Assert.IsTrue(analyzer.AnalyzeCount >= 1);

            var oldCount = 0;

            RunOnUIThread.Execute(() =>
            {
                timer.Stop();
                Logger.LogMessage("Analyzer count before stopping: " + analyzer.AnalyzeCount);
                oldCount = analyzer.AnalyzeCount;
            });

            RunOnUIThread.WaitMilliSeconds(400);
            Logger.LogMessage("Analyzer count after stopping: " + analyzer.AnalyzeCount);
            Assert.IsTrue(analyzer.AnalyzeCount == oldCount);
        }
Exemplo n.º 10
0
 private bool ValidateResourceExists(string resourceName, string folderName, string serverName = "localhost")
 {
     try
     {
         EnterExplorerSearchText(resourceName);
         Playback.Wait(1000);
         UITestControl theControl = null;
         if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
         {
             theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, resourceName);
         }
         else
         {
             theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName);
         }
         if (theControl == null)
         {
             return(false);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 11
0
        private List <UITestControl> GetDataGridRowChildList(int rowNumber, ViewType viewType)
        {
            UITestControl        childByAutomationIDPath = VisualTreeWalker.GetChildByAutomationIdPath(GetView(viewType), "Table");
            List <UITestControl> uiTestControlCollection = childByAutomationIDPath.GetChildren().Where(c => c.ControlType == ControlType.Row).ToList();

            return(uiTestControlCollection[rowNumber].GetChildren().ToList());
        }
Exemplo n.º 12
0
        public void DragActivityOnDropPoint(ToolType toolType)
        {
            UITestControl dropPoint         = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "DropPoint");
            var           boundingRectangle = dropPoint.BoundingRectangle;

            ToolboxUIMap.DragControlToWorkflowDesigner(toolType, new Point(boundingRectangle.X + 10, boundingRectangle.Y + 10));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Drags the resource from the explorer to the active tab.
        /// </summary>
        /// <param name="tabToDropOnto">The tab to drop the resource onto.</param>
        /// <param name="resourceName">The name of the resource.</param>
        /// <param name="categoryName">The name of the category.</param>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="serverName">Name of the server (Will default to "localhost").</param>
        /// <param name="pointToDragTo">The point to drop the resource on the designer (Will default to just below the start node).</param>
        /// <param name="overrideDblClickBehavior">if set to <c>true</c> [override double click behavior].</param>
        public UITestControl DragResourceOntoWorkflowDesigner(UITestControl tabToDropOnto, string resourceName, string categoryName, string serverName = "localhost", Point pointToDragTo = new Point())
        {
            if (pointToDragTo.X == 0 && pointToDragTo.Y == 0)
            {
                pointToDragTo = WorkflowDesignerUIMap.GetStartNodeBottomAutoConnectorPoint(tabToDropOnto);
            }
            EnterExplorerSearchText(resourceName);
            UITestControl theControl = null;

            if (categoryName != "Unassigned" && categoryName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName);
            }
            Mouse.StartDragging(theControl);
            Playback.Wait(20);
            Mouse.StopDragging(pointToDragTo);
            Playback.Wait(100);
            UITestControl resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, resourceName);
            int           counter = 0;

            while (resourceOnDesignSurface == null && counter < 5)
            {
                Playback.Wait(1000);
                resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, resourceName);
                Playback.Wait(500);
                counter++;
            }

            return(resourceOnDesignSurface);
        }
Exemplo n.º 14
0
        public void RightClickDeleteResource(string resourceName, string categoryName, string serverName)
        {
            EnterExplorerSearchText(resourceName);
            UITestControl theControl = null;

            if (categoryName != "Unassigned" && categoryName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName);
            }
            Point p = new Point(theControl.BoundingRectangle.X + 100, theControl.BoundingRectangle.Y + 5);

            Mouse.Move(p);
            Playback.Wait(500);
            Mouse.Click(MouseButtons.Right, ModifierKeys.None, p);
            Playback.Wait(1000);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(100);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(100);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(100);
            SendKeys.SendWait("{DOWN}");
            Playback.Wait(100);
            SendKeys.SendWait("{ENTER}");
            PopupDialogUIMap.WaitForDialog();
            Playback.Wait(100);
            var confirmationDialog = UIBusinessDesignStudioWindow.GetChildren()[0];
            var yesButton          = confirmationDialog.GetChildren().FirstOrDefault(c => c.FriendlyName == "Yes");

            Mouse.Click(yesButton, new Point(10, 10));
        }
Exemplo n.º 15
0
        public WpfTree GetSourceNavigationTree()
        {
            var activeTab         = TabManagerUIMap.GetActiveTab();
            var deployUserControl = GetDeployUserControl(activeTab);


            return(VisualTreeWalker.GetChildByAutomationIdPath(deployUserControl, "SourceNavigationView", "Navigation") as WpfTree);
        }
        /// <summary>
        /// DebugWindowExists
        /// </summary>
        ///

        public WpfRow GetRow(int row)
        {
            var debugWindow = GetDebugWindow();

            debugWindow.WaitForControlEnabled();
            var inputGrid = VisualTreeWalker.GetChildByAutomationIdPath(debugWindow, "TabItems", "UI_InputDataTab_AutoID", "DataListInputs");

            return(inputGrid.GetChildren()[row] as WpfRow);
        }
Exemplo n.º 17
0
        public string GetStatus()
        {
            UITestControl statusRadioButton = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _enabledRadioButtonAutoIds);

            if (statusRadioButton.IsSelected())
            {
                return("Enabled");
            }
            return("Disabled");
        }
Exemplo n.º 18
0
        void DocumentsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Due to an issue with ElementFlow we need to synchronize the selected items manually
            var elementFlow = VisualTreeWalker.FindName <ElementFlow>("ef", DocumentsListBox);

            if (elementFlow != null)
            {
                elementFlow.SelectedIndex = DocumentsListBox.SelectedIndex;
            }
        }
        private void AccessibilityDemoPage_Loaded(object sender, RoutedEventArgs e)
        {
            var analyzer = new AccessibilityAnalyzer();
            var walker   = new VisualTreeWalker(this, analyzer);

            walker.ScanVisualTree();

            timer = new VisualTreeWalkerTimer(walker);
            timer.Start();
        }
Exemplo n.º 20
0
        private WpfText GetTitleLabel(string autoId)
        {
            UITestControlCollection uiTestControlCollection = StudioWindow.GetChildren();
            var tryGetDialog = uiTestControlCollection[0];

            UITestControl childByAutomationIDPath = VisualTreeWalker.GetChildByAutomationIdPath(tryGetDialog, autoId);
            WpfText       wpfText = childByAutomationIDPath as WpfText;

            if (wpfText != null)
            {
                return(wpfText);
            }
            throw new Exception("Could not find the " + autoId + " label.");
        }
Exemplo n.º 21
0
        public bool ServiceExists(string serverName, string folderName, string projectName)
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            return(theControl != null && theControl.Exists);
        }
        private static void VerifyElementsVisitedCount(FrameworkElement root, int visitedNoteCount)
        {
            App.Content = root;

            var visitedItems = new List <FrameworkElement>();
            var analyzer     = new CountingElementAnalyzer(visitedItems);
            var walker       = new VisualTreeWalker(root);

            walker.Analyzers.Add(analyzer);

            walker.ScanVisualTree();

            Assert.AreEqual(visitedNoteCount, visitedItems.Count, "Should have visited every element exactly once.");
        }
Exemplo n.º 23
0
        public List <UITestControl> GetInputMappingRows()
        {
            UITestControl table = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "LargeView", "Table");

            if (table == null)
            {
                return(new List <UITestControl>());
            }

            UITestControlCollection tableChildren = table.GetChildren();
            List <UITestControl>    rows          = tableChildren.Where(c => c.ControlType == ControlType.Row).ToList();

            return(rows);
        }
Exemplo n.º 24
0
        public List <string> GetActivityList()
        {
            List <string> activityNames = new List <string>();

            WpfTable table = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "InitialFocusElement") as WpfTable;

            if (table != null)
            {
                var uiTestControlCollection = table.Rows;
                foreach (var control in uiTestControlCollection)
                {
                    activityNames.Add(control.Name);
                }
            }
            return(activityNames);
        }
Exemplo n.º 25
0
 public OutputUIMap()
 {
     //_outputPane = VisualTreeWalker.GetControl("UI_DocManager_AutoID", "OutputPane", "DebugOutput");
     //_outputEdit = VisualTreeWalker.GetControl("UI_DocManager_AutoID", "OutputPane", "Edit");
     //_outputStatus = VisualTreeWalker.GetControl("UI_DocManager_AutoID", "OutputPane", "Edit", "Dev2StatusBarAutomationID", "StatusBar");
     //_outputPane = VisualTreeWalker.GetControlFromRoot(true, 1, null, "UI_DocManager_AutoID", "Z96bb9badc4b148518ea4eff80920f8d9", "Zfb2fe4b8a0e84c8fb3fda8601e62a61e", "Zae7dc5529efd48379e593356fee56c4c", "OutputPane", "DebugOutput");
     if (_outputPane == null)
     {
         _outputPane = VisualTreeWalker.GetControlFromRoot(true, 0, null, "UI_DocManager_AutoID", "Z96bb9badc4b148518ea4eff80920f8d9", "OutputPane", "DebugOutput");
     }
     //_outputEdit = VisualTreeWalker.GetControlFromRoot(0, false, 1, "Uia.SplitPane", "Z96bb9badc4b148518ea4eff80920f8d9", "Zfb2fe4b8a0e84c8fb3fda8601e62a61e", "Zae7dc5529efd48379e593356fee56c4c", "OutputPane", "DebugOutput", "Edit");
     if (_outputStatus == null)
     {
         _outputStatus = VisualTreeWalker.GetControlFromRoot(true, 0, _outputPane, "Dev2StatusBarAutomationID").GetChildren()[0];
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// Drags the control automatic workflow designer.
        /// </summary>
        /// <param name="serverName">Name of the server.</param>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="folderName">Name of the folder.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="p">The application.</param>
        /// <param name="overrideDblClickBehavior">if set to <c>true</c> [override double click behavior].</param>
        public void DragControlToWorkflowDesigner(string serverName, string serviceType, string folderName, string projectName, Point p)
        {
            UITestControl theControl = null;

            if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty)
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName);
            }
            else
            {
                theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName);
            }
            Mouse.StartDragging(theControl);
            Playback.Wait(20);
            Mouse.StopDragging(p);
            Playback.Wait(100);
        }
        public void VerifyVisitingOrderIsBreadthFirstSearch()
        {
            App.Content = new BreadthFirsSearchTestTree();
            var visitedItems = new List <FrameworkElement>();
            var analyzer     = new CountingElementAnalyzer(visitedItems);
            var walker       = new VisualTreeWalker(App.Content);

            walker.Analyzers.Add(analyzer);

            walker.ScanVisualTree();

            Assert.AreEqual(28, visitedItems.Count, "Should have visited every element exactly once.");
            for (int i = 0; i < visitedItems.Count; i++)
            {
                Assert.AreEqual(i.ToString(), visitedItems[i].Tag, "Should have visited items in specific orders");
            }
        }
Exemplo n.º 28
0
        protected override void OnAttached()
        {
            base.OnAttached();

            AssociatedObject.LayoutUpdated += AssociatedObject_EventHandler;
            AssociatedObject.Loaded        += (s, e) =>
            {
                var window = VisualTreeWalker.FindParent <Window>(AssociatedObject);
                window.LocationChanged += (ss, ee) =>
                {
                    if (!BlockReentrance)
                    {
                        ShouldCenter = false;
                    }
                };
            };
        }
Exemplo n.º 29
0
        public UITestControl ClickRibbonMenuItem(string itemName, int waitAmt = 100)
        {
            var control = VisualTreeWalker.GetChildByAutomationIdPath(StudioWindow, itemName);

            if (control == null)
            {
                var message = string.Format("Resource with name : [{0}] was not found", itemName);
                throw new Exception(message);
            }

            control.WaitForControlEnabled();
            var p = new Point(control.BoundingRectangle.X + 5, control.BoundingRectangle.Y + 5);

            Mouse.Click(p);
            Playback.Wait(waitAmt);
            return(control);
        }
Exemplo n.º 30
0
        public void ScansMultipleTimes()
        {
            var analyzer = new AnalyzeInvokeCountAnalyzer();
            VisualTreeWalker      walker = null;
            VisualTreeWalkerTimer timer  = null;

            RunOnUIThread.Execute(() =>
            {
                walker = new VisualTreeWalker(new Button(), analyzer);
                timer  = new VisualTreeWalkerTimer(walker, 10);
                timer.Start();
            });

            RunOnUIThread.WaitMilliSeconds(500);

            Logger.LogMessage("Analyzer count: " + analyzer.AnalyzeCount);
            Assert.IsTrue(analyzer.AnalyzeCount >= 2);
        }