|
@@ -169,29 +169,16 @@ namespace Terminal.Gui.DriverTests {
|
|
|
Assert.Equal (40, Application.Driver.Rows);
|
|
|
Assert.True (wasTerminalResized);
|
|
|
|
|
|
- // MockDriver will still be 120x40
|
|
|
- wasTerminalResized = false;
|
|
|
- Application.EnableConsoleScrolling = true;
|
|
|
- driver.SetWindowSize (40, 20);
|
|
|
- Assert.Equal (120, Application.Driver.Cols);
|
|
|
- Assert.Equal (40, Application.Driver.Rows);
|
|
|
- Assert.Equal (120, Console.BufferWidth);
|
|
|
- Assert.Equal (40, Console.BufferHeight);
|
|
|
- Assert.Equal (40, Console.WindowWidth);
|
|
|
- Assert.Equal (20, Console.WindowHeight);
|
|
|
- Assert.True (wasTerminalResized);
|
|
|
-
|
|
|
Application.Shutdown ();
|
|
|
}
|
|
|
|
|
|
[Theory]
|
|
|
[InlineData (typeof (FakeDriver))]
|
|
|
- public void EnableConsoleScrolling_Is_False_Left_And_Top_Is_Always_Zero (Type driverType)
|
|
|
+ public void Left_And_Top_Is_Always_Zero (Type driverType)
|
|
|
{
|
|
|
var driver = (FakeDriver)Activator.CreateInstance (driverType);
|
|
|
Application.Init (driver);
|
|
|
|
|
|
- Assert.False (Application.EnableConsoleScrolling);
|
|
|
Assert.Equal (0, Console.WindowLeft);
|
|
|
Assert.Equal (0, Console.WindowTop);
|
|
|
|
|
@@ -201,124 +188,7 @@ namespace Terminal.Gui.DriverTests {
|
|
|
|
|
|
Application.Shutdown ();
|
|
|
}
|
|
|
-
|
|
|
- [Theory]
|
|
|
- [InlineData (typeof (FakeDriver))]
|
|
|
- public void EnableConsoleScrolling_Is_True_Left_Cannot_Be_Greater_Than_WindowWidth (Type driverType)
|
|
|
- {
|
|
|
- var driver = (FakeDriver)Activator.CreateInstance (driverType);
|
|
|
- Application.Init (driver);
|
|
|
-
|
|
|
- Application.EnableConsoleScrolling = true;
|
|
|
- Assert.True (Application.EnableConsoleScrolling);
|
|
|
-
|
|
|
- driver.SetWindowPosition (81, 25);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- Application.Shutdown ();
|
|
|
- }
|
|
|
-
|
|
|
- [Theory]
|
|
|
- [InlineData (typeof (FakeDriver))]
|
|
|
- public void EnableConsoleScrolling_Is_True_Left_Cannot_Be_Greater_Than_BufferWidth_Minus_WindowWidth (Type driverType)
|
|
|
- {
|
|
|
- var driver = (FakeDriver)Activator.CreateInstance (driverType);
|
|
|
- Application.Init (driver);
|
|
|
-
|
|
|
- Application.EnableConsoleScrolling = true;
|
|
|
- Assert.True (Application.EnableConsoleScrolling);
|
|
|
-
|
|
|
- driver.SetWindowPosition (81, 25);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- // MockDriver will now be sets to 120x25
|
|
|
- driver.SetBufferSize (120, 25);
|
|
|
- Assert.Equal (120, Application.Driver.Cols);
|
|
|
- Assert.Equal (25, Application.Driver.Rows);
|
|
|
- Assert.Equal (120, Console.BufferWidth);
|
|
|
- Assert.Equal (25, Console.BufferHeight);
|
|
|
- Assert.Equal (80, Console.WindowWidth);
|
|
|
- Assert.Equal (25, Console.WindowHeight);
|
|
|
- driver.SetWindowPosition (121, 25);
|
|
|
- Assert.Equal (40, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- driver.SetWindowSize (90, 25);
|
|
|
- Assert.Equal (120, Application.Driver.Cols);
|
|
|
- Assert.Equal (25, Application.Driver.Rows);
|
|
|
- Assert.Equal (120, Console.BufferWidth);
|
|
|
- Assert.Equal (25, Console.BufferHeight);
|
|
|
- Assert.Equal (90, Console.WindowWidth);
|
|
|
- Assert.Equal (25, Console.WindowHeight);
|
|
|
- driver.SetWindowPosition (121, 25);
|
|
|
- Assert.Equal (30, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- Application.Shutdown ();
|
|
|
- }
|
|
|
-
|
|
|
- [Theory]
|
|
|
- [InlineData (typeof (FakeDriver))]
|
|
|
- public void EnableConsoleScrolling_Is_True_Top_Cannot_Be_Greater_Than_WindowHeight (Type driverType)
|
|
|
- {
|
|
|
- var driver = (FakeDriver)Activator.CreateInstance (driverType);
|
|
|
- Application.Init (driver);
|
|
|
-
|
|
|
- Application.EnableConsoleScrolling = true;
|
|
|
- Assert.True (Application.EnableConsoleScrolling);
|
|
|
-
|
|
|
- driver.SetWindowPosition (80, 26);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- Application.Shutdown ();
|
|
|
- }
|
|
|
-
|
|
|
- [Theory]
|
|
|
- [InlineData (typeof (FakeDriver))]
|
|
|
- public void EnableConsoleScrolling_Is_True_Top_Cannot_Be_Greater_Than_BufferHeight_Minus_WindowHeight (Type driverType)
|
|
|
- {
|
|
|
- var driver = (FakeDriver)Activator.CreateInstance (driverType);
|
|
|
- Application.Init (driver);
|
|
|
-
|
|
|
- Application.EnableConsoleScrolling = true;
|
|
|
- Assert.True (Application.EnableConsoleScrolling);
|
|
|
-
|
|
|
- driver.SetWindowPosition (80, 26);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
-
|
|
|
- // MockDriver will now be sets to 80x40
|
|
|
- driver.SetBufferSize (80, 40);
|
|
|
- Assert.Equal (80, Application.Driver.Cols);
|
|
|
- Assert.Equal (40, Application.Driver.Rows);
|
|
|
- Assert.Equal (80, Console.BufferWidth);
|
|
|
- Assert.Equal (40, Console.BufferHeight);
|
|
|
- Assert.Equal (80, Console.WindowWidth);
|
|
|
- Assert.Equal (25, Console.WindowHeight);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (0, Console.WindowTop);
|
|
|
- driver.SetWindowPosition (80, 40);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (15, Console.WindowTop);
|
|
|
-
|
|
|
- driver.SetWindowSize (80, 20);
|
|
|
- Assert.Equal (80, Application.Driver.Cols);
|
|
|
- Assert.Equal (40, Application.Driver.Rows);
|
|
|
- Assert.Equal (80, Console.BufferWidth);
|
|
|
- Assert.Equal (40, Console.BufferHeight);
|
|
|
- Assert.Equal (80, Console.WindowWidth);
|
|
|
- Assert.Equal (20, Console.WindowHeight);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (15, Console.WindowTop);
|
|
|
- driver.SetWindowPosition (80, 41);
|
|
|
- Assert.Equal (0, Console.WindowLeft);
|
|
|
- Assert.Equal (20, Console.WindowTop);
|
|
|
-
|
|
|
- Application.Shutdown ();
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
[Fact, AutoInitShutdown]
|
|
|
public void AddRune_On_Clip_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space ()
|