[Monodevelop-patches-list] r2364 - in trunk/MonoDevelop/Extras/NUnit: . Gui Services

John Luke <jluke@cfl.rr.com> jluke at mono-cvs.ximian.com
Wed Mar 16 20:35:19 EST 2005


Author: jluke
Date: 2005-03-16 20:35:19 -0500 (Wed, 16 Mar 2005)
New Revision: 2364

Modified:
   trunk/MonoDevelop/Extras/NUnit/Gui/TestPad.cs
   trunk/MonoDevelop/Extras/NUnit/Makefile
   trunk/MonoDevelop/Extras/NUnit/Services/NUnitService.cs
Log:
report status/progress while loading assembly


Modified: trunk/MonoDevelop/Extras/NUnit/Gui/TestPad.cs
===================================================================
--- trunk/MonoDevelop/Extras/NUnit/Gui/TestPad.cs	2005-03-17 00:41:19 UTC (rev 2363)
+++ trunk/MonoDevelop/Extras/NUnit/Gui/TestPad.cs	2005-03-17 01:35:19 UTC (rev 2364)
@@ -20,10 +20,14 @@
 		TreeStore store;
 		Hashtable iters;
 		TestSuite rootTestSuite;
+
+		IStatusBarService statusBarService;
 		NUnitService nunitService;
 
 		int currentTest, totalTests;
 
+		event FixtureAddedEventHandler FixtureAddedEvent;
+
 		public TestPad () : base ("NUnit")
 		{
 			sw = new ScrolledWindow ();
@@ -34,9 +38,12 @@
 			// color, name
 			store = new TreeStore (typeof (Gdk.Pixbuf), typeof (string));
 
+			// services
+			statusBarService = ServiceManager.GetService (typeof (IStatusBarService)) as IStatusBarService;
 			nunitService = ServiceManager.GetService (typeof (NUnitService)) as NUnitService;
 
 			// register events
+			this.FixtureAddedEvent += OnFixtureAdded;
 			nunitService.AssemblyLoaded += OnAssemblyLoaded;
 			nunitService.TestFinishedEvent += OnTestFinished;
 		}
@@ -96,7 +103,8 @@
 
 				if (t.IsSuite)
 					AddTestSuite (next, (TestSuite) t);
-				// FIXME: else fixture addevent
+				else if (FixtureAddedEvent != null)
+					FixtureAddedEvent (this, new FixtureAddedEventArgs (++ currentTest, totalTests));
 			}
 		}
 
@@ -105,6 +113,21 @@
 			GLib.Idle.Add (new GLib.IdleHandler (Populate));
 		}
 
+		void OnFinishedLoad (object sender, EventArgs a)
+		{
+			string msg = String.Format (GettextCatalog.GetString ("{0} tests loaded."), totalTests);
+			statusBarService.SetProgressFraction (0.0);
+			statusBarService.SetMessage (msg);
+			// FIXME: set run menu items sensitive
+		}
+
+		void OnFixtureAdded (object sender, FixtureAddedEventArgs a)
+		{
+			string msg = String.Format (GettextCatalog.GetString ("Loading test {0} of {1}"), a.Current, a.Total);
+			statusBarService.SetProgressFraction (a.Current / a.Total);
+			statusBarService.SetMessage (msg);
+		}
+
 		void OnRowActivated (object sender, RowActivatedArgs a)
 		{
 			RunTestAtPath (a.Path);
@@ -129,7 +152,7 @@
 			currentTest = 0;
 			totalTests = rootTestSuite.CountTestCases ();
 			AddTestSuite (root, rootTestSuite);
-			//OnFinishedLoad
+			OnFinishedLoad (null, null);
 
 			view.Model = store;
 			return false;

Modified: trunk/MonoDevelop/Extras/NUnit/Makefile
===================================================================
--- trunk/MonoDevelop/Extras/NUnit/Makefile	2005-03-17 00:41:19 UTC (rev 2363)
+++ trunk/MonoDevelop/Extras/NUnit/Makefile	2005-03-17 01:35:19 UTC (rev 2364)
@@ -13,6 +13,7 @@
 
 FILES = \
 AssemblyInfo.cs \
+FixtureAddedEventHandler.cs \
 Commands/NUnitCommands.cs \
 Gui/CircleImage.cs \
 Gui/TestPad.cs \

Modified: trunk/MonoDevelop/Extras/NUnit/Services/NUnitService.cs
===================================================================
--- trunk/MonoDevelop/Extras/NUnit/Services/NUnitService.cs	2005-03-17 00:41:19 UTC (rev 2363)
+++ trunk/MonoDevelop/Extras/NUnit/Services/NUnitService.cs	2005-03-17 01:35:19 UTC (rev 2364)
@@ -10,6 +10,7 @@
 	public class NUnitService : AbstractService, EventListener
 	{
 		Assembly asm;
+		bool running = false;
 
 		public event EventHandler AssemblyLoaded;
 		public event EventHandler FixtureLoadError;
@@ -81,7 +82,13 @@
 
 		public void RunTest (Test test)
 		{
+			if (running) {
+				Console.WriteLine ("already running a test");
+				return;
+			}
+			running = true;
 			test.Run (this);
+			running = false;
 		}
 
 		public void SuiteFinished (TestSuiteResult result)




More information about the Monodevelop-patches-list mailing list