mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Fixes #3338. Application.Run/End -> Callers must dispose Toplevel
This commit is contained in:
@@ -1331,4 +1331,37 @@ public class DialogTests
|
||||
|
||||
return (Begin (dlg), dlg);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[AutoInitShutdown]
|
||||
public void Run_Dispose_Dialog ()
|
||||
{
|
||||
var top = Top;
|
||||
|
||||
Dialog dlg = new ();
|
||||
|
||||
dlg.Ready += Dlg_Ready;
|
||||
|
||||
Run (dlg);
|
||||
|
||||
#if DEBUG_IDISPOSABLE
|
||||
Assert.True (dlg.WasDisposed);
|
||||
Assert.True (Top.WasDisposed);
|
||||
Assert.Equal (top, Top);
|
||||
#endif
|
||||
|
||||
// This is instance and the user is responsible to set to null or not
|
||||
// because in the Application it's all working as expected.
|
||||
// Fortunately, this instance is not null so that we can obtain the value of its properties
|
||||
Assert.NotNull (dlg);
|
||||
|
||||
Shutdown();
|
||||
|
||||
return;
|
||||
|
||||
void Dlg_Ready (object sender, EventArgs e)
|
||||
{
|
||||
RequestStop ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user