mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Fix TableView multi selections extending to -1 indexes (#1843)
* Fix TableView multi selections extending to -1 indexes * Add to test confirmation that the main active cell also didn't get pushed off * Tidy up formatting * Fixed not calling Application.Shutdown in tests and made it easier to diagnose which test is not shutting down
This commit is contained in:
@@ -52,12 +52,27 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
public class GraphViewTests {
|
||||
|
||||
static string LastInitFakeDriver;
|
||||
|
||||
public static FakeDriver InitFakeDriver ()
|
||||
{
|
||||
var driver = new FakeDriver ();
|
||||
Application.Init (driver, new FakeMainLoop (() => FakeConsole.ReadKey (true)));
|
||||
try {
|
||||
Application.Init (driver, new FakeMainLoop (() => FakeConsole.ReadKey (true)));
|
||||
} catch (InvalidOperationException) {
|
||||
|
||||
// close it so that we don't get a thousand of these errors in a row
|
||||
Application.Shutdown ();
|
||||
|
||||
// but still report a failure and name the test that didn't shut down. Note
|
||||
// that the test that didn't shutdown won't be the one currently running it will
|
||||
// be the last one
|
||||
throw new Exception ("A test did not call shutdown correctly. Test stack trace was:" + LastInitFakeDriver);
|
||||
}
|
||||
|
||||
driver.Init (() => { });
|
||||
|
||||
LastInitFakeDriver = Environment.StackTrace;
|
||||
return driver;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user