|
@@ -105,17 +105,11 @@ namespace UICatalog.Tests {
|
|
|
|
|
|
Application.Shutdown ();
|
|
Application.Shutdown ();
|
|
#if DEBUG_IDISPOSABLE
|
|
#if DEBUG_IDISPOSABLE
|
|
- foreach (var inst in Responder.Instances) {
|
|
|
|
- Assert.True (inst.WasDisposed);
|
|
|
|
- }
|
|
|
|
- Responder.Instances.Clear ();
|
|
|
|
|
|
+ Assert.Empty (Responder.Instances);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
#if DEBUG_IDISPOSABLE
|
|
#if DEBUG_IDISPOSABLE
|
|
- foreach (var inst in Responder.Instances) {
|
|
|
|
- Assert.True (inst.WasDisposed);
|
|
|
|
- }
|
|
|
|
- Responder.Instances.Clear ();
|
|
|
|
|
|
+ Assert.Empty (Responder.Instances);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
@@ -132,11 +126,24 @@ namespace UICatalog.Tests {
|
|
// BUGBUG: (#2474) For some reason ReadKey is not returning the QuitKey for some Scenarios
|
|
// BUGBUG: (#2474) For some reason ReadKey is not returning the QuitKey for some Scenarios
|
|
// by adding this Space it seems to work.
|
|
// by adding this Space it seems to work.
|
|
|
|
|
|
- FakeConsole.PushMockKeyPress (Key.Space);
|
|
|
|
FakeConsole.PushMockKeyPress (Application.QuitKey);
|
|
FakeConsole.PushMockKeyPress (Application.QuitKey);
|
|
|
|
|
|
|
|
+ var ms = 100;
|
|
|
|
+ var abortCount = 0;
|
|
|
|
+ Func<MainLoop, bool> abortCallback = (MainLoop loop) => {
|
|
|
|
+ abortCount++;
|
|
|
|
+ output.WriteLine ($"'Generic' abortCount {abortCount}");
|
|
|
|
+ Application.RequestStop ();
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
|
|
+
|
|
int iterations = 0;
|
|
int iterations = 0;
|
|
|
|
+ object token = null;
|
|
Application.Iteration = () => {
|
|
Application.Iteration = () => {
|
|
|
|
+ if (token == null) {
|
|
|
|
+ // Timeout only must start at first iteration
|
|
|
|
+ token = Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (ms), abortCallback);
|
|
|
|
+ }
|
|
iterations++;
|
|
iterations++;
|
|
output.WriteLine ($"'Generic' iteration {iterations}");
|
|
output.WriteLine ($"'Generic' iteration {iterations}");
|
|
// Stop if we run out of control...
|
|
// Stop if we run out of control...
|
|
@@ -146,16 +153,6 @@ namespace UICatalog.Tests {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- var ms = 100;
|
|
|
|
- var abortCount = 0;
|
|
|
|
- Func<MainLoop, bool> abortCallback = (MainLoop loop) => {
|
|
|
|
- abortCount++;
|
|
|
|
- output.WriteLine ($"'Generic' abortCount {abortCount}");
|
|
|
|
- Application.RequestStop ();
|
|
|
|
- return false;
|
|
|
|
- };
|
|
|
|
- var token = Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (ms), abortCallback);
|
|
|
|
-
|
|
|
|
Application.Top.KeyPress += (object sender, KeyEventEventArgs args) => {
|
|
Application.Top.KeyPress += (object sender, KeyEventEventArgs args) => {
|
|
// See #2474 for why this is commented out
|
|
// See #2474 for why this is commented out
|
|
Assert.Equal (Key.CtrlMask | Key.Q, args.KeyEvent.Key);
|
|
Assert.Equal (Key.CtrlMask | Key.Q, args.KeyEvent.Key);
|
|
@@ -175,10 +172,7 @@ namespace UICatalog.Tests {
|
|
Application.Shutdown ();
|
|
Application.Shutdown ();
|
|
|
|
|
|
#if DEBUG_IDISPOSABLE
|
|
#if DEBUG_IDISPOSABLE
|
|
- foreach (var inst in Responder.Instances) {
|
|
|
|
- Assert.True (inst.WasDisposed);
|
|
|
|
- }
|
|
|
|
- Responder.Instances.Clear ();
|
|
|
|
|
|
+ Assert.Empty (Responder.Instances);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|