Jelajahi Sumber

removed remainging #520 comments and re-enabled broken mdi test

Charlie Kindel 2 tahun lalu
induk
melakukan
34d4caa883

+ 1 - 9
Terminal.Gui/Core/Application.cs

@@ -329,11 +329,6 @@ namespace Terminal.Gui {
 		/// into a single call. An applciation cam use <see cref="Run{T}(Func{Exception, bool}, ConsoleDriver, IMainLoopDriver)"/> 
 		/// without explicitly calling <see cref="Init(ConsoleDriver, IMainLoopDriver)"/>.
 		/// </para>
-		/// <remarks>
-		/// Note, due to Issue #520, if Init is called and <see cref="Begin(Toplevel)"/> is not called, the <see cref="Toplevel"/>
-		/// created by this function will NOT be Disposed when <see cref="Shutdown"/> is called. Call Dispose() on <see cref="Application.Top"/> 
-		/// before calling <see cref="Shutdown"/> if <see cref="Begin(Toplevel)"/> (and <see cref="End(RunState)"/>) has not been called.
-		/// </remarks>
 		/// <param name="driver">The <see cref="ConsoleDriver"/> to use. If not specified the default driver for the
 		/// platform will be used (see <see cref="WindowsDriver"/>, <see cref="CursesDriver"/>, and <see cref="NetDriver"/>).</param>
 		/// <param name="mainLoopDriver">Specifies the <see cref="MainLoop"/> to use.</param>
@@ -887,8 +882,6 @@ namespace Terminal.Gui {
 			}
 
 			var rs = new RunState (toplevel);
-			// Fixes #520 - Begin should be decoupled from Init
-			//Init ();
 			
 			if (toplevel is ISupportInitializeNotification initializableNotification &&
 			    !initializableNotification.IsInitialized) {
@@ -902,7 +895,7 @@ namespace Terminal.Gui {
 			lock (toplevels) {
 				// If Top was already initialized with Init, and Begin has never been called
 				// Top was not added to the toplevels Stack. It will thus never get disposed.
-				// Clean it up here (fixes #520).
+				// Clean it up here:
 				if (Top != null && toplevel != Top && !toplevels.Contains(Top)) {
 					Top.Dispose ();
 					Top = null;
@@ -1052,7 +1045,6 @@ namespace Terminal.Gui {
 			}
 			toplevels.Clear ();
 			Current = null;
-			// Fixes #520: Dispose Top
 			Top?.Dispose ();
 			Top = null;
 

+ 0 - 5
UnitTests/ApplicationTests.cs

@@ -70,10 +70,6 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (80, Application.Driver.Cols);
 			Assert.Equal (25, Application.Driver.Rows);
 
-			// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
-			// So we need to dispose it manually
-			//Application.Top.Dispose ();
-
 			Application.Shutdown ();
 
 			// Verify state is back to initial
@@ -95,7 +91,6 @@ namespace Terminal.Gui.Core {
 			Application.Shutdown ();
 
 			Assert.Single (Responder.Instances);
-			// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
 			Assert.True (Responder.Instances [0].WasDisposed);
 		}
 

+ 1 - 5
UnitTests/MdiTests.cs

@@ -31,10 +31,8 @@ namespace Terminal.Gui.Core {
 			Application.Shutdown ();
 
 			Assert.Equal (2, Responder.Instances.Count);
-			// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
-			// Change this to True once fixed.
 			Assert.True (Responder.Instances [0].WasDisposed);
-			Assert.True(Responder.Instances [1].WasDisposed);
+			Assert.True (Responder.Instances [1].WasDisposed);
 		}
 
 		[Fact]
@@ -49,8 +47,6 @@ namespace Terminal.Gui.Core {
 			Application.Shutdown ();
 
 			Assert.Equal (2, Responder.Instances.Count);
-			// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
-			// Change this to True once fixed.
 			Assert.True (Responder.Instances [0].WasDisposed);
 			Assert.True (Responder.Instances [1].WasDisposed);
 		}

+ 2 - 2
UnitTests/ToplevelTests.cs

@@ -425,8 +425,8 @@ namespace Terminal.Gui.Core {
 		}
 
 		// This test broke with fix to #520
-		//[Fact]
-		//[AutoInitShutdown]
+		[Fact]
+		[AutoInitShutdown]
 		public void KeyBindings_Command_With_MdiTop ()
 		{
 			var top = Application.Top;