mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Unit tests
This commit is contained in:
@@ -87,12 +87,14 @@ namespace Terminal.Gui {
|
||||
bool winChanged;
|
||||
|
||||
bool _runningUnitTests = false;
|
||||
|
||||
|
||||
public Action WinChanged;
|
||||
|
||||
void IMainLoopDriver.Wakeup ()
|
||||
{
|
||||
write (wakeupPipes [1], ignore, (IntPtr)1);
|
||||
if (!_runningUnitTests) {
|
||||
write (wakeupPipes [1], ignore, (IntPtr)1);
|
||||
}
|
||||
}
|
||||
|
||||
void IMainLoopDriver.Setup (MainLoop mainLoop)
|
||||
@@ -117,10 +119,12 @@ namespace Terminal.Gui {
|
||||
/// </remarks>
|
||||
public void RemoveWatch (object token)
|
||||
{
|
||||
var watch = token as Watch;
|
||||
if (watch == null)
|
||||
return;
|
||||
descriptorWatchers.Remove (watch.File);
|
||||
if (!_runningUnitTests) {
|
||||
var watch = token as Watch;
|
||||
if (watch == null)
|
||||
return;
|
||||
descriptorWatchers.Remove (watch.File);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -136,8 +140,9 @@ namespace Terminal.Gui {
|
||||
/// </remarks>
|
||||
public object AddWatch (int fileDescriptor, Condition condition, Func<MainLoop, bool> callback)
|
||||
{
|
||||
if (callback == null)
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException (nameof (callback));
|
||||
}
|
||||
|
||||
var watch = new Watch () { Condition = condition, Callback = callback, File = fileDescriptor };
|
||||
descriptorWatchers [fileDescriptor] = watch;
|
||||
@@ -147,8 +152,9 @@ namespace Terminal.Gui {
|
||||
|
||||
void UpdatePollMap ()
|
||||
{
|
||||
if (!poll_dirty)
|
||||
if (!poll_dirty) {
|
||||
return;
|
||||
}
|
||||
poll_dirty = false;
|
||||
|
||||
pollmap = new Pollfd [descriptorWatchers.Count];
|
||||
|
||||
@@ -90,11 +90,11 @@ namespace Terminal.Gui.DriverTests {
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData (typeof (FakeDriver), false)]
|
||||
[InlineData (typeof (FakeDriver), true)]
|
||||
[InlineData (typeof (NetDriver), false)]
|
||||
[InlineData (typeof (CursesDriver), false)]
|
||||
[InlineData (typeof (CursesDriver), true)]
|
||||
[InlineData (typeof (WindowsDriver), false)]
|
||||
public void Force16Colors_Sets (Type driverType, bool expectedSetting)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user