|
@@ -74,16 +74,17 @@ 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.
|
|
// See #2474 for why this is commented out
|
|
// See #2474 for why this is commented out
|
|
- //Assert.Equal (Application.QuitKey, args.KeyEvent.Key);
|
|
|
|
- args.Handled = false;
|
|
|
|
|
|
+ Assert.Equal (Application.QuitKey, args.KeyEvent.Key);
|
|
};
|
|
};
|
|
|
|
|
|
uint abortTime = 500;
|
|
uint abortTime = 500;
|
|
// If the scenario doesn't close within 500ms, this will force it to quit
|
|
// If the scenario doesn't close within 500ms, this will force it to quit
|
|
Func<MainLoop, bool> forceCloseCallback = (MainLoop loop) => {
|
|
Func<MainLoop, bool> forceCloseCallback = (MainLoop loop) => {
|
|
- Application.RequestStop ();
|
|
|
|
- // See #2474 for why this is commented out
|
|
|
|
- //Assert.Fail ($"'{scenario.GetName ()}' failed to Quit with {Application.QuitKey} after {abortTime}ms. Force quit.");
|
|
|
|
|
|
+ if (Application.Top.Running && FakeConsole.MockKeyPresses.Count == 0) {
|
|
|
|
+ Application.RequestStop ();
|
|
|
|
+ // See #2474 for why this is commented out
|
|
|
|
+ Assert.Fail ($"'{scenario.GetName ()}' failed to Quit with {Application.QuitKey} after {abortTime}ms. Force quit.");
|
|
|
|
+ }
|
|
return false;
|
|
return false;
|
|
};
|
|
};
|
|
//output.WriteLine ($" Add timeout to force quit after {abortTime}ms");
|
|
//output.WriteLine ($" Add timeout to force quit after {abortTime}ms");
|
|
@@ -91,9 +92,9 @@ namespace UICatalog.Tests {
|
|
|
|
|
|
Application.Iteration += () => {
|
|
Application.Iteration += () => {
|
|
//output.WriteLine ($" iteration {++iterations}");
|
|
//output.WriteLine ($" iteration {++iterations}");
|
|
- if (FakeConsole.MockKeyPresses.Count == 0) {
|
|
|
|
|
|
+ if (Application.Top.Running && FakeConsole.MockKeyPresses.Count == 0) {
|
|
Application.RequestStop ();
|
|
Application.RequestStop ();
|
|
- //Assert.Fail ($"'{scenario.GetName ()}' failed to Quit with {Application.QuitKey}. Force quit.");
|
|
|
|
|
|
+ Assert.Fail ($"'{scenario.GetName ()}' failed to Quit with {Application.QuitKey}. Force quit.");
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|