Ejemplo n.º 1
0
        public void NewProfilingSessionOpenSolution() {
            EnvDTE.Project project;
            IPythonProfiling profiling;
            using (var app = OpenProfileTestProject(out project, out profiling)) {
                app.OpenPythonPerformance();
                app.PythonPerformanceExplorerToolBar.NewPerfSession();

                var perf = app.PythonPerformanceExplorerTreeView.WaitForItem("Performance");

                var session = profiling.GetSession(1);
                Assert.IsNotNull(session);

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // wait for the dialog, set some settings, save them.
                using (var perfTarget = new PythonPerfTarget(app.WaitForDialog())) {
                    perfTarget.SelectProfileProject();

                    perfTarget.SelectedProjectComboBox.SelectItem("HelloWorld");

                    try {
                        perfTarget.Ok();
                    } catch (ElementNotEnabledException) {
                        Assert.Fail("Settings were invalid:\n  SelectedProject = {0}",
                            perfTarget.SelectedProjectComboBox.GetSelectedItemName());
                    }
                }

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // re-open the dialog, verify the settings
                using (var perfTarget = new PythonPerfTarget(app.WaitForDialog())) {
                    Assert.AreEqual("HelloWorld", perfTarget.SelectedProject);
                }
            }
        }
Ejemplo n.º 2
0
        public void NewProfilingSession() {
            PythonPaths.Python27.AssertInstalled();

            var testFile = TestData.GetPath(@"TestData\ProfileTest\Program.py");
            Assert.IsTrue(File.Exists(testFile), "ProfileTest\\Program.py does not exist");

            using (var app = new PythonVisualStudioApp()) {
                app.OpenPythonPerformance();
                app.PythonPerformanceExplorerToolBar.NewPerfSession();

                var profiling = (IPythonProfiling)app.Dte.GetObject("PythonProfiling");

                app.OpenPythonPerformance();
                var perf = app.PythonPerformanceExplorerTreeView.WaitForItem("Performance *");
                Assert.IsNotNull(perf);
                var session = profiling.GetSession(1);
                Assert.IsNotNull(session);

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // wait for the dialog, set some settings, save them.
                using (var perfTarget = new PythonPerfTarget(app.WaitForDialog())) {
                    perfTarget.SelectProfileScript();

                    perfTarget.InterpreterComboBox.SelectItem("Python 2.7");
                    perfTarget.ScriptName = testFile;
                    perfTarget.WorkingDir = Path.GetDirectoryName(testFile);

                    try {
                        perfTarget.Ok();
                    } catch (ElementNotEnabledException) {
                        Assert.Fail("Settings were invalid:\n  ScriptName = {0}\n  Interpreter = {1}",
                            perfTarget.ScriptName, perfTarget.SelectedInterpreter);
                    }
                }
                app.WaitForDialogDismissed();

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // re-open the dialog, verify the settings
                using (var perfTarget = new PythonPerfTarget(app.WaitForDialog())) {
                    Assert.AreEqual("Python 2.7", perfTarget.SelectedInterpreter);
                    Assert.AreEqual(TestData.GetPath(@"TestData\ProfileTest\Program.py"), perfTarget.ScriptName);
                }
            }
        }