fixed local test issue with curses

This commit is contained in:
Tigger Kindel
2023-08-12 10:27:01 -06:00
committed by Tig
parent fe23b564b3
commit ad23a100df
4 changed files with 10 additions and 11 deletions

View File

@@ -98,6 +98,10 @@ namespace Terminal.Gui {
void IMainLoopDriver.Setup (MainLoop mainLoop)
{
this.mainLoop = mainLoop;
if (ConsoleDriver.RunningUnitTests) {
return;
}
try {
pipe (wakeupPipes);
AddWatch (wakeupPipes [1], Condition.PollIn, ml => {

View File

@@ -1563,7 +1563,7 @@ internal class WindowsDriver : ConsoleDriver {
Right = (short)Cols
};
if (WinConsole != null && !WinConsole.WriteToConsole (new Size (Cols, Rows), _outputBuffer, bufferCoords, _damageRegion, Force16Colors)) {
if (!RunningUnitTests && WinConsole != null && !WinConsole.WriteToConsole (new Size (Cols, Rows), _outputBuffer, bufferCoords, _damageRegion, Force16Colors)) {
var err = Marshal.GetLastWin32Error ();
if (err != 0) {
throw new System.ComponentModel.Win32Exception (err);

View File

@@ -5,18 +5,12 @@ using Xunit;
using Console = Terminal.Gui.FakeConsole;
namespace Terminal.Gui.DriverTests {
public class ColorTests: IDisposable
{
public class ColorTests {
public ColorTests ()
{
ConsoleDriver.RunningUnitTests = true;
}
public void Dispose ()
{
// ... clean up test data from the database ...
}
[Theory]
[InlineData (typeof (FakeDriver))]
[InlineData (typeof (NetDriver))]
@@ -100,12 +94,12 @@ namespace Terminal.Gui.DriverTests {
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
[Theory]
[InlineData (typeof (FakeDriver))]
[InlineData (typeof (NetDriver))]
[InlineData (typeof (CursesDriver))]
[InlineData (typeof (WindowsDriver))]
[InlineData (typeof (WindowsDriver))]
public void Force16Colors_Sets (Type driverType)
{
var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
@@ -113,7 +107,7 @@ namespace Terminal.Gui.DriverTests {
driver.Force16Colors = true;
Assert.True (driver.Force16Colors);
driver.End ();
// Shutdown must be called to safely clean up Application if Init has been called

View File

@@ -14,6 +14,7 @@ namespace Terminal.Gui.DriverTests {
public ConsoleDriverTests (ITestOutputHelper output)
{
ConsoleDriver.RunningUnitTests = true;
this.output = output;
}