Browse Source

daignosing unit test fail in action

Tigger Kindel 2 years ago
parent
commit
5d77dd7176

+ 1 - 1
Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

@@ -625,7 +625,7 @@ internal class CursesDriver : ConsoleDriver {
 		} catch (Exception e) {
 			_window = null;
 			_runningUnitTests = true;
-			Debug.WriteLine ($"Curses failed to initialize. Assuming Unit Tests. The exception is: {e.Message}");
+			throw new InvalidProgramException ($"Curses failed to initialize. Assuming Unit Tests. The exception is: {e.Message}");
 		}
 
 		if (!_runningUnitTests) {

+ 6 - 4
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -611,20 +611,22 @@ internal class NetDriver : ConsoleDriver {
 		TerminalResized = terminalResized;
 
 		try {
+			// In unit tests, this will throw
+			Console.TreatControlCAsInput = true;
+
+			Cols = Console.WindowWidth;
+			Rows = Console.WindowHeight;
+
 			//Enable alternative screen buffer.
 			Console.Out.Write (EscSeqUtils.CSI_SaveCursorAndActivateAltBufferNoBackscroll);
 
 			//Set cursor key to application.
 			Console.Out.Write (EscSeqUtils.CSI_HideCursor);
 
-			Console.TreatControlCAsInput = true;
-			Cols = Console.WindowWidth;
-			Rows = Console.WindowHeight;
 		} catch (IOException) {
 			// We are being run in an environment that does not support a console
 			// such as a unit test, or a pipe.
 			_runningUnitTests = true;
-			throw new InvalidProgramException ();
 			Cols = 80;
 			Rows = 24;
 		}