Fixes #4429 - Timeouts lost (#4430)

This commit is contained in:
Tig
2025-12-02 21:31:01 -07:00
committed by GitHub
parent 0f72cf8a74
commit dc0d8f2f85
9 changed files with 1360 additions and 81 deletions

View File

@@ -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 ();