WIP merge v2_develop

This commit is contained in:
tznind
2024-11-27 09:35:09 +00:00
103 changed files with 8566 additions and 6684 deletions

View File

@@ -25,7 +25,7 @@ public class AddRuneTests
[InlineData (typeof (CursesDriver))]
public void AddRune (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
driver.Rows = 25;

View File

@@ -24,7 +24,7 @@ public class ClipRegionTests
[InlineData (typeof (CursesDriver))]
public void AddRune_Is_Clipped (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
Application.Init (driver);
Application.Driver!.Rows = 25;
Application.Driver!.Cols = 80;
@@ -62,7 +62,7 @@ public class ClipRegionTests
[InlineData (typeof (CursesDriver))]
public void Clip_Set_To_Empty_AllInvalid (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
Application.Init (driver);
// Define a clip rectangle
@@ -92,7 +92,7 @@ public class ClipRegionTests
[InlineData (typeof (CursesDriver))]
public void IsValidLocation (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
Application.Init (driver);
Application.Driver!.Rows = 10;
Application.Driver!.Cols = 10;

View File

@@ -25,7 +25,7 @@ public class ConsoleDriverTests
[InlineData (typeof (CursesDriver))]
public void End_Cleans_Up (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
driver.End ();
}
@@ -34,7 +34,7 @@ public class ConsoleDriverTests
[InlineData (typeof (FakeDriver))]
public void FakeDriver_MockKeyPresses (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
Application.Init (driver);
var text = "MockKeyPresses";
@@ -85,7 +85,7 @@ public class ConsoleDriverTests
[InlineData (typeof (FakeDriver))]
public void FakeDriver_Only_Sends_Keystrokes_Through_MockKeyPresses (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
Application.Init (driver);
Toplevel top = new ();
@@ -124,7 +124,7 @@ public class ConsoleDriverTests
[InlineData (typeof (CursesDriver))]
public void Init_Inits (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
MainLoop ml = driver.Init ();
Assert.NotNull (ml);
Assert.NotNull (driver.Clipboard);
@@ -140,7 +140,7 @@ public class ConsoleDriverTests
//[InlineData (typeof (FakeDriver))]
//public void FakeDriver_MockKeyPresses_Press_AfterTimeOut (Type driverType)
//{
// var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
// var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
// Application.Init (driver);
// // Simulating pressing of QuitKey after a short period of time
@@ -201,7 +201,7 @@ public class ConsoleDriverTests
[InlineData (typeof (CursesDriver))]
public void TerminalResized_Simulation (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver?.Init ();
driver.Cols = 80;
driver.Rows = 25;

View File

@@ -24,7 +24,7 @@ public class ContentsTests
//[InlineData (typeof (WindowsDriver))] // TODO: Uncomment when #2610 is fixed
public void AddStr_Combining_Character_1st_Column (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
var expected = "\u0301!";
driver.AddStr ("\u0301!"); // acute accent + exclamation mark
@@ -42,7 +42,7 @@ public class ContentsTests
//[InlineData (typeof (WindowsDriver))] // TODO: Uncomment when #2610 is fixed
public void AddStr_With_Combining_Characters (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
var acuteaccent = new Rune (0x0301); // Combining acute accent (é)
@@ -98,7 +98,7 @@ public class ContentsTests
[InlineData (typeof (CursesDriver))]
public void Move_Bad_Coordinates (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
Assert.Equal (0, driver.Col);

View File

@@ -17,7 +17,7 @@ public class DriverColorTests
[InlineData (typeof (CursesDriver))]
public void Force16Colors_Sets (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
driver.Force16Colors = true;
@@ -35,7 +35,7 @@ public class DriverColorTests
[InlineData (typeof (CursesDriver))]
public void SetColors_Changes_Colors (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
Assert.Equal (ConsoleColor.Gray, Console.ForegroundColor);
@@ -63,7 +63,7 @@ public class DriverColorTests
[InlineData (typeof (CursesDriver), true)]
public void SupportsTrueColor_Defaults (Type driverType, bool expectedSetting)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
driver.Init ();
Assert.Equal (expectedSetting, driver.SupportsTrueColor);

View File

@@ -17,7 +17,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_AddIdle_ValidIdleHandler_ReturnsToken (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
var idleHandlerInvoked = false;
@@ -47,7 +47,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_AddTimeout_ValidParameters_ReturnsToken (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
var callbackInvoked = false;
@@ -83,7 +83,7 @@ public class MainLoopDriverTests
Type mainLoopDriverType
)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -107,7 +107,7 @@ public class MainLoopDriverTests
Type mainLoopDriverType
)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -130,7 +130,7 @@ public class MainLoopDriverTests
Type mainLoopDriverType
)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -151,7 +151,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_Constructs_Disposes (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -182,7 +182,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_RemoveIdle_InvalidToken_ReturnsFalse (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -201,7 +201,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_RemoveIdle_ValidToken_ReturnsTrue (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -223,7 +223,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_RemoveTimeout_InvalidToken_ReturnsFalse (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -241,7 +241,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_RemoveTimeout_ValidToken_ReturnsTrue (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
@@ -261,7 +261,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (ANSIDriver), typeof (AnsiMainLoopDriver))]
public void MainLoop_RunIteration_ValidIdleHandler_CallsIdleHandler (Type driverType, Type mainLoopDriverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, driver);
var mainLoop = new MainLoop (mainLoopDriver);
var idleHandlerInvoked = false;
@@ -287,7 +287,7 @@ public class MainLoopDriverTests
//[InlineData (typeof (WindowsDriver), typeof (WindowsMainLoop))]
//public void MainLoop_Invoke_ValidAction_RunsAction (Type driverType, Type mainLoopDriverType)
//{
// var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
// var driver = (IConsoleDriver)Activator.CreateInstance (driverType);
// var mainLoopDriver = (IMainLoopDriver)Activator.CreateInstance (mainLoopDriverType, new object [] { driver });
// var mainLoop = new MainLoop (mainLoopDriver);
// var actionInvoked = false;