mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
@@ -11,42 +11,6 @@ public class ApplicationTests (ITestOutputHelper output)
|
||||
{
|
||||
private readonly ITestOutputHelper _output = output;
|
||||
|
||||
[Fact]
|
||||
public void AddTimeout_Fires ()
|
||||
{
|
||||
IApplication app = Application.Create ();
|
||||
app.Init ("fake");
|
||||
|
||||
uint timeoutTime = 100;
|
||||
var timeoutFired = false;
|
||||
|
||||
// Setup a timeout that will fire
|
||||
app.AddTimeout (
|
||||
TimeSpan.FromMilliseconds (timeoutTime),
|
||||
() =>
|
||||
{
|
||||
timeoutFired = true;
|
||||
|
||||
// Return false so the timer does not repeat
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
// The timeout has not fired yet
|
||||
Assert.False (timeoutFired);
|
||||
|
||||
// Block the thread to prove the timeout does not fire on a background thread
|
||||
Thread.Sleep ((int)timeoutTime * 2);
|
||||
Assert.False (timeoutFired);
|
||||
|
||||
app.StopAfterFirstIteration = true;
|
||||
app.Run<Runnable> ();
|
||||
|
||||
// The timeout should have fired
|
||||
Assert.True (timeoutFired);
|
||||
|
||||
app.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Begin_Null_Runnable_Throws ()
|
||||
@@ -281,10 +245,6 @@ public class ApplicationTests (ITestOutputHelper output)
|
||||
|
||||
void Application_Iteration (object? sender, EventArgs<IApplication?> e)
|
||||
{
|
||||
if (iteration > 0)
|
||||
{
|
||||
Assert.Fail ();
|
||||
}
|
||||
|
||||
iteration++;
|
||||
app.RequestStop ();
|
||||
|
||||
Reference in New Issue
Block a user