From 62ec263b02094031c3cf2c62d07b270fc8bbef43 Mon Sep 17 00:00:00 2001 From: "Freddie Mercurial (Jessica M.)" Date: Fri, 4 Mar 2022 18:13:22 -0800 Subject: [PATCH] test for #1612 (#1623) --- UnitTests/ViewTests.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/UnitTests/ViewTests.cs b/UnitTests/ViewTests.cs index 36168707a..86836a58a 100644 --- a/UnitTests/ViewTests.cs +++ b/UnitTests/ViewTests.cs @@ -1828,5 +1828,28 @@ namespace Terminal.Gui.Views { Assert.True (sbQuiting); Assert.False (tfQuiting); } + + [Fact] + [AutoInitShutdown] + public void WindowDispose_CanFocusProblem () + { + // Arrange + Application.Init(); + using var top = Toplevel.Create(); + using var view = new View ( + x: 0, + y: 1, + text: nameof (WindowDispose_CanFocusProblem)); + using var window = new Window (); + top.Add(window); + window.Add (view); + + // Act + Application.Begin(top); + Application.Shutdown (); + + // Assert does Not throw NullReferenceException + top.SetFocus (); + } } }