소스 검색

Fixed more unit tests.

BDisp 5 년 전
부모
커밋
d6f9e0a832
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Terminal.Gui/Core/Application.cs
  2. 3 0
      UnitTests/ConsoleDriverTests.cs

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

@@ -166,7 +166,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		static void Init (Func<Toplevel> topLevelFactory, ConsoleDriver driver = null, IMainLoopDriver mainLoopDriver = null)
 		{
-			if (_initialized) return;
+			if (_initialized && driver == null) return;
 
 			// This supports Unit Tests and the passing of a mock driver/loopdriver
 			if (driver != null) {

+ 3 - 0
UnitTests/ConsoleDriverTests.cs

@@ -11,6 +11,7 @@ namespace Terminal.Gui {
 		public void Init_Inits ()
 		{
 			var driver = new FakeDriver ();
+			Application.Init (driver, new NetMainLoop (() => FakeConsole.ReadKey (true)));
 			driver.Init (() => { });
 
 			Assert.Equal (80, Console.BufferWidth);
@@ -26,6 +27,7 @@ namespace Terminal.Gui {
 		public void End_Cleans_Up ()
 		{
 			var driver = new FakeDriver ();
+			Application.Init (driver, new NetMainLoop (() => FakeConsole.ReadKey (true)));
 			driver.Init (() => { });
 
 			FakeConsole.ForegroundColor = ConsoleColor.Red;
@@ -48,6 +50,7 @@ namespace Terminal.Gui {
 		public void SetColors_Changes_Colors ()
 		{
 			var driver = new FakeDriver ();
+			Application.Init (driver, new NetMainLoop (() => FakeConsole.ReadKey (true)));
 			driver.Init (() => { });
 			Assert.Equal (ConsoleColor.Gray, Console.ForegroundColor);
 			Assert.Equal (ConsoleColor.Black, Console.BackgroundColor);