Fixed more unit tests.

This commit is contained in:
BDisp
2020-07-17 03:53:22 +01:00
parent dce2a0304e
commit d6f9e0a832
2 changed files with 4 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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);