Fixes #4391. Weird situation where ForceDriver with args doesn't persists on open scenario (#4395)

* Fixes #4391. Weird situation where ForceDriver with args doesn't persists on open scenario

* Prevents change ForceDriver if app it's already initialized and allowing also initialize with driver instead of only by driver name.

* Add dispose into FakeDriverBase and reset ForceDriver

* Moving test to Application folder

* Fix unit test

* Remove unnecessary GlobalTestSetup

* Add GC.SuppressFinalize

* Revert "Add GC.SuppressFinalize"

This reverts commit 2bd7cd7791.

* Reset MouseGrabView

* Avoid CI warnings

* Add GlobalTestSetup in all test that use Application

* Trying to fix unit test

* Reverting scope changes

* Remove UICatalog testing Run

* Force re-run CI test

* Fix merge errors

* Fix ansi for the red background color code

* Fix more ANSI color code unit tests

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
BDisp
2025-11-20 02:05:05 +00:00
committed by GitHub
parent a6258ed398
commit 1bd5e3761a
18 changed files with 176 additions and 57 deletions

View File

@@ -55,7 +55,9 @@ namespace UICatalog;
/// </remarks>
public class UICatalog
{
private static string? _forceDriver = null;
private static string? _forceDriver;
private static string? _uiCatalogDriver;
private static string? _scenarioDriver;
public static string LogFilePath { get; set; } = string.Empty;
public static LoggingLevelSwitch LogLevelSwitch { get; } = new ();
@@ -194,6 +196,8 @@ public class UICatalog
UICatalogMain (Options);
Debug.Assert (Application.ForceDriver == string.Empty);
return 0;
}
@@ -255,7 +259,9 @@ public class UICatalog
Application.Init (driverName: _forceDriver);
var top = Application.Run<UICatalogTop> ();
_uiCatalogDriver = Application.Driver!.GetName ();
Toplevel top = Application.Run<UICatalogTop> ();
top.Dispose ();
Application.Shutdown ();
VerifyObjectsWereDisposed ();
@@ -421,6 +427,8 @@ public class UICatalog
Application.InitializedChanged += ApplicationOnInitializedChanged;
#endif
Application.ForceDriver = _forceDriver;
scenario.Main ();
scenario.Dispose ();
@@ -439,6 +447,8 @@ public class UICatalog
if (e.Value)
{
sw.Start ();
_scenarioDriver = Application.Driver!.GetName ();
Debug.Assert (_scenarioDriver == _uiCatalogDriver);
}
else
{