예제 #1
0
        public void DragOntoThis(Key modifier, params ITreeNode[] source)
        {
            SelectItemsForDragAndDrop(source);

            try {
                try {
                    if (modifier != Key.None)
                    {
                        Keyboard.Press(modifier);
                    }
                    var dest = Element;
                    if (source.Length == 1 && source[0] == this)
                    {
                        // dragging onto ourself, the mouse needs to move
                        var point = dest.GetClickablePoint();
                        Mouse.MoveTo(new Point(point.X + 1, point.Y + 1));
                    }
                    else
                    {
                        Mouse.MoveTo(dest.GetClickablePoint());
                    }
                } finally {
                    Mouse.Up(MouseButton.Left);
                }
            } finally {
                if (modifier != Key.None)
                {
                    Keyboard.Release(modifier);
                }
            }
        }
예제 #2
0
        public void MultiSelectCopyAndPaste()
        {
            using (var app = new VisualStudioApp())
            {
                app.OpenProject(@"TestData\NodejsProjectData\MultiSelectCopyAndPaste.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false))
                {
                    var window = app.OpenSolutionExplorer();

                    var folderNode = window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server.js");
                    Mouse.MoveTo(folderNode.GetClickablePoint());
                    Mouse.Click();

                    Keyboard.Press(Key.LeftShift);
                    Keyboard.PressAndRelease(Key.Down);
                    Keyboard.PressAndRelease(Key.Down);
                    Keyboard.Release(Key.LeftShift);
                    Keyboard.ControlC();

                    var projectNode = window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste");

                    AutomationWrapper.Select(projectNode);
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server - Copy.js"));
                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server2 - Copy.js"));
                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server3 - Copy.js"));
                }
            }
        }
 public static void PressAndRelease(Key key, params Key[] modifier)
 {
     for (int i = 0; i < modifier.Length; i++)
     {
         Keyboard.Press(modifier[i]);
     }
     Keyboard.Press(key);
     Keyboard.Release(key);
     for (int i = modifier.Length - 1; i >= 0; i--)
     {
         Keyboard.Release(modifier[i]);
     }
 }
예제 #4
0
        /// <summary>
        /// Moves one or more items in solution explorer to the destination using the mouse.
        /// </summary>
        private static void MoveByMouse(AutomationElement destination, params AutomationElement[] source)
        {
            SelectItemsForDragAndDrop(source);

            try {
                try {
                    Keyboard.Press(Key.LeftShift);
                    Mouse.MoveTo(destination.GetClickablePoint());
                } finally {
                    Mouse.Up(MouseButton.Left);
                }
            } finally {
                Keyboard.Release(Key.LeftShift);
            }
        }
예제 #5
0
파일: UITests.cs 프로젝트: wzhiliang/PTVS
        public void DjangoMultiSelectContextMenu(PythonVisualStudioApp app)
        {
            app.OpenProject(@"TestData\DjangoApplication.sln");

            app.OpenSolutionExplorer();
            var window = app.SolutionExplorerTreeView;

            var manageNode = window.FindItem("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "manage.py");

            Mouse.MoveTo(manageNode.GetClickablePoint());
            Mouse.Click(MouseButton.Left);

            Keyboard.Press(Key.LeftShift);
            Keyboard.PressAndRelease(Key.Down);
            Keyboard.Release(Key.LeftShift);

            Mouse.MoveTo(manageNode.GetClickablePoint());
            Mouse.Click(MouseButton.Right);

            Keyboard.Type("j"); // Exclude from Project
            Assert.IsNull(window.WaitForItemRemoved("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "manage.py"));
        }