Add internal static InitState method to subscribe events.

This commit is contained in:
BDisp
2024-12-04 14:08:22 +00:00
parent ce17fddd9c
commit 99866c80b5
4 changed files with 41 additions and 4 deletions

View File

@@ -65,4 +65,24 @@ public class ApplicationScreenTests (ITestOutputHelper output)
Application.Top = null;
Application.Shutdown ();
}
[Fact]
public void Screen_Changes_OnSizeChanged_Without_Call_Application_Init ()
{
// Arrange
Application.ResetState (true);
Assert.Null (Application.Driver);
Application.Driver = new FakeDriver { Rows = 25, Cols = 25 };
Application.InitState ();
Assert.Equal (new (0, 0, 25, 25), Application.Screen);
// Act
(((FakeDriver)Application.Driver)!).SetBufferSize (120, 30);
// Assert
Assert.Equal (new (0, 0, 120, 30), Application.Screen);
// Cleanup
Application.ResetState (true);
}
}

View File

@@ -641,6 +641,12 @@ public class ApplicationTests
Application.Shutdown ();
}
[Fact]
public void InitState_Throws_If_Driver_Is_Null ()
{
Assert.Throws<ArgumentNullException> (static () => Application.InitState ());
}
private void Init ()
{
Application.Init (new FakeDriver ());