mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixes #4004 & #4445 - Merge of Application.ForceDriver and Driver.Force16Colors and windows" broken in conhost and cmd (#4448)
* Fixes #4004. Driver "windows" broken in conhost and cmd
* Fix unit tests
* Remove IsVirtualTerminal from IApplication. Add IDriverInternal and IOutputInternal interfaces
* Fix result.IsSupported
* Remove internal interfaces and add them in the implementations classes
* Move Sixel from IApplication to IDriver interface it's a characteristic of the driver
* Only if IOutput is OutputBase then set the internal properties
* Prevents driver windows error on Unix system
* Fix scenario sixel error
* Comment some tests because is keyboard layout dependent and shifted key is needed to produce them (Pt)
* Add 🇵🇹 regional indicators test proving they ca be joined as only one grapheme
* SetConsoleActiveScreenBuffer is already called by the constructor and is only needed once
* Finally fixed non virtual terminal in windows driver
* Add more Sixel unit tests
* Add unit tests for OutputBase class
* Avoid emit escape sequence
* Fix assertion failure in UICatalog
* Let each driver to deal with the Sixel write
* When Shutdown is called by the static Application then the ApplicationImpl.ResetStateStatic should be also called
* Add more OutputBase with Sixel unit tests
* Fix some issues with IsVirtualTerminal and Force16Colors with unit tests improvement
* Add Sixel Detect method unit test
* Make Sixel IsSupported and SupportsTransparency consistent with more unit tests
* Fix namespaces and unit test
* Covering more ApplicationImpl Sixel unit test
* Remove DriverImplProxy because sometimes fails in parallel unit tests
* Fix Init_KeyBindings_Are_Not_Reset unit test failing
* Revert "Fix Init_KeyBindings_Are_Not_Reset unit test failing"
This reverts commit 0ab298bc56.
* Fix Force16Colors but still use Application.Force16Colors because of CM
* Enforce conditional
* Revert change
* Moving to a new file
* Add the same workaround as the All_Scenarios_Benchmark unit test
* Fixes #4440. TextView with ReadOnly as true, MoveRight doesn't select text up to the end of the line
* Fixes #4442. TextField PositionCursor doesn't treat zero width as one column
* Each character must return at least one column, with the exception of Tab.
* Add unit test for the ScrollOffset
* Each character must return at least one column, with the exception of Tab.
* Add unit test for the LeftColumn
* WIP
* Refactor DriverImpl and OutputBase for maintainability
Refactored `DriverImpl` to remove `IDisposable` and streamline event
handling, including replacing `OnSizeMonitorOnSizeChanged` with an
inline lambda. Reintroduced `SizeChanged` and updated `SetScreenSize`
to invoke it. Moved `SupportsTrueColor` from `OutputBase` to
`DriverImpl` and reintroduced `Force16Colors` with updated logic.
Reintroduced and updated several `OutputBuffer`-related properties
and methods in `DriverImpl`, including `Screen`, `Clip`, `Cols`, and
`Contents`. Moved `Clipboard` from `OutputBase` to `DriverImpl` and
initialized it with `FakeClipboard`. Simplified `Refresh` and `ToAnsi`
methods in `DriverImpl`.
Removed `Force16Colors` from `OutputBase` and simplified method
signatures, including `ToAnsi` and `BuildAnsiForRegion`. Fixed a
parameter name typo in `AppendOrWriteAttribute`. Made minor code
formatting adjustments.
These changes improve code maintainability, reduce redundancy, and
align the implementation with updated design requirements.
* Refactor Force16Colors handling and improve UICatalog
Refactored the `Force16Colors` property:
- Moved it from `DriverImpl` to `IOutput` and `OutputBase`.
- Simplified its management by removing redundant logic.
- Added `OnDriverOnForce16ColorsChanged` to handle updates.
Updated `UICatalogRunnable`:
- Replaced `Driver.Force16Colors` with `Application.Driver.Force16Colors`.
- Added an `F7` shortcut to toggle `Force16Colors`.
- Removed redundant event handlers and improved formatting.
Updated `config.json`:
- Replaced `Application.Force16Colors` with `Driver.Force16Colors`.
- Improved theme configuration formatting for readability.
Other changes:
- Removed the `force16Colors` parameter from `IOutput.ToAnsi`.
- Improved diagnostics handling in `UICatalogRunnable`.
- General code cleanup for readability and maintainability.
* Refactor `Force16Colors` access and improve null safety
Refactored `Force16Colors` property access to use `Application.Driver!`
for null safety and consistency. Updated event handlers to align with
this pattern. Replaced nullable `DrawContext?` parameters with
non-nullable `DrawContext` in `OnDrawingContent` overrides across
multiple classes to enforce stricter nullability checks.
Removed unused `_cachedCursorVisibility` field in `OutputBase.cs` and
cleaned up commented-out legacy code in `UICatalogRunnable.cs`. Updated
XML documentation to reflect method signature changes and property
references. Refactored `Shortcut` example in documentation for
consistency.
Replaced `Application.LayoutAndDraw` with `SetNeedsDraw` for marking
views as needing redraw. Performed general code cleanup to remove
redundant code and improve consistency.
* Refactor ForceDriver and Force16Colors properties
Removed `[Obsolete]` from `Application.ForceDriver`, making it a stable API. Added comments to clarify its role as a configuration property and its synchronization with `IApplication.ForceDriver`. Introduced `_forceDriver` as a private backing field.
Removed `Force16Colors` from `ApplicationImpl` and eliminated reset logic for `ForceDriver` and `Force16Colors` during shutdown, shifting state management responsibility to the library user.
Updated comments in `Driver.cs` to document `Force16Colors` as a configuration property and its synchronization with `IDriver.Force16Colors`. Retained `_force16Colors` as a private backing field for configuration overrides.
* Updated docs
* There is no way to detect Sixel transparency and so relying in VTS or Xterm with transparency
* Fix detect Sixel unit tests with the adjusting code
* Refactored Output.
* MErging
* - Added `OnDriverOnForce16ColorsChanged` method to handle `Driver.Force16ColorsChanged` events and update the `Force16Colors` property.
- Implemented `IDisposable` to ensure proper cleanup of resources, including unsubscribing from `SizeMonitor.SizeChanged` and `Driver.Force16ColorsChanged` events, and disposing of `_output`.
- Replaced inline `SizeMonitor.SizeChanged` event handler with a dedicated method, `OnSizeMonitorOnSizeChanged`, for better readability and maintainability.
- Simplified the `Screen` property by removing commented-out code and directly returning a `Rectangle` based on `OutputBuffer` dimensions.
- Updated the `Force16Colors` property to use `_output` for both getting and setting its value.
- Performed general cleanup, including removing unused code and improving code structure.
* merged
* Refactor Sixel handling with ConcurrentQueue
Replaced `List<SixelToRender>` with `ConcurrentQueue<SixelToRender>`
to improve thread safety and performance in sixel management.
Updated the `Images` class to avoid unnecessary removal and
re-creation of sixel objects by updating existing ones in place.
Refactored `Application.Sixel` to return a `ConcurrentQueue` and
introduced `GetSixels` in `IDriver` and `IOutput` for consistent
access. Updated `OutputBase` to use a private `ConcurrentQueue`
and adjusted rendering logic accordingly.
Removed legacy and redundant code, including `Application.Driver?.Sixel.Clear()`
and unused properties in `DriverImpl` and `ApplicationImpl`. Updated
tests in `OutputBaseTests` to align with the new implementation.
Added `using System.Collections.Concurrent` where necessary and
improved documentation to reflect the changes. These updates
enhance thread safety, simplify the codebase, and align with
modern concurrent programming practices.
* Tweak
* Refactor DriverImpl to use Dispose and improve modularity
Replaced `Driver.End()` with `Driver.Dispose()` across the codebase, aligning with the `IDisposable` pattern for proper resource cleanup. Updated `DriverImpl` to implement `Dispose`, ensuring event unsubscriptions and resource disposal.
Enhanced `DriverImpl` structure by organizing code into logical regions, improving modularity and readability. Refactored and reintroduced methods and properties like `Clipboard`, `Screen`, `SetScreenSize`, `Cols`, `Rows`, and others for better encapsulation.
Updated the `IDriver` interface to include `IDisposable` and reorganized it into regions. Added new methods and properties such as `Init`, `Refresh`, `Suspend`, `QueueAnsiRequest`, and `ToAnsi`.
Refactored unit tests to replace `driver.End()` with `driver.Dispose()` and ensured proper resource cleanup. Improved code comments and documentation for better clarity.
Aligned with modern C# practices, adopting features like null-coalescing operators and pattern matching. Removed redundant code, addressed some TODOs, and modularized the codebase for maintainability and extensibility.
* Refactor driver docs and update View.Driver usage
Updated `application.md` to clarify the purpose of the `View.Driver` property, replacing the obsolete `Application.Driver`. Added a reference to the "Drivers Deep Dive" documentation for further details.
Refactored the `OnDrawContent` method to use the `Driver` property, ensuring compatibility with the new driver architecture.
Added a new section, "Testing with the New Architecture," to `application.md`, highlighting the improved testability of the instance-based architecture.
Expanded and reorganized `drivers.md` to provide a detailed breakdown of the `IDriver` interface, including lifecycle, components, screen and display, color support, content buffer, drawing, cursor, input events, and ANSI escape sequences. Introduced new subsections for clarity and emphasized the modular design for maintainability.
Added a note in `drivers.md` discouraging direct access to the `Driver` and recommending higher-level abstractions like `Terminal.Gui.App.Application.Screen` and `Terminal.Gui.ViewBase.View` methods for positioning and drawing.
* Refactor IsVirtualTerminal to IsLegacyConsole
Replaced the `IsVirtualTerminal` property with `IsLegacyConsole` across the codebase to better represent legacy versus modern terminal environments. Updated logic in `SixelSupportDetector`, `DriverImpl`, and `OutputBase` to use the new property.
Refactored tests to align with the updated property, including renaming test methods, adjusting mock setups, and replacing `VirtualTerminalTests` with `LegacyConsoleTests`.
Simplified `WindowsOutput` implementation to handle console modes and sixel rendering based on `IsLegacyConsole`. Removed redundant code related to `IsVirtualTerminal`.
Improved code readability and maintainability by using more descriptive property names and ensuring consistency across the codebase. Updated `.DotSettings` with new entries.
* Update Examples/UICatalog/Scenarios/LineDrawing.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/Images.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/Images.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/App/IApplication.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/App/ApplicationImpl.Lifecycle.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/ColorPicker.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/ColorPicker.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix formatting and typo in code and documentation
Improved code readability in `LineDrawing.cs` by fixing spacing
around the ternary operator in `Width` and `Y` property assignments.
Corrected a typo in `drivers.md` by changing "Configuraiton Manager"
to "Configuration Manager" for accurate documentation.
* Test failure casued by assert left in by accident.
* Added a workaround in `OutputBase.cs` to address dirty cell handling in legacy console mode by marking all buffer cells as dirty.
Refactored `_disableMouseCb` event handling in `UICatalogRunnable.cs` to use the `Selecting` event for toggling `Application.IsMouseDisabled`. Simplified `MouseImpl.cs` by converting `App` to an auto-implemented property and removing redundant namespace usage.
Streamlined logging in `WindowsOutput.cs` by replacing verbose `Logging.Logger` calls with shorter alternatives (`Logging.Information`, `Logging.Error`, etc.).
* Update theme and remove unused ListView component
The application's default theme configuration was updated from "Light" to "Amber Phosphor" by modifying the `ConfigurationManager.RuntimeConfig` value.
Additionally, the `ListView` component in the `ExampleWindow` class was removed. This included its initialization, layout properties (`Y`, `Height`, `Width`), and its data source (["One", "Two", "Three", "Four"]).
* Increase safety timeout in NestedRunTimeoutTests to 10s
The timeout duration for the safety mechanism in the
`NestedRunTimeoutTests` class was increased from 5000ms (5s)
to 10000ms (10s). This change allows the app more time to
complete before triggering the safety timeout, reducing the
likelihood of premature termination during long-running tests.
Refactor and enhance test coverage
Refactored `Load_WithInvalidJson_AddsJsonError` test in `SourcesManagerTests.cs` to improve organization and added a note about its impact on parallel execution. Increased the safety timeout in `NestedRunTimeoutTests.cs` from 5 seconds to 10 seconds to address potential premature test timeouts.
* Handle null Driver gracefully in event subscription
Replaced `ArgumentNullException.ThrowIfNull(Driver)` with a null-check conditional in `SubscribeDriverEvents` and `UnsubscribeDriverEvents`. If `Driver` is `null`, the methods now log an error using `Logging.Error` and return early. This prevents potential exceptions and improves error handling.
---------
Co-authored-by: BDisp <bd.bdisp@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ public class SyncrhonizationContextTests
|
||||
[InlineData ("fake")]
|
||||
[InlineData ("windows")]
|
||||
[InlineData ("dotnet")]
|
||||
// [InlineData ("unix")]
|
||||
[InlineData ("unix")]
|
||||
public void SynchronizationContext_Post (string driverName = null)
|
||||
{
|
||||
lock (_lockPost)
|
||||
|
||||
@@ -44,4 +44,32 @@ public class SourcesManagerTests
|
||||
ConfigurationManager.ThrowOnJsonErrors = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NOTE: This test causes the static CM._jsonErrors to be modified; can't use in a parallel test
|
||||
[Fact]
|
||||
public void Load_WithInvalidJson_AddsJsonError ()
|
||||
{
|
||||
// Arrange
|
||||
var sourcesManager = new SourcesManager ();
|
||||
|
||||
var settingsScope = new SettingsScope ();
|
||||
var invalidJson = "{ invalid json }";
|
||||
var stream = new MemoryStream ();
|
||||
var writer = new StreamWriter (stream);
|
||||
writer.Write (invalidJson);
|
||||
writer.Flush ();
|
||||
stream.Position = 0;
|
||||
|
||||
var source = "Load_WithInvalidJson_AddsJsonError";
|
||||
var location = ConfigLocations.AppCurrent;
|
||||
|
||||
// Act
|
||||
bool result = sourcesManager.Load (settingsScope, stream, source, location);
|
||||
|
||||
// Assert
|
||||
Assert.False (result);
|
||||
|
||||
// Assuming AddJsonError logs errors, verify the error was logged (mock or inspect logs if possible).
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace UnitTests;
|
||||
/// Enables tests to create a FakeDriver for testing purposes.
|
||||
/// </summary>
|
||||
[Collection ("Global Test Setup")]
|
||||
public abstract class FakeDriverBase /*: IDisposable*/
|
||||
public abstract class FakeDriverBase/* : IDisposable*/
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new FakeDriver instance with the specified buffer size.
|
||||
|
||||
@@ -164,7 +164,7 @@ public class NestedRunTimeoutTests (ITestOutputHelper output)
|
||||
var requestStopTimeoutFired = false;
|
||||
|
||||
app.AddTimeout (
|
||||
TimeSpan.FromMilliseconds (5000),
|
||||
TimeSpan.FromMilliseconds (10000),
|
||||
() =>
|
||||
{
|
||||
output.WriteLine ("SAFETY: RequestStop Timeout fired - test took too long!");
|
||||
|
||||
@@ -55,31 +55,6 @@ public class SourcesManagerTests
|
||||
Assert.Contains (source, sourcesManager.Sources.Values);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Load_WithInvalidJson_AddsJsonError ()
|
||||
{
|
||||
// Arrange
|
||||
var sourcesManager = new SourcesManager ();
|
||||
|
||||
var settingsScope = new SettingsScope ();
|
||||
var invalidJson = "{ invalid json }";
|
||||
var stream = new MemoryStream ();
|
||||
var writer = new StreamWriter (stream);
|
||||
writer.Write (invalidJson);
|
||||
writer.Flush ();
|
||||
stream.Position = 0;
|
||||
|
||||
var source = "Load_WithInvalidJson_AddsJsonError";
|
||||
var location = ConfigLocations.AppCurrent;
|
||||
|
||||
// Act
|
||||
bool result = sourcesManager.Load (settingsScope, stream, source, location);
|
||||
|
||||
// Assert
|
||||
Assert.False (result);
|
||||
|
||||
// Assuming AddJsonError logs errors, verify the error was logged (mock or inspect logs if possible).
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class AttributeTests : FakeDriverBase
|
||||
Assert.Equal (bg, attr.Foreground);
|
||||
Assert.Equal (bg, attr.Background);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -273,7 +273,7 @@ public class AttributeTests : FakeDriverBase
|
||||
Assert.Equal (fg, attr.Foreground);
|
||||
Assert.Equal (bg, attr.Background);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -23,6 +23,7 @@ public class CellTests
|
||||
[InlineData ("æ", new uint [] { 0x00E6 })]
|
||||
[InlineData ("a︠", new uint [] { 0x0061, 0xFE20 })]
|
||||
[InlineData ("e︡", new uint [] { 0x0065, 0xFE21 })]
|
||||
[InlineData ("🇵🇹", new uint [] { 0x1F1F5, 0x1F1F9 })]
|
||||
public void Runes_From_Grapheme (string? grapheme, uint [] expected)
|
||||
{
|
||||
// Arrange
|
||||
@@ -88,6 +89,7 @@ public class CellTests
|
||||
yield return ["👨👩👦👦", null, "[\"👨👩👦👦\":]"];
|
||||
yield return ["A", new Attribute (Color.Red) { Style = TextStyle.Blink }, "[\"A\":[Red,Red,Blink]]"];
|
||||
yield return ["\U0001F469\u200D\u2764\uFE0F\u200D\U0001F48B\u200D\U0001F468", null, "[\"👩❤️💋👨\":]"];
|
||||
yield return ["\uD83C\uDDF5\uD83C\uDDF9", null, "[\"🇵🇹\":]"];
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -176,5 +178,4 @@ public class CellTests
|
||||
// And if your Grapheme setter normalizes, assignment should throw as well
|
||||
Assert.Throws<ArgumentException> (() => new Cell () { Grapheme = s });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SixelEncoderTests
|
||||
{
|
||||
for (var y = 0; y < 12; y++)
|
||||
{
|
||||
pixels [x, y] = new (255, 0, 0);
|
||||
pixels [x, y] = new (255, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SixelEncoderTests
|
||||
// Since image is only red we should only have 1 color definition
|
||||
Color c1 = Assert.Single (encoder.Quantizer.Palette);
|
||||
|
||||
Assert.Equal (new (255, 0, 0), c1);
|
||||
Assert.Equal (new (255, 0), c1);
|
||||
Assert.Equal (expected, result);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class SixelEncoderTests
|
||||
// Create a 3x3 checkerboard by alternating the color based on pixel coordinates
|
||||
if ((x / 3 + y / 3) % 2 == 0)
|
||||
{
|
||||
pixels [x, y] = new (0, 0, 0); // Black
|
||||
pixels [x, y] = new (0, 0); // Black
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public class SixelEncoderTests
|
||||
Color black = encoder.Quantizer.Palette.ElementAt (0);
|
||||
Color white = encoder.Quantizer.Palette.ElementAt (1);
|
||||
|
||||
Assert.Equal (new (0, 0, 0), black);
|
||||
Assert.Equal (new (0, 0), black);
|
||||
Assert.Equal (new (255, 255, 255), white);
|
||||
|
||||
// Compare the generated SIXEL string with the expected one
|
||||
@@ -213,7 +213,7 @@ public class SixelEncoderTests
|
||||
// For simplicity, we'll make every other row transparent
|
||||
if (y % 2 == 0)
|
||||
{
|
||||
pixels [x, y] = new (255, 0, 0); // Red pixel
|
||||
pixels [x, y] = new (255, 0); // Red pixel
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,4 +229,114 @@ public class SixelEncoderTests
|
||||
// Assert: Expect the result to match the expected sixel output
|
||||
Assert.Equal (expected, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EncodeSixel_OnePixel_ReturnsExpectedSequence ()
|
||||
{
|
||||
// Arrange: 1x1 red pixel
|
||||
Color [,] pixels = new Color [1, 1];
|
||||
pixels [0, 0] = new (255, 0);
|
||||
|
||||
var encoder = new SixelEncoder ();
|
||||
|
||||
// Act
|
||||
string result = encoder.EncodeSixel (pixels);
|
||||
|
||||
// Build expected output
|
||||
string expected = "\u001bP" // start
|
||||
+ "0;0;0"
|
||||
+ "q"
|
||||
+ "\"1;1;1;1" // no-scaling + width;height
|
||||
+ "#0;2;100;0;0" // palette
|
||||
+ "#0@$" // single column, single row -> code 1 -> char(1+63) = '@', then $ terminator
|
||||
+ "\u001b\\";
|
||||
|
||||
Assert.Equal (expected, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EncodeSixel_WidthRepeat_UsesSequenceRepeatSyntax ()
|
||||
{
|
||||
// Arrange: width 5, height 1, all same color so sequence repeat > 3
|
||||
int width = 5;
|
||||
Color [,] pixels = new Color [width, 1];
|
||||
|
||||
for (var x = 0; x < width; x++)
|
||||
{
|
||||
pixels [x, 0] = new (255, 0);
|
||||
}
|
||||
|
||||
var encoder = new SixelEncoder ();
|
||||
|
||||
// Act
|
||||
string result = encoder.EncodeSixel (pixels);
|
||||
|
||||
// Assert contains the repeat sequence for 5 identical columns: "!5"
|
||||
Assert.Contains ("!5", result);
|
||||
|
||||
// And final payload for the color should include the palette definition
|
||||
Assert.Contains ("#0;2;100;0;0", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EncodeSixel_HeightNotMultipleOfSix_IncludesBandSeparator ()
|
||||
{
|
||||
// Arrange: width 2, height 7 to force two bands (6 rows + 1 row)
|
||||
Color [,] pixels = new Color [2, 7];
|
||||
|
||||
for (var x = 0; x < 2; x++)
|
||||
{
|
||||
for (var y = 0; y < 7; y++)
|
||||
{
|
||||
pixels [x, y] = new (0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
var encoder = new SixelEncoder ();
|
||||
|
||||
// Act
|
||||
string result = encoder.EncodeSixel (pixels);
|
||||
|
||||
// Assert: there must be a band separator '-' between the bands
|
||||
Assert.Contains ("-", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EncodeSixel_AnyTransparentPixel_SetsTransparencyFlagInHeader ()
|
||||
{
|
||||
// Arrange: 2x2 with one fully transparent pixel
|
||||
Color [,] pixels = new Color [2, 2];
|
||||
pixels [0, 0] = new (255, 0);
|
||||
pixels [0, 1] = new (0, 0, 0, 0); // fully transparent
|
||||
pixels [1, 0] = new (0, 255);
|
||||
pixels [1, 1] = new (0, 0, 255);
|
||||
|
||||
var encoder = new SixelEncoder ();
|
||||
|
||||
// Act
|
||||
string result = encoder.EncodeSixel (pixels);
|
||||
|
||||
// defaultRatios should be "0;1;0" when any pixel has alpha == 0
|
||||
Assert.Contains ("\u001bP0;1;0q", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EncodeSixel_MaxPaletteHonored_WhenReducedMaxColors ()
|
||||
{
|
||||
// Arrange: create three distinct colors but restrict max palette to 2
|
||||
Color [,] pixels = new Color [3, 1];
|
||||
pixels [0, 0] = new (255, 0);
|
||||
pixels [1, 0] = new (0, 255);
|
||||
pixels [2, 0] = new (0, 0, 255);
|
||||
|
||||
var encoder = new SixelEncoder ();
|
||||
encoder.Quantizer.MaxColors = 2;
|
||||
|
||||
// Act
|
||||
string result = encoder.EncodeSixel (pixels);
|
||||
|
||||
// Assert: palette count must respect MaxColors (<= 2) and encoding must not throw
|
||||
Assert.True (encoder.Quantizer.Palette.Count <= 2);
|
||||
Assert.False (string.IsNullOrEmpty (result));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
#nullable enable
|
||||
using Moq;
|
||||
|
||||
namespace DrawingTests;
|
||||
|
||||
public class SixelSupportDetectorTests
|
||||
{
|
||||
[Fact]
|
||||
public void Detect_SetsSupportedAndResolution_WhenDeviceAttributesContain4_AndResolutionResponds()
|
||||
{
|
||||
// Arrange
|
||||
Mock<IDriver> driverMock = new (MockBehavior.Strict);
|
||||
|
||||
// Setup IsLegacyConsole - false means modern terminal with ANSI support
|
||||
driverMock.Setup (d => d.IsLegacyConsole).Returns (false);
|
||||
|
||||
// Expect QueueAnsiRequest to be called at least twice:
|
||||
// 1) CSI_SendDeviceAttributes (terminator "c")
|
||||
// 2) CSI_RequestSixelResolution (terminator "t")
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
// Respond to the SendDeviceAttributes request with a value that indicates support (contains "4")
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
req.ResponseReceived.Invoke ("1;4;7c");
|
||||
}
|
||||
else if (req.Request == EscSeqUtils.CSI_RequestSixelResolution.Request)
|
||||
{
|
||||
// Reply with a resolution response matching regex "\[\d+;(\d+);(\d+)t$"
|
||||
// Group 1 -> ry, Group 2 -> rx. The detector constructs resolution as new(rx, ry)
|
||||
req.ResponseReceived.Invoke ("[6;20;10t");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Any other request - call abandoned to avoid hanging
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.True (final.IsSupported); // Response contained "4"
|
||||
// Resolution should be constructed as new(rx, ry) where rx=10, ry=20 from our reply "[6;20;10t"
|
||||
Assert.Equal (10, final.Resolution.Width);
|
||||
Assert.Equal (20, final.Resolution.Height);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeast (2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Detect_DoesNotSetSupported_WhenDeviceAttributesDoNotContain4()
|
||||
{
|
||||
// Arrange
|
||||
var driverMock = new Mock<IDriver>(MockBehavior.Strict);
|
||||
|
||||
// Setup IsLegacyConsole - false means modern terminal with ANSI support
|
||||
driverMock.Setup (d => d.IsLegacyConsole).Returns (false);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
// SendDeviceAttributes -> reply without "4"
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
req.ResponseReceived.Invoke ("1;0;7c");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Any other requests should be abandoned
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.False (final.IsSupported);
|
||||
// On no support, the direct resolution request path isn't followed so resolution remains the default
|
||||
Assert.Equal (10, final.Resolution.Width);
|
||||
Assert.Equal (20, final.Resolution.Height);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeast (1));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (true)]
|
||||
[InlineData (false)]
|
||||
public void Detect_SetsSupported_WhenIsLegacyConsoleIsFalseAndResponseContain4OrFalse (bool isLegacyConsole)
|
||||
{
|
||||
// Arrange
|
||||
var responseReceived = false;
|
||||
var output = new FakeOutput ();
|
||||
output.IsLegacyConsole = isLegacyConsole;
|
||||
|
||||
Mock<DriverImpl> driverMock = new (
|
||||
MockBehavior.Strict,
|
||||
new FakeInputProcessor (null!),
|
||||
new OutputBufferImpl (),
|
||||
output,
|
||||
new AnsiRequestScheduler (new AnsiResponseParser ()),
|
||||
new SizeMonitorImpl (output)
|
||||
);
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
responseReceived = true;
|
||||
|
||||
if (!isLegacyConsole)
|
||||
{
|
||||
// Response does contain "4" (so DAR indicates has sixel)
|
||||
req.ResponseReceived.Invoke ("?1;4;0;7c");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Response does NOT contain "4" (so DAR indicates no sixel)
|
||||
req.ResponseReceived.Invoke ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Abandon all requests
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.Equal (isLegacyConsole, driverMock.Object.IsLegacyConsole);
|
||||
Assert.NotNull (final);
|
||||
|
||||
if (!isLegacyConsole)
|
||||
{
|
||||
Assert.True (final.IsSupported);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a real VT, so should be supported
|
||||
Assert.False (final.IsSupported);
|
||||
}
|
||||
Assert.True (responseReceived);
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeast (1));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (true)]
|
||||
[InlineData (false)]
|
||||
public void Detect_SetsSupported_WhenIsLegacyConsoleIsTrueOrFalse_With_Response (bool isLegacyConsole)
|
||||
{
|
||||
// Arrange
|
||||
var responseReceived = false;
|
||||
var output = new FakeOutput ();
|
||||
output.IsLegacyConsole = isLegacyConsole;
|
||||
|
||||
Mock<DriverImpl> driverMock = new (
|
||||
MockBehavior.Strict,
|
||||
new FakeInputProcessor (null!),
|
||||
new OutputBufferImpl (),
|
||||
output,
|
||||
new AnsiRequestScheduler (new AnsiResponseParser ()),
|
||||
new SizeMonitorImpl (output)
|
||||
);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
responseReceived = true;
|
||||
|
||||
// Respond to the SendDeviceAttributes request with a value that indicates support (contains "4")
|
||||
// Respond to the SendDeviceAttributes request with an empty value that indicates non-support
|
||||
req.ResponseReceived.Invoke (!driverMock.Object.IsLegacyConsole ? "1;4;7c" : "");
|
||||
}
|
||||
|
||||
// Abandon all requests
|
||||
req.Abandoned?.Invoke ();
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.Equal (isLegacyConsole, driverMock.Object.IsLegacyConsole);
|
||||
Assert.NotNull (final);
|
||||
|
||||
if (!isLegacyConsole)
|
||||
{
|
||||
Assert.True (final.IsSupported);
|
||||
Assert.True (final.SupportsTransparency);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a real VT, so shouldn't be supported
|
||||
Assert.False (final.IsSupported);
|
||||
Assert.False (final.SupportsTransparency);
|
||||
}
|
||||
|
||||
Assert.True (responseReceived);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#nullable enable
|
||||
|
||||
namespace DrawingTests;
|
||||
|
||||
public class SixelSupportResultTests
|
||||
{
|
||||
[Fact]
|
||||
public void Defaults_AreCorrect ()
|
||||
{
|
||||
// Arrange & Act
|
||||
var result = new SixelSupportResult ();
|
||||
|
||||
// Assert
|
||||
Assert.False (result.IsSupported);
|
||||
Assert.Equal (10, result.Resolution.Width);
|
||||
Assert.Equal (20, result.Resolution.Height);
|
||||
Assert.Equal (256, result.MaxPaletteColors);
|
||||
Assert.False (result.SupportsTransparency);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Properties_CanBeModified ()
|
||||
{
|
||||
// Arrange
|
||||
var result = new SixelSupportResult ();
|
||||
|
||||
// Act
|
||||
result.IsSupported = true;
|
||||
result.Resolution = new Size (24, 48);
|
||||
result.MaxPaletteColors = 16;
|
||||
result.SupportsTransparency = true;
|
||||
|
||||
// Assert
|
||||
Assert.True (result.IsSupported);
|
||||
Assert.Equal (24, result.Resolution.Width);
|
||||
Assert.Equal (48, result.Resolution.Height);
|
||||
Assert.Equal (16, result.MaxPaletteColors);
|
||||
Assert.True (result.SupportsTransparency);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolution_IsValueType_CopyDoesNotAffectOriginal ()
|
||||
{
|
||||
// Arrange
|
||||
var result = new SixelSupportResult ();
|
||||
Size original = result.Resolution;
|
||||
|
||||
// Act
|
||||
// Mutate a local copy and ensure original remains unchanged
|
||||
Size copy = original;
|
||||
copy.Width = 123;
|
||||
copy.Height = 456;
|
||||
|
||||
// Assert
|
||||
Assert.Equal (10, result.Resolution.Width);
|
||||
Assert.Equal (20, result.Resolution.Height);
|
||||
Assert.Equal (10, original.Width);
|
||||
Assert.Equal (20, original.Height);
|
||||
Assert.Equal (123, copy.Width);
|
||||
Assert.Equal (456, copy.Height);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
#nullable enable
|
||||
using Moq;
|
||||
|
||||
namespace DrawingTests;
|
||||
|
||||
public class SixelToRenderTests
|
||||
{
|
||||
[Fact]
|
||||
public void SixelToRender_Properties_AreGettableAndSettable ()
|
||||
{
|
||||
SixelToRender s = new SixelToRender
|
||||
{
|
||||
SixelData = "SIXEL-DATA",
|
||||
ScreenPosition = new (3, 5)
|
||||
};
|
||||
|
||||
Assert.Equal ("SIXEL-DATA", s.SixelData);
|
||||
Assert.Equal (3, s.ScreenPosition.X);
|
||||
Assert.Equal (5, s.ScreenPosition.Y);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SixelSupportResult_DefaultValues_AreExpected ()
|
||||
{
|
||||
var r = new SixelSupportResult ();
|
||||
|
||||
Assert.False (r.IsSupported);
|
||||
Assert.Equal (10, r.Resolution.Width);
|
||||
Assert.Equal (20, r.Resolution.Height);
|
||||
Assert.Equal (256, r.MaxPaletteColors);
|
||||
Assert.False (r.SupportsTransparency);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Detect_WhenDeviceAttributesIndicateSupport_GetsResolutionDirectly ()
|
||||
{
|
||||
// Arrange
|
||||
Mock<IDriver> driverMock = new (MockBehavior.Strict);
|
||||
|
||||
// Setup IsLegacyConsole - false means modern terminal with ANSI support
|
||||
driverMock.Setup (d => d.IsLegacyConsole).Returns (false);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
// Response contains "4" -> indicates sixel support
|
||||
req.ResponseReceived.Invoke ("?1;4;7c");
|
||||
}
|
||||
else if (req.Request == EscSeqUtils.CSI_RequestSixelResolution.Request)
|
||||
{
|
||||
// Return resolution: "[6;20;10t" (group1=20 -> ry, group2=10 -> rx)
|
||||
req.ResponseReceived.Invoke ("[6;20;10t");
|
||||
}
|
||||
else
|
||||
{
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.True (final.IsSupported);
|
||||
Assert.Equal (10, final.Resolution.Width);
|
||||
Assert.Equal (20, final.Resolution.Height);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeast (2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Detect_WhenDirectResolutionFails_ComputesResolutionFromWindowSizes ()
|
||||
{
|
||||
// Arrange
|
||||
Mock<IDriver> driverMock = new (MockBehavior.Strict);
|
||||
|
||||
// Setup IsLegacyConsole - false means modern terminal with ANSI support
|
||||
driverMock.Setup (d => d.IsLegacyConsole).Returns (false);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
switch (req.Request)
|
||||
{
|
||||
case var r when r == EscSeqUtils.CSI_SendDeviceAttributes.Request:
|
||||
// Indicate sixel support so flow continues to try resolution
|
||||
req.ResponseReceived.Invoke ("?1;4;7c");
|
||||
break;
|
||||
|
||||
case var r when r == EscSeqUtils.CSI_RequestSixelResolution.Request:
|
||||
// Simulate failure to return resolution directly
|
||||
req.Abandoned?.Invoke ();
|
||||
break;
|
||||
|
||||
case var r when r == EscSeqUtils.CSI_RequestWindowSizeInPixels.Request:
|
||||
// Pixel dimensions reply: [4;600;1200t -> pixelHeight=600; pixelWidth=1200
|
||||
req.ResponseReceived.Invoke ("[4;600;1200t");
|
||||
break;
|
||||
|
||||
case var r when r == EscSeqUtils.CSI_ReportWindowSizeInChars.Request:
|
||||
// Character dimensions reply: [8;30;120t -> charHeight=30; charWidth=120
|
||||
req.ResponseReceived.Invoke ("[8;30;120t");
|
||||
break;
|
||||
|
||||
default:
|
||||
req.Abandoned?.Invoke ();
|
||||
break;
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.True (final.IsSupported);
|
||||
// Expect cell width = round(1200 / 120) = 10, cell height = round(600 / 30) = 20
|
||||
Assert.Equal (10, final.Resolution.Width);
|
||||
Assert.Equal (20, final.Resolution.Height);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeast (3));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Detect_WhenDeviceAttributesDoNotIndicateSupport_ReturnsNotSupported ()
|
||||
{
|
||||
// Arrange
|
||||
Mock<IDriver> driverMock = new (MockBehavior.Strict);
|
||||
|
||||
// Setup IsLegacyConsole - false means modern terminal with ANSI support
|
||||
driverMock.Setup (d => d.IsLegacyConsole).Returns (false);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
// Response does NOT contain "4"
|
||||
req.ResponseReceived.Invoke ("?1;0;7c");
|
||||
}
|
||||
else
|
||||
{
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.False (final.IsSupported);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeastOnce ());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData ("", true, false, false, false)]
|
||||
[InlineData ("", true, true, false, false)]
|
||||
[InlineData ("?1;0;7c", false, false, false, true)]
|
||||
[InlineData ("?1;0;7c", false, true, false, true)]
|
||||
[InlineData ("?1;4;0;7c", false, false, true, true)]
|
||||
[InlineData ("?1;4;0;7c", false, true, true, true)]
|
||||
public void Detect_WhenXtermEnvironmentIndicatesTransparency_SupportsTransparencyEvenIfDAReturnsNo4 (
|
||||
string darResponse,
|
||||
bool isLegacyConsole,
|
||||
bool isXtermWithTransparency,
|
||||
bool expectedIsSupported,
|
||||
bool expectedSupportsTransparency
|
||||
)
|
||||
{
|
||||
// Arrange - set XTERM_VERSION env var to indicate real xterm with transparency
|
||||
string? prev = Environment.GetEnvironmentVariable ("XTERM_VERSION");
|
||||
|
||||
try
|
||||
{
|
||||
var output = new FakeOutput ();
|
||||
output.IsLegacyConsole = isLegacyConsole;
|
||||
|
||||
Mock<DriverImpl> driverMock = new (
|
||||
MockBehavior.Strict,
|
||||
new FakeInputProcessor (null!),
|
||||
new OutputBufferImpl (),
|
||||
output,
|
||||
new AnsiRequestScheduler (new AnsiResponseParser ()),
|
||||
new SizeMonitorImpl (output)
|
||||
);
|
||||
|
||||
driverMock.Setup (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()))
|
||||
.Callback<AnsiEscapeSequenceRequest> (req =>
|
||||
{
|
||||
if (req.Request == EscSeqUtils.CSI_SendDeviceAttributes.Request)
|
||||
{
|
||||
// Response does NOT contain "4" (so DAR indicates no sixel)
|
||||
req.ResponseReceived.Invoke (darResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
req.Abandoned?.Invoke ();
|
||||
}
|
||||
})
|
||||
.Verifiable ();
|
||||
|
||||
var detector = new SixelSupportDetector (driverMock.Object);
|
||||
|
||||
SixelSupportResult? final = null;
|
||||
|
||||
if (isXtermWithTransparency)
|
||||
{
|
||||
Environment.SetEnvironmentVariable ("XTERM_VERSION", "370");
|
||||
}
|
||||
|
||||
// Act
|
||||
detector.Detect (r => final = r);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull (final);
|
||||
Assert.Equal (isLegacyConsole, driverMock.Object.IsLegacyConsole);
|
||||
|
||||
// DAR did not indicate sixel support
|
||||
Assert.Equal (expectedIsSupported, final.IsSupported);
|
||||
|
||||
// But because XTERM_VERSION >= 370 we expect SupportsTransparency to have been initially true and remain true
|
||||
Assert.Equal (expectedSupportsTransparency, final.SupportsTransparency);
|
||||
|
||||
driverMock.Verify (d => d.QueueAnsiRequest (It.IsAny<AnsiEscapeSequenceRequest> ()), Times.AtLeastOnce ());
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Restore environment
|
||||
Environment.SetEnvironmentVariable ("XTERM_VERSION", prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class AddRuneTests (ITestOutputHelper output) : FakeDriverBase
|
||||
driver.AddRune (new Rune ('a'));
|
||||
Assert.Equal ("a", driver.Contents? [0, 0].Grapheme);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -73,7 +73,7 @@ public class AddRuneTests (ITestOutputHelper output) : FakeDriverBase
|
||||
// Application.Refresh ();
|
||||
// DriverAsserts.AssertDriverContentsWithFrameAre (@"
|
||||
//ắ", output);
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -92,7 +92,7 @@ public class AddRuneTests (ITestOutputHelper output) : FakeDriverBase
|
||||
}
|
||||
}
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -133,7 +133,7 @@ public class AddRuneTests (ITestOutputHelper output) : FakeDriverBase
|
||||
}
|
||||
}
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -177,6 +177,6 @@ public class AddRuneTests (ITestOutputHelper output) : FakeDriverBase
|
||||
// }
|
||||
//}
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ContentsTests (ITestOutputHelper output) : FakeDriverBase
|
||||
driver.AddStr ("\u0301!"); // acute accent + exclamation mark
|
||||
DriverAssert.AssertDriverContentsAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -66,7 +66,7 @@ public class ContentsTests (ITestOutputHelper output) : FakeDriverBase
|
||||
driver.AddStr (combined);
|
||||
DriverAssert.AssertDriverContentsAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -96,7 +96,7 @@ public class ContentsTests (ITestOutputHelper output) : FakeDriverBase
|
||||
driver.Move (500, 500);
|
||||
Assert.Equal (500, driver.Col);
|
||||
Assert.Equal (500, driver.Row);
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
// TODO: Add these unit tests
|
||||
|
||||
@@ -14,6 +14,6 @@ public class DriverColorTests : FakeDriverBase
|
||||
driver.Force16Colors = true;
|
||||
Assert.True (driver.Force16Colors);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DriverTests (ITestOutputHelper output) : FakeDriverBase
|
||||
Assert.False (driver.IsValidLocation (text, driver.Cols, driver.Rows - 1));
|
||||
Assert.False (driver.IsValidLocation (text, driver.Cols, driver.Rows));
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
54
Tests/UnitTestsParallelizable/Drivers/LegacyConsoleTests.cs
Normal file
54
Tests/UnitTestsParallelizable/Drivers/LegacyConsoleTests.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
#nullable enable
|
||||
using UnitTests;
|
||||
|
||||
namespace DriverTests;
|
||||
|
||||
public class LegacyConsoleTests : FakeDriverBase
|
||||
{
|
||||
[Fact]
|
||||
public void IsLegacyConsole_Returns_Expected_Values ()
|
||||
{
|
||||
IDriver? driver = CreateFakeDriver ();
|
||||
Assert.False (driver.IsLegacyConsole);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsLegacyConsole_False_Force16Colors_True_False ()
|
||||
{
|
||||
IDriver? driver = CreateFakeDriver ();
|
||||
|
||||
Assert.False (driver.IsLegacyConsole);
|
||||
Assert.False (driver.Force16Colors);
|
||||
|
||||
driver.Force16Colors = true;
|
||||
Assert.False (driver.IsLegacyConsole);
|
||||
Assert.True (driver.Force16Colors);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsLegacyConsole_True_Force16Colors_Is_Always_True ()
|
||||
{
|
||||
IDriver? driver = CreateFakeDriver ();
|
||||
|
||||
Assert.False (driver.IsLegacyConsole);
|
||||
Assert.False (driver.Force16Colors);
|
||||
|
||||
driver.IsLegacyConsole = true;
|
||||
Assert.True (driver.Force16Colors);
|
||||
|
||||
driver.Force16Colors = false;
|
||||
Assert.True (driver.Force16Colors);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsLegacyConsole_True_False_SupportsTrueColor_Is_Always_True_False ()
|
||||
{
|
||||
IDriver? driver = CreateFakeDriver ();
|
||||
|
||||
Assert.False (driver.IsLegacyConsole);
|
||||
Assert.True (driver.SupportsTrueColor);
|
||||
|
||||
driver.IsLegacyConsole = true;
|
||||
Assert.False (driver.SupportsTrueColor);
|
||||
}
|
||||
}
|
||||
218
Tests/UnitTestsParallelizable/Drivers/OutputBaseTests.cs
Normal file
218
Tests/UnitTestsParallelizable/Drivers/OutputBaseTests.cs
Normal file
@@ -0,0 +1,218 @@
|
||||
#nullable enable
|
||||
|
||||
namespace DriverTests;
|
||||
|
||||
public class OutputBaseTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToAnsi_SingleCell_NoAttribute_ReturnsGraphemeAndNewline ()
|
||||
{
|
||||
// Arrange
|
||||
var output = new FakeOutput ();
|
||||
IOutputBuffer buffer = output.LastBuffer!;
|
||||
buffer.SetSize (1, 1);
|
||||
|
||||
// Act
|
||||
buffer.AddStr ("A");
|
||||
string ansi = output.ToAnsi (buffer);
|
||||
|
||||
// Assert: single grapheme plus newline (BuildAnsiForRegion appends a newline per row)
|
||||
Assert.Contains ("A" + Environment.NewLine, ansi);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (true, false)]
|
||||
[InlineData (true, true)]
|
||||
[InlineData (false, false)]
|
||||
[InlineData (false, true)]
|
||||
public void ToAnsi_WithAttribute_AppendsCorrectColorSequence_BasedOnIsLegacyConsole_And_Force16Colors (bool isLegacyConsole, bool force16Colors)
|
||||
{
|
||||
// Arrange
|
||||
var output = new FakeOutput { IsLegacyConsole = isLegacyConsole };
|
||||
|
||||
// Create DriverImpl and associate it with the FakeOutput to test Sixel output
|
||||
IDriver driver = new DriverImpl (
|
||||
new FakeInputProcessor (null!),
|
||||
new OutputBufferImpl (),
|
||||
output,
|
||||
new (new AnsiResponseParser ()),
|
||||
new SizeMonitorImpl (output));
|
||||
|
||||
driver.Force16Colors = force16Colors;
|
||||
|
||||
IOutputBuffer buffer = output.LastBuffer!;
|
||||
buffer.SetSize (1, 1);
|
||||
|
||||
// Use a known RGB color and attribute
|
||||
var fg = new Color (1, 2, 3);
|
||||
var bg = new Color (4, 5, 6);
|
||||
buffer.CurrentAttribute = new Attribute (fg, bg);
|
||||
buffer.AddStr ("X");
|
||||
|
||||
// Act
|
||||
string ansi = output.ToAnsi (buffer);
|
||||
|
||||
// Assert: when true color expected, we should see the RGB CSI; otherwise we should see the 16-color CSI
|
||||
if (!isLegacyConsole && !force16Colors)
|
||||
{
|
||||
Assert.Contains ("\u001b[38;2;1;2;3m", ansi);
|
||||
}
|
||||
else if (!isLegacyConsole && force16Colors)
|
||||
{
|
||||
var expected16 = EscSeqUtils.CSI_SetForegroundColor (fg.GetAnsiColorCode ());
|
||||
Assert.Contains (expected16, ansi);
|
||||
}
|
||||
else
|
||||
{
|
||||
var expected16 = (ConsoleColor)fg.GetClosestNamedColor16 ();
|
||||
Assert.Equal (ConsoleColor.Black, expected16);
|
||||
Assert.DoesNotContain ('\u001b', ansi);
|
||||
}
|
||||
|
||||
// Grapheme and newline should always be present
|
||||
Assert.Contains ("X" + Environment.NewLine, ansi);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Write_WritesDirtyCellsAndClearsDirtyFlags ()
|
||||
{
|
||||
// Arrange
|
||||
var output = new FakeOutput ();
|
||||
IOutputBuffer buffer = output.LastBuffer!;
|
||||
buffer.SetSize (2, 1);
|
||||
|
||||
// Mark two characters as dirty by writing them into the buffer
|
||||
buffer.AddStr ("AB");
|
||||
|
||||
// Sanity: ensure cells are dirty before calling Write
|
||||
Assert.True (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.True (buffer.Contents! [0, 1].IsDirty);
|
||||
|
||||
// Act
|
||||
output.Write (buffer); // calls OutputBase.Write via FakeOutput
|
||||
|
||||
// Assert: content was written to the fake output and dirty flags cleared
|
||||
Assert.Contains ("AB", output.Output);
|
||||
Assert.False (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.False (buffer.Contents! [0, 1].IsDirty);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (true)]
|
||||
[InlineData (false)]
|
||||
public void Write_Virtual_Or_NonVirtual_Uses_WriteToConsole_And_Clears_Dirty_Flags (bool isLegacyConsole)
|
||||
{
|
||||
// Arrange
|
||||
// FakeOutput exposes this because it's in test scope
|
||||
var output = new FakeOutput { IsLegacyConsole = isLegacyConsole };
|
||||
IOutputBuffer buffer = output.LastBuffer!;
|
||||
buffer.SetSize (3, 1);
|
||||
|
||||
// Write 'A' at col 0 and 'C' at col 2; leave col 1 untouched (not dirty)
|
||||
buffer.Move (0, 0);
|
||||
buffer.AddStr ("A");
|
||||
buffer.Move (2, 0);
|
||||
buffer.AddStr ("C");
|
||||
|
||||
// Confirm some dirtiness before to write
|
||||
Assert.True (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.True (buffer.Contents! [0, 2].IsDirty);
|
||||
|
||||
// Act
|
||||
output.Write (buffer);
|
||||
|
||||
// Assert: both characters were written (use Contains to avoid CI side effects)
|
||||
Assert.Contains ("A", output.Output);
|
||||
Assert.Contains ("C", output.Output);
|
||||
|
||||
// Dirty flags cleared for the written cells
|
||||
Assert.False (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.False (buffer.Contents! [0, 2].IsDirty);
|
||||
|
||||
// Verify SetCursorPositionImpl was invoked by WriteToConsole (cursor set to a written column)
|
||||
Assert.Equal (new Point (0, 0), output.GetCursorPosition ());
|
||||
|
||||
// Now write 'X' at col 0 to verify subsequent writes also work
|
||||
buffer.Move (0, 0);
|
||||
buffer.AddStr ("X");
|
||||
|
||||
// Confirm dirtiness state before to write
|
||||
Assert.True (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.False (buffer.Contents! [0, 2].IsDirty);
|
||||
|
||||
output.Write (buffer);
|
||||
|
||||
// Assert: both characters were written (use Contains to avoid CI side effects)
|
||||
Assert.Contains ("A", output.Output);
|
||||
Assert.Contains ("C", output.Output);
|
||||
|
||||
// Dirty flags cleared for the written cells
|
||||
Assert.False (buffer.Contents! [0, 0].IsDirty);
|
||||
Assert.False (buffer.Contents! [0, 2].IsDirty);
|
||||
|
||||
// Verify SetCursorPositionImpl was invoked by WriteToConsole (cursor set to a written column)
|
||||
Assert.Equal (new Point (0, 0), output.GetCursorPosition ());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData (true)]
|
||||
[InlineData (false)]
|
||||
public void Write_EmitsSixelDataAndPositionsCursor (bool isLegacyConsole)
|
||||
{
|
||||
// Arrange
|
||||
var output = new FakeOutput ();
|
||||
IOutputBuffer buffer = output.LastBuffer!;
|
||||
buffer.SetSize (1, 1);
|
||||
|
||||
// Ensure the buffer has some content so Write traverses rows
|
||||
buffer.AddStr (".");
|
||||
|
||||
// Create a Sixel to render
|
||||
var s = new SixelToRender
|
||||
{
|
||||
SixelData = "SIXEL-DATA",
|
||||
ScreenPosition = new Point (4, 2)
|
||||
};
|
||||
|
||||
// Create DriverImpl and associate it with the FakeOutput to test Sixel output
|
||||
IDriver driver = new DriverImpl (
|
||||
new FakeInputProcessor (null!),
|
||||
new OutputBufferImpl (),
|
||||
output,
|
||||
new (new AnsiResponseParser ()),
|
||||
new SizeMonitorImpl (output));
|
||||
|
||||
// Add the Sixel to the driver
|
||||
driver.GetSixels ().Enqueue (s);
|
||||
|
||||
// FakeOutput exposes this because it's in test scope
|
||||
output.IsLegacyConsole = isLegacyConsole;
|
||||
|
||||
// Act
|
||||
output.Write (buffer);
|
||||
|
||||
if (!isLegacyConsole)
|
||||
{
|
||||
// Assert: Sixel data was emitted (use Contains to avoid equality/side-effects)
|
||||
Assert.Contains ("SIXEL-DATA", output.Output);
|
||||
|
||||
// Cursor was moved to Sixel position
|
||||
Assert.Equal (s.ScreenPosition, output.GetCursorPosition ());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assert: Sixel data was NOT emitted
|
||||
Assert.DoesNotContain ("SIXEL-DATA", output.Output);
|
||||
|
||||
// Cursor was NOT moved to Sixel position
|
||||
Assert.NotEqual (s.ScreenPosition, output.GetCursorPosition ());
|
||||
}
|
||||
|
||||
IApplication app = Application.Create ();
|
||||
app.Driver = driver;
|
||||
|
||||
Assert.Equal (driver.GetSixels (), app.Driver.GetSixels ());
|
||||
|
||||
app.Dispose ();
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,9 @@ public class ToAnsiTests : FakeDriverBase
|
||||
// Should contain the text
|
||||
Assert.Contains ("Hello", ansi);
|
||||
Assert.Contains ("World", ansi);
|
||||
|
||||
|
||||
// Should have proper structure with newlines
|
||||
string[] lines = ansi.Split (['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
|
||||
string [] lines = ansi.Split (['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.Equal (3, lines.Length);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ToAnsiTests : FakeDriverBase
|
||||
public void ToAnsi_With_Background_Colors (bool force16Colors, string expected)
|
||||
{
|
||||
IDriver driver = CreateFakeDriver (10, 2);
|
||||
Application.Force16Colors = force16Colors;
|
||||
driver.Force16Colors = force16Colors;
|
||||
|
||||
// Set background color
|
||||
driver.CurrentAttribute = new (Color.White, Color.Red);
|
||||
@@ -204,13 +204,13 @@ public class ToAnsiTests : FakeDriverBase
|
||||
Assert.Equal (50, ansi.Count (c => c == '\n'));
|
||||
}
|
||||
|
||||
[Fact (Skip = "Use Application.")]
|
||||
[Fact]
|
||||
public void ToAnsi_RGB_Colors ()
|
||||
{
|
||||
IDriver driver = CreateFakeDriver (10, 1);
|
||||
|
||||
// Use RGB colors (when not forcing 16 colors)
|
||||
Application.Force16Colors = false;
|
||||
driver.Force16Colors = false;
|
||||
try
|
||||
{
|
||||
driver.CurrentAttribute = new Attribute (new Color (255, 0, 0), new Color (0, 255, 0));
|
||||
@@ -224,17 +224,17 @@ public class ToAnsiTests : FakeDriverBase
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Force16Colors = true; // Reset
|
||||
driver.Force16Colors = true; // Reset
|
||||
}
|
||||
}
|
||||
|
||||
[Fact (Skip = "Use Application.")]
|
||||
[Fact]
|
||||
public void ToAnsi_Force16Colors ()
|
||||
{
|
||||
IDriver driver = CreateFakeDriver (10, 1);
|
||||
|
||||
// Force 16 colors
|
||||
Application.Force16Colors = true;
|
||||
driver.Force16Colors = true;
|
||||
driver.CurrentAttribute = new Attribute (Color.Red, Color.Blue);
|
||||
driver.AddStr ("16Color");
|
||||
|
||||
@@ -268,15 +268,15 @@ public class ToAnsiTests : FakeDriverBase
|
||||
foreach (string colorName in colors)
|
||||
{
|
||||
Color fg = colorName switch
|
||||
{
|
||||
"Red" => Color.Red,
|
||||
"Green" => Color.Green,
|
||||
"Blue" => Color.Blue,
|
||||
"Yellow" => Color.Yellow,
|
||||
"Magenta" => Color.Magenta,
|
||||
"Cyan" => Color.Cyan,
|
||||
_ => Color.White
|
||||
};
|
||||
{
|
||||
"Red" => Color.Red,
|
||||
"Green" => Color.Green,
|
||||
"Blue" => Color.Blue,
|
||||
"Yellow" => Color.Yellow,
|
||||
"Magenta" => Color.Magenta,
|
||||
"Cyan" => Color.Cyan,
|
||||
_ => Color.White
|
||||
};
|
||||
|
||||
driver.CurrentAttribute = new (fg, Color.Black);
|
||||
driver.AddStr (colorName);
|
||||
@@ -343,10 +343,10 @@ public class ToAnsiTests : FakeDriverBase
|
||||
|
||||
string ansi = driver.ToAnsi ();
|
||||
|
||||
string[] lines = ansi.Split ('\n');
|
||||
string [] lines = ansi.Split ('\n');
|
||||
Assert.Equal (4, lines.Length); // 3 content lines + 1 empty line at end
|
||||
Assert.Contains ("First", lines[0]);
|
||||
Assert.Contains ("Third", lines[2]);
|
||||
Assert.Contains ("First", lines [0]);
|
||||
Assert.Contains ("Third", lines [2]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -269,15 +269,15 @@ public class WindowsKeyConverterTests
|
||||
#region ToKey Tests - OEM Keys
|
||||
|
||||
[Theory]
|
||||
[InlineData (';', ConsoleKey.Oem1, false, (KeyCode)';')]
|
||||
//[InlineData (';', ConsoleKey.Oem1, false, (KeyCode)';')] // Keyboard layout dependent and shifted key is needed to produce ';' (Pt)
|
||||
[InlineData (':', ConsoleKey.Oem1, true, (KeyCode)':')]
|
||||
[InlineData ('/', ConsoleKey.Oem2, false, (KeyCode)'/')]
|
||||
//[InlineData ('/', ConsoleKey.Oem2, false, (KeyCode)'/')] // Keyboard layout dependent and shifted key is needed to produce '/' (Pt)
|
||||
[InlineData ('?', ConsoleKey.Oem2, true, (KeyCode)'?')]
|
||||
[InlineData (',', ConsoleKey.OemComma, false, (KeyCode)',')]
|
||||
[InlineData ('<', ConsoleKey.OemComma, true, (KeyCode)'<')]
|
||||
[InlineData ('.', ConsoleKey.OemPeriod, false, (KeyCode)'.')]
|
||||
[InlineData ('>', ConsoleKey.OemPeriod, true, (KeyCode)'>')]
|
||||
[InlineData ('=', ConsoleKey.OemPlus, false, (KeyCode)'=')] // Un-shifted OemPlus is '='
|
||||
//[InlineData ('=', ConsoleKey.OemPlus, false, (KeyCode)'=')] // Keyboard layout dependent and shifted key is needed to produce '=' (Pt)
|
||||
[InlineData ('+', ConsoleKey.OemPlus, true, (KeyCode)'+')] // Shifted OemPlus is '+'
|
||||
[InlineData ('-', ConsoleKey.OemMinus, false, (KeyCode)'-')]
|
||||
[InlineData ('_', ConsoleKey.OemMinus, true, (KeyCode)'_')] // Shifted OemMinus is '_'
|
||||
|
||||
@@ -77,6 +77,7 @@ public class StringTests
|
||||
[InlineData ("ힰ", 0, 1, 0)] // U+D7B0 ힰ Hangul Jungseong O-Yeo
|
||||
[InlineData ("ᄀힰ", 2, 1, 2)] // ᄀ U+1100 HANGUL CHOSEONG KIYEOK (consonant) with U+D7B0 ힰ Hangul Jungseong O-Yeo
|
||||
//[InlineData ("षि", 2, 1, 2)] // U+0937 ष DEVANAGARI LETTER SSA with U+093F ि COMBINING DEVANAGARI VOWEL SIGN I
|
||||
[InlineData ("🇵🇹", 2, 1, 2)] // 🇵 U+1F1F5 — REGIONAL INDICATOR SYMBOL LETTER P with 🇹 U+1F1F9 — REGIONAL INDICATOR SYMBOL LETTER T (flag of Portugal)
|
||||
public void TestGetColumns_MultiRune_WideBMP_Graphemes (string str, int expectedRunesWidth, int expectedGraphemesCount, int expectedWidth)
|
||||
{
|
||||
Assert.Equal (expectedRunesWidth, str.EnumerateRunes ().Sum (r => r.GetColumns ()));
|
||||
@@ -165,6 +166,7 @@ public class StringTests
|
||||
yield return [new [] { "👩", "🧒" }, "👩🧒"]; // Grapheme sequence
|
||||
yield return [new [] { "α", "β", "γ" }, "αβγ"]; // Unicode letters
|
||||
yield return [new [] { "A", null, "B" }, "AB"]; // Null ignored by string.Concat
|
||||
yield return [new [] { "🇵", "🇹" }, "🇵🇹"]; // Grapheme sequence
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
@@ -3121,7 +3121,7 @@ ssb
|
||||
default (Rectangle));
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -3158,7 +3158,7 @@ ssb
|
||||
default (Rectangle));
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -3196,7 +3196,7 @@ ssb
|
||||
default (Rectangle));
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -3233,6 +3233,6 @@ ssb
|
||||
default (Rectangle));
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (expected, output, driver);
|
||||
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class PosCenterTests (ITestOutputHelper output) : FakeDriverBase
|
||||
|
||||
_ = DriverAssert.AssertDriverContentsWithFrameAre (expected, _output, driver);
|
||||
win.Dispose ();
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -372,6 +372,6 @@ public class PosCenterTests (ITestOutputHelper output) : FakeDriverBase
|
||||
|
||||
_ = DriverAssert.AssertDriverContentsWithFrameAre (expected, _output, driver);
|
||||
win.Dispose ();
|
||||
driver.End ();
|
||||
driver.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user