示例#1
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void SaveAs()
        {
            var project = DebugProject.OpenProject(@"Python.VS.TestData\SaveAsUI.sln");
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            // open and edit the file
            var folderNode = solutionTree.FindItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program.py");

            folderNode.SetFocus();
            Keyboard.PressAndRelease(Key.Enter);

            var item   = project.ProjectItems.Item("Program.py");
            var window = item.Open();

            var selection = ((TextSelection)window.Selection);

            selection.SelectAll();
            selection.Delete();

            // save under a new file name
            var    saveDialog = app.SaveAs();
            string oldName    = saveDialog.FileName;

            saveDialog.FileName = "Program2.py";
            saveDialog.Save();

            Assert.AreNotEqual(null, solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program2.py"));
        }
示例#2
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void MultiSelectCopyAndPaste()
        {
            DebugProject.OpenProject(@"Python.VS.TestData\DebuggerProject.sln");

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            var folderNode = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakAllTest.py");

            folderNode.SetFocus();

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

            var projectNode = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject");

            projectNode.SetFocus();
            Keyboard.ControlV();

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakAllTest - Copy.py"));
            Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakpointTest - Copy.py"));
            Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakpointTest2 - Copy.py"));
        }
示例#3
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void CopyPasteFile()
        {
            var project = DebugProject.OpenProject(@"Python.VS.TestData\HelloWorld.sln");

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            // find Program.py, send copy & paste, verify copy of file is there
            var programPy = window.FindItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "Program.py");

            programPy.SetFocus();

            Keyboard.ControlC();
            Keyboard.ControlV();

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "Program - Copy.py"));

            programPy.SetFocus();
            Keyboard.ControlC();
            Keyboard.ControlV();

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "Program - Copy (2).py"));
        }
示例#4
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void CopyFolderInToSelf()
        {
            DebugProject.OpenProject(@"Python.VS.TestData\HelloWorld2.sln", expectedProjects: 2);

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            var folder = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder");

            folder.SetFocus();
            Keyboard.ControlC();

            var subItem = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.py");

            subItem.SetFocus();
            Keyboard.ControlV();
            VisualStudioApp.CheckMessageBox("Cannot copy 'TestFolder'. The destination folder is a subfolder of the source folder.");
        }
示例#5
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void CopyFolderOnToSelf()
        {
            DebugProject.OpenProject(@"Python.VS.TestData\HelloWorld2.sln", expectedProjects: 2);

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            var folder = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder");

            folder.SetFocus();

            Keyboard.ControlC();

            folder.SetFocus();
            Keyboard.ControlV();

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder - Copy"));
        }
示例#6
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void RenameProjectToExisting()
        {
            var project = DebugProject.OpenProject(@"Python.VS.TestData\RenameProjectTestUI.sln");

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            // find Program.py, send copy & paste, verify copy of file is there
            var projectNode = window.FindItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorld");

            // rename once, cancel renaming to existing file....
            projectNode.SetFocus();
            Keyboard.PressAndRelease(Key.F2);
            System.Threading.Thread.Sleep(100);

            Keyboard.Type("HelloWorldExisting");
            System.Threading.Thread.Sleep(100);
            Keyboard.PressAndRelease(Key.Enter);

            IntPtr dialog = app.WaitForDialog();

            VisualStudioApp.CheckMessageBox("HelloWorldExisting.pyproj", "overwrite");

            // rename again, don't cancel...
            projectNode.SetFocus();
            Keyboard.PressAndRelease(Key.F2);
            System.Threading.Thread.Sleep(100);

            Keyboard.Type("HelloWorldExisting");
            System.Threading.Thread.Sleep(100);
            Keyboard.PressAndRelease(Key.Enter);

            dialog = app.WaitForDialog();

            VisualStudioApp.CheckMessageBox(MessageBoxButton.Yes, "HelloWorldExisting.pyproj", "overwrite");

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorldExisting"));
        }
示例#7
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void AddNewFolder()
        {
            var project = DebugProject.OpenProject(@"Python.VS.TestData\HelloWorld.sln");

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            // find Program.py, send copy & paste, verify copy of file is there
            var projectNode = window.FindItem("Solution 'HelloWorld' (1 project)", "HelloWorld");

            projectNode.SetFocus();

            Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
            Keyboard.PressAndRelease(Key.D);
            Keyboard.PressAndRelease(Key.Right);
            Keyboard.PressAndRelease(Key.D);
            Keyboard.Type("MyNewFolder");
            Keyboard.PressAndRelease(Key.Enter);

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "MyNewFolder"));
        }
示例#8
0
文件: UITests.cs 项目: rsumner33/PTVS
        public void CutPaste()
        {
            DebugProject.OpenProject(@"Python.VS.TestData\HelloWorld2.sln", expectedProjects: 2);

            var app = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            var subItem = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.py");

            subItem.SetFocus();

            Keyboard.ControlX();

            var projectNode = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2");

            projectNode.SetFocus();
            Keyboard.ControlV();

            Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "SubItem.py"));
            Assert.AreEqual(null, window.WaitForItemRemoved("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.py"));
        }