-
Notifications
You must be signed in to change notification settings - Fork 725
Fixes #4374 - Nukes all (?) legacy Driver and Application stuff; revamps tests #4376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2_develop
Are you sure you want to change the base?
Conversation
Terminal.Gui v2 introduces a transformative redesign, simplifying the library's architecture and improving maintainability. Key changes include: - Added TrueColor support with 24-bit RGB handling. - Introduced `Adornment` framework for borders, padding, and margins. - Enhanced Unicode and wide character support for internationalization. - Added `LineCanvas` for drawing lines and shapes with box-drawing characters. - Simplified API by consolidating redundant methods and aligning with modern .NET standards. - Introduced `ConfigurationManager` for user-customizable themes and text styles. - Improved scrolling with `Viewport` and integrated `ScrollBar`. - Added new layout features like `Dim.Auto`, `Pos.AnchorEnd`, and `Pos.Align`. - Overhauled keyboard and mouse APIs for better input handling. - Introduced new views (e.g., `DatePicker`, `ColorPicker`, `GraphView`) and enhanced existing ones. - Added Sixel image support for rendering graphics in compatible terminals. - Ensured AOT compatibility for improved deployment and performance. This update lays the foundation for building modern, user-friendly terminal applications.
…_4374-AppScreenEmpty
Updated XML documentation in `FakeConsole.cs` to replace `<see cref="FakeDriver"/>` with `<exception cref="FakeDriver"></exception>` for clarity. Corrected a parameter name in `WindowsOutput.cs`'s `WriteConsole` method from `numberOfCharsToWritten` to `numberOfCharsToWrite` to fix a typo and improve readability.
Fix unix and fake fluent tests.
…_4374-AppScreenEmpty
Renamed the `EndAfterFirstIteration` property to `StopAfterFirstIteration` across the codebase for improved clarity. Updated its implementation to use a getter and setter that interact with the `ApplicationImpl.Instance` singleton for centralized management. Modified the `RunLoop` method to check the new `StopAfterFirstIteration` property. Updated the default value to `false` in the `Application` class. Added a private `_stopAfterFirstIteration` field and a corresponding public property in the `ApplicationImpl` class. Updated the `Run` method in `ApplicationImpl` to stop after the first iteration if the property is set to `true`, with appropriate logging. Updated the `IApplication` interface to include the `StopAfterFirstIteration` property and clarified the behavior of the `RequestStop` method. Revised XML documentation comments to reflect these changes.
Refactored `StopAfterFirstIteration` in `ApplicationImpl` to use an auto-property for simplicity. Updated `RunIteration` to call `view.RequestStop()` instead of modifying `view.Running`. Replaced references to `Application.EndAfterFirstIteration` with `Application.StopAfterFirstIteration` across the codebase, including `ITimedEvents`, `ApplicationTests`, and `GlobalTestSetup`. Added a new test, `InitRunShutdown_StopAfterFirstIteration_Stops`, to verify the application stops correctly after the first iteration. Updated related documentation and assertions for consistency.
The `ConsoleSizeMonitor` class was refactored to remove the `IOutputBuffer` parameter from its constructor, simplifying its dependencies. This change required updates across the codebase: - Updated `ComponentFactory<T>` and `FakeComponentFactory` to pass only `IConsoleOutput` to `ConsoleSizeMonitor`. - Modified `FakeApplicationFactory`, `GuiTestContext`, and `WindowSizeMonitorTests` to reflect the updated `ConsoleSizeMonitor` constructor. - Enabled nullable reference types in `FakeConsoleInput`. - Added an empty XML documentation comment to the `FakeOutput` constructor. - Removed redundant or unused code related to `IOutputBuffer`. These changes improve code maintainability and clarity by reducing unnecessary dependencies.
Refactored `ConsoleDriver` architecture to improve modularity, extensibility, and maintainability. Introduced `ConsoleDriverImpl` as the new base class for driver implementations, replacing legacy classes. Added platform-specific input/output classes (`NetConsoleInput`, `UnixConsoleInput`, `WindowsConsoleInput`, etc.) and their corresponding output implementations. Enhanced testability with mock drivers (`FakeConsoleDriver`, `FakeConsoleOutput`) and no-op input classes. Introduced `OutputBufferImpl` for efficient rendering with Unicode and terminal clipping support. Updated test infrastructure and removed deprecated classes. Improved code readability with modern C# features and updated documentation.
…_4374-AppScreenEmpty
Refactored `ConsoleDriverImpl` into `LegacyConsoleDriver` to improve code organization and maintainability. Updated all references to use the new class, including method calls, property checks, and event handling. Introduced the `LegacyConsoleDriver` class as an abstract base for `IConsoleDriver` implementations, consolidating shared functionality such as screen content management, cursor handling, and ANSI escape sequence processing. Updated the `IConsoleDriver` interface to align with these changes. Removed the `ConsoleDriverImpl` class entirely, migrating its functionality to `LegacyConsoleDriver`. Updated platform-specific drivers (`FakeConsoleDriver`, `NetConsoleInput`, `UnixConsoleInput`, etc.) to inherit from `LegacyConsoleDriver`. Revised unit tests to use `LegacyConsoleDriver.RunningUnitTests` and updated test assertions accordingly. Added nullable annotations to `LegacyConsoleDriver` for improved null safety. Cleaned up redundant code and documentation, ensuring consistency across the codebase.
Refactored the `SetupFakeDriverAttribute` class: - Enhanced the `Before` method with additional setup logic. - Updated the `After` method to reset application state. - Removed redundant `Before` method implementation. Updated `UnitTests.csproj`: - Excluded `Input\Mouse\**` files from compilation and resources. - Added `DEBUG_IDISPOSABLE` constant for debug builds. - Cleaned up redundant `<ItemGroup>` entries. These changes improve code maintainability and streamline the build process.
Replaced the `FakeConsoleDriver` with the new `LegacyFakeConsoleDriver` across the codebase, introducing improved functionality and structure. Updated all references in tests, attributes, and application logic to use the new driver. - Added `LegacyFakeConsoleDriver` with enhanced clipboard handling, screen updates, and cursor visibility management. - Replaced `SetupFakeDriver` with `SetupFakeApplication` for consistent test setup and teardown. - Removed the `FakeConsoleDriver` implementation entirely. - Updated test annotations, initialization, and assertions to align with the new driver. - Introduced `SetupFakeApplicationAttribute` for simplified test configuration. - Performed general code cleanup, improving modularity and maintainability.
Refactor and modernize driver and test architecture Refactored and removed legacy `LegacyConsoleDriver` logic, replacing it with streamlined event handling and the new `Application.RunningUnitTests` property. Updated `Application.Run` methods to simplify driver selection logic. Replaced `LegacyConsoleDriver` with `CreateFakeDriver()` across the codebase, modernizing driver initialization. Removed all references to `LegacyConsoleDriver`, including clipboard handling and screen size checks. Introduced `SetupFakeApplication` to streamline test setup and teardown. Updated test files to use these attributes, ensuring compatibility with the updated application lifecycle. Removed deprecated tests relying on legacy patterns. Enhanced test coverage with new test cases for components like `AddRuneTests`, `AnsiKeyboardParserTests`, `ConsoleKeyMappingTests`, and `MouseInterpreterTests`. Improved handling of edge cases, including wide and combining characters. Refactored namespaces for better modularity and clarity. Improved test readability with consistent formatting and inline data. Added detailed comments and documentation to aid maintainability. These changes modernize the architecture, improve test reliability, and align the codebase with updated application and driver frameworks.
|
Next step is to finish removing FakeConsoleDriver and [AutoInitShutdown]. |
|
I'd like to express that I preferred the names as they were before. But that's just my opinion. There's too much of the word "Console." My preference would be: DotNetDriver folder:
FakeDriver folder:
UnixDriver folder:
WindowsDriver folder:
Much more consistent and without long names. |
I'm gonna rename IConsoleDriver to IDriver too |
Refactored generic type parameters to improve clarity, replacing `T` with `TKeyInfo` across multiple classes and interfaces. Updated `ConcurrentQueue` types to align with the new parameter. Added `AddKeyEvent` method to enhance key event handling, enabling better unit testing. Simplified platform checks using modern C# patterns. Removed legacy `FakeConsole` and `LegacyFakeConsoleDriver` classes, along with redundant test attributes. Updated test cases to use the new `AddKeyEvent` method and re-enabled a previously skipped test. Performed extensive code cleanup, removing unused methods and modernizing constructs. Improved logging for better traceability. Fixed test issues related to `ReadKey` behavior. These changes enhance maintainability, testability, and overall code quality.
…akeConsoleInput` to reduce complexity. Updated `ApplicationImpl` to reflect these changes by adjusting `_coordinator` initialization. Key changes: - Removed `predefinedInput` parameter and `_predefinedInput` field from `FakeComponentFactory` and `FakeConsoleInput`. - Updated `Peek` and `Read` methods in `FakeConsoleInput` to handle the absence of predefined input. - Simplified `ScenarioTests` by removing the `Application.InitializedChanged` event handler.
|
Next:
|
Replaced `IConsoleDriver` with `IDriver` to unify and modernize the driver abstraction layer. Updated input, output, and size monitoring interfaces and implementations (`IInput`, `IOutput`, `ISizeMonitor`) for platform-agnostic handling. Introduced `DriverImpl` as the main driver implementation, integrating components like `IInputProcessor`, `IOutputBuffer`, and `AnsiRequestScheduler`. Refactored platform-specific input/output handling with new classes (`NetInput`, `UnixInput`, `WindowsInput`, `NetOutput`, `UnixOutput`) and added `FakeInput`/`FakeOutput` for testing. Enhanced testability with `ITestableInput` and updated test utilities (`GuiTestContext`, `DriverAssert`) to use the new abstractions. Removed legacy code (`IConsoleDriverFacade`, `IConsoleInput`, `IConsoleOutput`) and cleaned up unused methods and outdated logic. Updated XML documentation and logging for improved maintainability and debugging.
…_4374-AppScreenEmpty
This commit introduces significant improvements to logging, testability, and thread safety across the codebase. - **Logging Refactor**: - Replaced `Logging.Logger` calls with direct `Logging` calls. - Added granular logging levels (e.g., `Trace`, `Critical`). - Enhanced log clarity with detailed messages for key operations. - **Thread Safety Enhancements**: - Added thread-safe mechanisms (e.g., `lock` in `RunIteration`). - Improved cancellation token handling for clean shutdowns. - **Improved Testability**: - Introduced `ITestableInput` and `IOutput` interfaces. - Enhanced `GuiTestContext` with better logging and input simulation. - Removed hardcoded delays in tests for more deterministic behavior. - **Driver and I/O Updates**: - Added `GetName` to `IDriver` and `_driverName` to `DriverImpl`. - Refactored `FakeInput` and `FakeOutput` to align with new interfaces. - Added `GetCursorPosition` to `IOutput`. - **Bug Fixes and Code Cleanup**: - Fixed race conditions in input processing. - Removed unused code and improved readability. - **New Features**: - Added `ResizeConsole` to `GuiTestContext` for simulating resizing. - Improved test reliability with robust assertions. These changes collectively improve maintainability, reliability, and test coverage.
Fixes