mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* 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>
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
namespace UnitTests;
|
|
|
|
/// <summary>
|
|
/// Enables tests to create a FakeDriver for testing purposes.
|
|
/// </summary>
|
|
[Collection ("Global Test Setup")]
|
|
public abstract class FakeDriverBase : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Creates a new FakeDriver instance with the specified buffer size.
|
|
/// This is a convenience method for tests that need to use Draw() and DriverAssert
|
|
/// without relying on Application.Driver.
|
|
/// </summary>
|
|
/// <param name="width">Width of the driver buffer</param>
|
|
/// <param name="height">Height of the driver buffer</param>
|
|
/// <returns>A configured IFakeDriver instance</returns>
|
|
protected static IDriver CreateFakeDriver (int width = 80, int height = 25)
|
|
{
|
|
var output = new FakeOutput ();
|
|
|
|
DriverImpl driver = new (
|
|
new FakeInputProcessor (null),
|
|
new OutputBufferImpl (),
|
|
output,
|
|
new AnsiRequestScheduler (new AnsiResponseParser ()),
|
|
new SizeMonitorImpl (output));
|
|
|
|
driver.SetScreenSize (width, height);
|
|
|
|
return driver;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void Dispose ()
|
|
{
|
|
Application.ResetState (true);
|
|
}
|
|
}
|