mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
fixed WindowsDriver to work in linux unit tests
This commit is contained in:
@@ -369,6 +369,7 @@ public abstract class ConsoleDriver {
|
||||
get => _force16Colors || !SupportsTrueColor;
|
||||
set {
|
||||
_force16Colors = (value || !SupportsTrueColor);
|
||||
Refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,8 +247,10 @@ internal class CursesDriver : ConsoleDriver {
|
||||
}
|
||||
}
|
||||
|
||||
Curses.move (Row, Col);
|
||||
_window.wrefresh ();
|
||||
if (_window != null) {
|
||||
Curses.move (Row, Col);
|
||||
_window.wrefresh ();
|
||||
}
|
||||
}
|
||||
|
||||
public Curses.Window _window;
|
||||
|
||||
@@ -671,6 +671,9 @@ internal class NetDriver : ConsoleDriver {
|
||||
|
||||
public override void UpdateScreen ()
|
||||
{
|
||||
if (NetWinConsole == null) {
|
||||
return;
|
||||
}
|
||||
if (_winSizeChanging || Console.WindowHeight < 1 || Contents.Length != Rows * Cols || Rows != Console.WindowHeight) {
|
||||
return;
|
||||
}
|
||||
@@ -862,6 +865,9 @@ internal class NetDriver : ConsoleDriver {
|
||||
public override bool SetCursorVisibility (CursorVisibility visibility)
|
||||
{
|
||||
_cachedCursorVisibility = visibility;
|
||||
if (NetWinConsole == null) {
|
||||
return visibility == CursorVisibility.Default;
|
||||
}
|
||||
var isVisible = Console.CursorVisible = visibility == CursorVisibility.Default;
|
||||
//Console.Out.Write (isVisible ? EscSeqUtils.CSI_ShowCursor : EscSeqUtils.CSI_HideCursor);
|
||||
return isVisible;
|
||||
@@ -885,8 +891,10 @@ internal class NetDriver : ConsoleDriver {
|
||||
|
||||
void SetWindowPosition (int col, int row)
|
||||
{
|
||||
Top = Console.WindowTop;
|
||||
Left = Console.WindowLeft;
|
||||
if (NetWinConsole != null) {
|
||||
Top = Console.WindowTop;
|
||||
Left = Console.WindowLeft;
|
||||
}
|
||||
}
|
||||
|
||||
private bool EnsureBufferSize ()
|
||||
|
||||
@@ -92,21 +92,18 @@ namespace Terminal.Gui.DriverTests {
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (typeof (FakeDriver), true)]
|
||||
[InlineData (typeof (NetDriver), false)]
|
||||
[InlineData (typeof (CursesDriver), true)]
|
||||
[InlineData (typeof (WindowsDriver), false)]
|
||||
public void Force16Colors_Sets (Type driverType, bool expectedSetting)
|
||||
[InlineData (typeof (FakeDriver))]
|
||||
[InlineData (typeof (NetDriver))]
|
||||
[InlineData (typeof (CursesDriver))]
|
||||
[InlineData (typeof (WindowsDriver))]
|
||||
public void Force16Colors_Sets (Type driverType)
|
||||
{
|
||||
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
|
||||
driver.Init (() => { });
|
||||
|
||||
Assert.Equal (expectedSetting, driver.Force16Colors);
|
||||
|
||||
driver.Force16Colors = true;
|
||||
|
||||
Assert.True (driver.Force16Colors);
|
||||
|
||||
|
||||
driver.End ();
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
|
||||
Reference in New Issue
Block a user