diff options
Diffstat (limited to 'main/src/addins/NUnit/Gui')
4 files changed, 44 insertions, 12 deletions
diff --git a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs index 1d7c6e5a4e..bea7c43faa 100644 --- a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs +++ b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs @@ -122,7 +122,7 @@ namespace MonoDevelop.NUnit foreach (string file in dlg.SelectedFiles) config.Assemblies.Add (new TestAssembly (file)); - IdeApp.Workspace.Save(); + IdeApp.Workspace.SaveAsync(); } } } diff --git a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs index 490a355404..2cc8a48c5e 100644 --- a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs +++ b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs @@ -117,7 +117,7 @@ namespace MonoDevelop.NUnit NUnitAssemblyGroupProject project = CurrentNode.DataItem as NUnitAssemblyGroupProject; project.ParentFolder.Items.Remove (project); project.Dispose (); - IdeApp.Workspace.Save (); + IdeApp.Workspace.SaveAsync (); } } } diff --git a/main/src/addins/NUnit/Gui/TestPad.cs b/main/src/addins/NUnit/Gui/TestPad.cs index 9b2c1fc7c3..15ece94e07 100644 --- a/main/src/addins/NUnit/Gui/TestPad.cs +++ b/main/src/addins/NUnit/Gui/TestPad.cs @@ -44,6 +44,7 @@ using MonoDevelop.Projects; using Mono.TextEditor; using System.Linq; using MonoDevelop.Components; +using MonoDevelop.Ide.Commands; namespace MonoDevelop.NUnit { @@ -51,7 +52,7 @@ namespace MonoDevelop.NUnit { NUnitService testService = NUnitService.Instance; - IAsyncOperation runningTestOperation; + AsyncOperation runningTestOperation; VPaned paned; TreeView detailsTree; ListStore detailsStore; @@ -411,7 +412,7 @@ namespace MonoDevelop.NUnit { UnitTest test = GetSelectedTest (); if (test != null) { - SolutionEntityItem item = test.OwnerObject as SolutionEntityItem; + SolutionItem item = test.OwnerObject as SolutionItem; ExecutionModeCommandService.GenerateExecutionModeCommands ( item, test.CanRun, @@ -467,12 +468,12 @@ namespace MonoDevelop.NUnit return nav.DataItem as UnitTest; } - public IAsyncOperation RunTest (UnitTest test, IExecutionHandler mode) + public AsyncOperation RunTest (UnitTest test, IExecutionHandler mode) { return RunTest (FindTestNode (test), mode, false); } - IAsyncOperation RunTest (ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true) + AsyncOperation RunTest (ITreeNavigator nav, IExecutionHandler mode, bool bringToFront = true) { if (nav == null) return null; @@ -487,7 +488,7 @@ namespace MonoDevelop.NUnit if (bringToFront) IdeApp.Workbench.GetPad<TestPad> ().BringToFront (); runningTestOperation = testService.RunTest (test, mode); - runningTestOperation.Completed += (OperationHandler) DispatchService.GuiDispatch (new OperationHandler (OnTestSessionCompleted)); + runningTestOperation.Task.ContinueWith (t => OnTestSessionCompleted ()); return runningTestOperation; } @@ -501,10 +502,9 @@ namespace MonoDevelop.NUnit RunTest (TreeView.GetSelectedNode (), mode); } - void OnTestSessionCompleted (IAsyncOperation op) + void OnTestSessionCompleted () { - if (op.Success) - RefreshDetails (); + RefreshDetails (); runningTestOperation = null; this.buttonRunAll.Sensitive = true; this.buttonStop.Sensitive = false; diff --git a/main/src/addins/NUnit/Gui/TestResultsPad.cs b/main/src/addins/NUnit/Gui/TestResultsPad.cs index 1baf8b81e5..00c4fa75ea 100644 --- a/main/src/addins/NUnit/Gui/TestResultsPad.cs +++ b/main/src/addins/NUnit/Gui/TestResultsPad.cs @@ -42,6 +42,8 @@ using MonoDevelop.Components.Docking; using MonoDevelop.Ide; using System.Text.RegularExpressions; using MonoDevelop.Components; +using System.Threading; +using MonoDevelop.Ide.Commands; namespace MonoDevelop.NUnit { @@ -475,7 +477,34 @@ namespace MonoDevelop.NUnit } } } - + + [CommandHandler (EditCommands.Copy)] + protected void OnCopy () + { + UnitTest test = GetSelectedTest (); + if (test != null) { + var last = test.GetLastResult (); + if (last == null) + return; + var clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false)); + clipboard.Text = last.StackTrace; + } + } + + [CommandUpdateHandler (EditCommands.Copy)] + protected void OnUpdateCopy (CommandInfo info) + { + UnitTest test = GetSelectedTest (); + if (test != null) { + var result = test.GetLastResult (); + if (result != null) { + info.Enabled = !string.IsNullOrEmpty (result.StackTrace); + return; + } + } + info.Enabled = false; + } + [CommandHandler (TestCommands.SelectTestInTree)] protected void OnSelectTestInTree () { @@ -704,11 +733,14 @@ namespace MonoDevelop.NUnit { ITestProgressMonitor monitor; TestResultsPad pad; + CancellationTokenSource cs; - public TestMonitor (TestResultsPad pad) + public TestMonitor (TestResultsPad pad, CancellationTokenSource cs) { this.pad = pad; this.monitor = pad; + this.cs = cs; + cs.Token.Register (Cancel); } public void InitializeTestRun (UnitTest test) { |