Added @bdisp's suggested tests

This commit is contained in:
Charlie Kindel
2022-11-03 16:47:45 -06:00
parent bf1ed31281
commit 857e123c65
4 changed files with 76 additions and 26 deletions

View File

@@ -70,7 +70,7 @@ namespace Terminal.Gui.Core {
Assert.Equal (80, Application.Driver.Cols);
Assert.Equal (25, Application.Driver.Rows);
// Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
// 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 ();
@@ -87,6 +87,20 @@ namespace Terminal.Gui.Core {
}
}
[Fact]
public void Init_Shutdown_Toplevel_Not_Disposed ()
{
Application.Init (new FakeDriver (), new FakeMainLoop (() => FakeConsole.ReadKey (true)));
Application.Shutdown ();
Assert.Single (Responder.Instances);
foreach (var inst in Responder.Instances) {
// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
Assert.False (inst.WasDisposed);
}
}
[Fact]
public void Init_Unbalanced_Throwss ()
{