From 71fb38db9bffd01dca93f1d1f5804d69a5ecd0b1 Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 10 Nov 2024 16:39:10 +0000 Subject: [PATCH] Add unit test for Screen. --- UnitTests/Application/ApplicationTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/UnitTests/Application/ApplicationTests.cs b/UnitTests/Application/ApplicationTests.cs index c0289893e..e30d4c55e 100644 --- a/UnitTests/Application/ApplicationTests.cs +++ b/UnitTests/Application/ApplicationTests.cs @@ -579,6 +579,25 @@ public class ApplicationTests } } + [Fact] + public void Screen_Size_Changes () + { + var driver = new FakeDriver (); + Application.Init (driver); + Assert.Equal (new (0, 0, 80, 25), driver.Screen); + Assert.Equal (new (0, 0, 80, 25), Application.Screen); + + driver.Cols = 100; + driver.Rows = 30; + // ConsoleDriver.Screen isn't assignable + //driver.Screen = new (0, 0, driver.Cols, Rows); + Assert.Equal (new (0, 0, 100, 30), driver.Screen); + Assert.NotEqual (new (0, 0, 100, 30), Application.Screen); + Assert.Equal (new (0, 0, 80, 25), Application.Screen); + Application.Screen = new (0, 0, driver.Cols, driver.Rows); + Assert.Equal (new (0, 0, 100, 30), driver.Screen); + } + private void Init () { Application.Init (new FakeDriver ());