mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-02-10 04:03:41 +01:00
v2_develop
33 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e9976da95e |
Reapply "Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop"
This reverts commit
|
||
|
|
845c05ff47 |
Revert "Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop"
This reverts commit |
||
|
|
7d6abe7026 | Fixed delist script | ||
|
|
6902e2f25a | neuterd script | ||
|
|
788f6a5e45 |
Auto publish Terminal.Gui templates (#4638)
* Initial plan * Update delist-nuget.ps1 to accept API key parameter and add repository dispatch to publish.yml Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update documentation for delist script and publish workflow Co-authored-by: tig <585482+tig@users.noreply.github.com> * Address code review feedback - refactor script and fix JSON payload Co-authored-by: tig <585482+tig@users.noreply.github.com> * Final refinements - simplify regex and use jq for safe JSON construction Co-authored-by: tig <585482+tig@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> |
||
|
|
027aec9dfe |
Refactor cleanup-agent.md: Claude performs steps manually
Update cleanup agent documentation to clarify that Claude performs cleanup steps manually (calling individual tools) rather than invoking CleanupAgent.ps1 as an orchestrator. Changes: - Mark CleanupAgent.ps1 as legacy/deprecated in docs - Remove redundant Examples section (commands already in tool reference) - Remove File Organization and Future Improvements sections - Condense ReSharper exception details from 38 lines to 3 lines - Rename "What CleanupAgent.ps1 did" to "Step Details" - Fix typos and grammar issues - Reduce document from ~292 to 185 lines Also fix PowerShell ternary syntax in CleanupAgent.ps1 exit statement. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
d4616eb582 | Progress. | ||
|
|
5bee1c18d5 |
Improve warning handling: attempt to fix instead of just rollback
- Changed bash code blocks to powershell in documentation - Added Get-BuildWarnings function to capture detailed warning info - Agent now attempts to fix build warnings by re-running ReSharper cleanup - Up to 2 fix attempts before rolling back - Outputs detailed warning info for diagnosis - Only rolls back if unable to fix after all attempts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
e1ce449ff5 |
Fix warning verification syntax and XML parsing
- Fixed extra closing brace syntax error - Added -Raw parameter to XML parsing (Get-Content) - Added --format=Xml to inspectcode command to get XML output instead of JSON/SARIF - Tested successfully with MessageBoxTests.cs Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
d2748734e9 |
Add warning verification to cleanup agent
- Track build warnings (compiler) and InspectCode warnings (ReSharper) - HARD RULE: No new build warnings allowed (fails and rolls back) - SOFT GOAL: InspectCode warnings should be reduced (reports but doesn't fail) - Added Get-BuildWarningCount function - Integrated warning checks into cleanup pipeline - Updated summary report to show warning deltas - Updated documentation in cleanup-agent.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
2524f1a32e |
Fix cleanup agent to process partial files through full pipeline
- After splitting, now processes each partial file through cleanup steps - Each partial gets: ReSharper cleanup, backing field reorder, nullable, CWP - Solution rebuild and tests run once after all partials are processed - Handles both split and non-split cases correctly - Preserves wasSplit flag for test failure handling Previously the agent would split files and stop, requiring manual processing. Now it completes the full cleanup pipeline as originally spec'd. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
a76ed76e7a |
Update cleanup agent with verified ReSharper CLI usage
- Document correct ReSharper cleanupcode command with --include parameter - Tested and verified: --include works correctly for single file cleanup - Update PowerShell script to pass FilePath parameter and use --include - Changed verbosity from ERROR to WARN for better visibility - Document observed exceptions in output (with honest assessment) - Note: Exceptions appear but command succeeds (exit code 0) - Update command examples to use WARN verbosity Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
f921f8f6b5 |
Add code cleanup automation agent and Roslyn tools
Introduces a modular code cleanup system for Terminal.Gui, including: - cleanup-agent.md: documentation for the new agent, usage, and best practices - CleanupAgent.ps1: orchestrator script for file splitting, ReSharper cleanup, backing field reordering, nullable directive management, CWP TODOs, and validation/testing - BackingFieldReorderer: Roslyn tool to move backing fields before their properties - PartialSplitter: Roslyn tool to split large files into semantic partials The system supports feature flags, robust error handling, and detailed reporting. Documentation covers limitations, troubleshooting, and future improvements. |
||
|
|
d1f90c107a |
Fixes #2668. Automate releases (#4556)
* Initial plan * Add automated release workflow and update documentation Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update release workflow to use gh CLI instead of deprecated action Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix tag creation order - tag should point to release commit Co-authored-by: tig <585482+tig@users.noreply.github.com> * Improve error messages and release notes formatting in workflow Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix release notes - package will be published, not has been published Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add updateAssemblyInfo and use env vars for heredoc safety Co-authored-by: tig <585482+tig@users.noreply.github.com> * Revert to original tag-then-commit order for consistency Co-authored-by: tig <585482+tig@users.noreply.github.com> * Delete deprecated Scripts/Release.ps1 file Co-authored-by: tig <585482+tig@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> |
||
|
|
07cee7174d |
Fixes #4471, #4474, #3714, #2588 - MASSIVE: Refactors Mouse, Adds ANSI driver, Enables Input Injection (#4472)
* Improve logging for debugging and error traceability
Enhanced logging across multiple classes to improve observability:
- Added debug log for `OperationCanceledException` in `MainLoopCoordinator<TInputRecord>`.
- Logged mouse event details in `MouseImpl` for better event tracking.
- Added trace log in `InputImpl<TInputRecord>` to indicate input availability.
- Replaced `LogInformation` with `Logging.Information` in `WindowsInput`.
- Logged detailed error information for console input failures in `WindowsInput`.
These changes enhance maintainability and debugging capabilities.
* Fixed warnings
* Refactored `MouseHeldDown` to support accelerating timeouts for
continuous actions like auto-scrolling. Enhanced `IMouseHeldDown`
to include richer event data and updated `Start` to accept
`MouseEventArgs`. Removed `MouseGrabHandler` and integrated its
functionality into `MouseHeldDown` and `MouseImpl`.
Streamlined mouse event handling in `View` by introducing lazy
instantiation of `MouseHeldDown` and replacing legacy methods
with `RaiseCommandsBoundToButtonClickedFlags` and
`RaiseCommandsBoundToWheelFlags`. Removed the `MouseWheel` event
and transitioned wheel handling to the command-binding system.
Improved `MouseBindings` to convert "pressed" events to "clicked"
events for better command invocation. Updated `TimedEvents` to
ensure proper handling of scheduled timeouts.
Refactored `MouseTests` to align with the new `MouseHeldDown`
implementation. Removed redundant code in `Button` and performed
general cleanup and documentation updates for better
maintainability.
* WIP: Refactor MouseFlags and improve mouse event handling
- Introduced semantic aliases for `MouseFlags` to improve readability.
- Enhanced XML documentation for `MouseFlags` and related enums.
- Refactored `MouseHeldDown` to improve type safety and add detailed logging.
- Updated `View.Mouse.cs` to handle mouse events more consistently.
- Changed default mouse bindings to use semantic aliases (e.g., `LeftButtonClicked`).
- Removed redundant and excessive logging across multiple files.
- Updated `Button` class and test cases to align with new mouse flag aliases.
- Improved handling of continuous button presses and mouse grab logic.
* WIP: Big code cleanup and reorg of Mouse processing helpers.
* WIP: Add comprehensive driver/input/output unit tests
Introduces a broad suite of new xUnit tests for Terminal.Gui's driver, input, and output subsystems under the DriverTests namespace. Tests cover keyboard mapping, mouse click detection, input processing (including Unicode/surrogate pairs), and output buffer behavior. Includes edge cases for modifiers, wide/combining characters, and mouse event quirks. Some tests document known limitations or are marked as skipped for future investigation. This significantly increases test coverage and documents both expected and legacy behaviors.
* New arch
* WIP: Implement timestamp-based multi-click detection with pending clicks
Added Timestamp property to MouseEventArgs. Refactored MouseButtonClickTracker and MouseInterpreter to use event timestamps. Updated all test constructors. MouseButtonClickTrackerTests: 17/17 passing. MouseInterpreterExtendedTests: 9/18 passing (9 need deferred-click assertion updates).
* Add implementation summary for timestamp-based multi-click detection
* WIP:
* Almost working - Geting single and double clicks but at least single works.
* Made MouseEventArgs.Position nullable to indicate it might not be set.
* MouseEventArgs -> Mouse
* API docs
* Renames.
* Code clean up and deep dive
* Docs
* tests
* More analysis
* fxied some tests
* Massive mouse nameing cleanup
* HighlightStates rename and code cleanup
* More renames
* Disabled broken tests with Skip = "Broken in #4474"
* Commented legacy
* Phase 2
* Add testable input and debug/test suite for UnixInput
Implemented ITestableInput<char> in UnixInput, enabling injection of synthetic keyboard and mouse events for robust unit testing. Overrode EnqueueKeyDownEvent and EnqueueMouseEvent in UnixInputProcessor to inject ANSI sequences for keys and mouse actions. Added comprehensive unit and debug tests for input injection, event sequencing, and ANSI code mapping. Included detailed driver input/output analysis documentation comparing all drivers and their use of native APIs and ANSI infrastructure. These changes greatly improve testability and cross-platform input simulation.
* Add AnsiKeyboardEncoder/MouseEncoder and related tests
Introduce AnsiKeyboardEncoder and AnsiMouseEncoder utility classes to convert Key and Mouse objects to ANSI escape sequences, enabling round-trip testing and input injection. Refactor UnixInputProcessor to use these encoders, removing legacy conversion methods. Add comprehensive AnsiKeyboardEncoderTests and remove obsolete MouseToAnsiDebugTests. Minor formatting improvements in AnsiKeyboardParser. These changes improve modularity and testability of ANSI input handling.
* merged
* Enabled previously skpped tests. STuff is broke
* updates transparent shadow test
* Refactor Fake driver to use pure ANSI char stream
Refactored the Fake (mock) driver to operate as a true ANSI driver using a char stream for input and output, replacing the previous ConsoleKeyInfo-based model. FakeInput now implements IInput<char> and ITestableInput<char>, reading raw bytes from Console.OpenStandardInput(), decoding as UTF-8, and parsing ANSI escape sequences for keyboard and mouse events. FakeInputProcessor is updated to process char streams and integrates with the ANSI parser infrastructure, supporting EnqueueKeyDownEvent and EnqueueMouseEvent via ANSI encoding.
FakeOutput now writes ANSI escape sequences directly to the console (if available) and maintains an internal buffer for test verification, supporting both 16-color and true-color output. All related tests and helpers are updated to use char-based input buffers and ScreenPosition for mouse events. Added a new FakeInputTestableTests.cs file for comprehensive testing of the ITestableInput<char> implementation.
Also updated launchSettings.json to add a "UICatalog --driver fake" profile. This modernizes the Fake driver for more realistic testing and compatibility with real ANSI terminals.
* Add platform raw mode support to FakeInput (Unix/Win)
Enables and restores terminal raw mode on Unix/Mac using termios
(P/Invoke), and enables Virtual Terminal Input mode on Windows
using Console API. Original terminal settings are restored on
shutdown. Updates class documentation to clarify platform-specific
behavior and limitations. Improves FakeInput for real ANSI input
on Unix-like systems and enhances Windows support, though with
noted caveats.
* Refactor FakeDriver: true ANSI/VT, platform helpers, size
- Introduce UnixRawModeHelper and WindowsVTInputHelper for robust, cross-platform raw/VT input handling.
- Refactor FakeInput and FakeOutput to use real ANSI/VT sequences, alternate buffer, and proper terminal state management.
- Add FakeSizeMonitor for ANSI-based terminal size detection using escape sequences and async response handling.
- Enhance ISizeMonitor with Initialize(driver) for post-construction setup.
- MainLoopCoordinator now initializes size monitor after driver construction.
- Update and clarify tests for ANSI/VT limitations and mouse/key round-tripping.
- OutputBase.ToAnsi emits plain text for legacy consoles.
- Add launch profiles for Fake driver on Windows and WSL.
- General code cleanup, improved comments, and platform separation.
* Unify ANSI key conversion for Unix and test drivers
Replaced UnixKeyConverter with new AnsiKeyConverter, consolidating ANSI char-to-Key mapping for both Unix and FakeInput drivers. Updated processors to use AnsiKeyConverter, removed UnixKeyConverter, and improved documentation for clarity. Reformatted WindowsVTInputHelper for consistency. This refactor ensures consistent, cross-platform ANSI input handling and reduces code duplication.
* Introduce DriverRegistry: type-safe, AOT-friendly driver system
Adds DriverRegistry for centralized, reflection-free driver discovery and selection. Refactors Application and driver factories to use registry-based logic and type-safe constants. Removes legacy string-based and reflection-based driver selection. Updates docs, tests, and schema for new pattern. Enables custom driver registration and improves AOT compatibility.
* Rename Fake driver to ANSI driver throughout codebase
Refactored all code, tests, docs, and configs to replace the "Fake" driver with the "ANSI" driver. This includes renaming all related classes, files, registry constants, and test helpers (e.g., FakeInput → ANSIInput, FakeOutput → ANSIOutput, etc.), and updating all references in documentation and configuration. No functional changes were made; this is a naming and documentation update to clarify that the ANSI driver is a real, cross-platform ANSI escape sequence driver suitable for both testing and actual use. The FakeClipboard utility remains unchanged.
* Rename ANSI* classes to Ansi* and update docs/references
Renamed ANSIInput, ANSIInputProcessor, ANSIOutput, and ANSISizeMonitor to AnsiInput, AnsiInputProcessor, AnsiOutput, and AnsiSizeMonitor for .NET naming consistency. Updated all references, type checks, and XML docs accordingly. Removed the "Extending the Driver System" section from drivers.md, including custom driver registration and implementation examples. No functional changes; this is a naming and documentation refactor.
* Merged and fixed warnings.
* Refine mouse click handling for UI controls
Standardize mouse interactions across controls: single left clicks now activate items (not accept), while double-clicks trigger accept actions. Removed or replaced default single-click bindings to prevent accidental state changes, especially in CheckBox and ColorBar. Improved movement and activation logic in ColorPicker16. These changes make mouse behavior more deliberate and consistent throughout the UI.
* deleted
* No changes detected
No code modifications were made in this commit.
* Rename Enqueue* APIs to Inject*; enhance ANSI key encoding
Renames all Enqueue* input injection APIs and test helpers to Inject* for clarity and consistency (e.g., EnqueueKeyEvent → InjectKeyEvent, AddInput → InjectInput). Updates all interfaces, implementations, and test usages accordingly. Improves AnsiKeyboardEncoder to support correct ANSI escape sequences for function/navigation keys with Shift, Ctrl, and Alt modifiers, including new helper methods and extensive new unit tests for modifier handling and round-trip parsing. Adds ApplicationKeyboardTests to verify integration of injected key events with the application and view event pipeline. Introduces InputTestHelpers for simulating input threads in tests. Updates documentation and comments to reflect new terminology. Refactors and clarifies related unit tests, and marks some as skipped due to known issues. Includes minor code cleanups and formatting improvements.
* Add comprehensive mouse event pipeline tests
Added ApplicationMouseTests.cs to thoroughly test the mouse event pipeline, including injection, ANSI encoding/decoding, input queue processing, and event routing through IApplication.Mouse and View.MouseEvent. Tests cover event propagation, flag and modifier handling, event ordering, mouse enter/leave, mouse state tracking, and disabled mouse scenarios.
Also added InjectAndProcessMouse helper methods to InputTestHelpers to streamline mouse event injection and processing in tests. These changes ensure robust automated coverage of mouse event handling throughout the application's input system.
* lame progress
* Add input injection redesign and fix click threshold bug
Introduce driver-input-injection-redesign.md, detailing a proposed overhaul of Terminal.Gui's input injection and testing architecture. The redesign includes a virtual time system, unified input injection API, refactored input/test architecture, simplified test helpers, and improved integration test support. A migration path and benefits summary are provided.
Add driver-input-injection.md to document the current input injection system, its architecture, and pain points, serving as a baseline for the redesign.
Fix a bug in MouseButtonClickTracker by changing the click threshold comparison from '>' to '>=' for correct double-click detection.
Update Button.OnMouseHoldRepeatChanged to properly manage mouse bindings when toggling hold repeat.
Apply minor formatting and #nullable directive adjustments in Button.cs.
Update ApplicationMouseTests.cs and InputTestHelpers.cs for consistent object initialization and clearer timestamp handling in mouse event injection.
These changes lay the foundation for a more robust, testable, and maintainable input system in Terminal.Gui.
* update input injection spec
Updated driver-input-injection-redesign.md with a comprehensive, implementation-ready specification: added an "AI Agent Prompt," expanded rationale and constraints, provided explicit coding standards, and included a detailed step-by-step implementation checklist. Clarified migration path, success criteria, and the status of disabled tests. The spec now fully supports the upcoming input injection redesign and test migration.
Marked mouse/keyboard input tests as skipped due to #4474, disabling them in ButtonTests, ScrollBarTests, OptionSelectorTests, and GuiTestContextMouseEventTests. Reformatted object initializations in ButtonTests for coding standards compliance.
* Revise mouse behavior specification for clarity
Updated the mouse behavior specification to clarify design principles, button types, and event handling. Added details on ClickCount, MouseHoldRepeat, and visual feedback for buttons.
* Initial plan
* Add core time abstraction and input source interfaces
- Created ITimeProvider, SystemTimeProvider, and VirtualTimeProvider
- Created IInputSource, TestInputSource, and ConsoleInputSource
- Created InputEventRecord types (keyboard, mouse, ANSI)
- All code follows Terminal.Gui coding standards
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add Input Injector infrastructure
- Created IInputInjector interface with injection modes
- Created InputInjector implementation
- Created InputInjectionExtensions for convenience methods
- Defined InputEvent, KeyEvent, and MouseEvent for sequences
- Integrated with existing IInputProcessor interface
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update core components to use ITimeProvider
- Updated MouseInterpreter to use ITimeProvider instead of Func<DateTime>
- Updated MouseButtonStateEx to use ITimeProvider
- Updated AnsiResponseParserBase to use ITimeProvider
- All components now support virtual time for testing
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add validation tests for VirtualTimeProvider
- Created comprehensive tests for virtual time functionality
- Tests verify time advancement, delays, and timers
- All 7 tests passing successfully
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix code review feedback - capitalize Copilot comments
- Fixed capitalization of "CoPilot" to "Copilot" in test comments
- Addressing code review feedback
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed bug
* Fix merge conflicts and adapt to v2_4471-Continuous refactoring
- Updated MouseInterpreter to use ITimeProvider instead of Func<DateTime>
- Updated MouseButtonClickTracker to use ITimeProvider
- Changed MouseEventArgs references to Mouse class
- Updated InputInjector to use current IInputProcessor method names (InjectKeyDownEvent, InjectMouseEvent, RaiseMouseEventParsed, RaiseSyntheticMouseEvent)
- Fixed XML documentation warnings
- Build succeeds with 0 errors
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add FuncTimeProvider and update tests for ITimeProvider compatibility
- Created FuncTimeProvider helper class to wrap Func<DateTime> for backward compat
- Updated all mouse-related tests to use FuncTimeProvider
- Fixed 45+ test instances that were using lambda expressions
- All 7 VirtualTimeProvider tests passing
- Tests build successfully with 0 errors
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add comprehensive tests for ANSI driver, input, and OSC 8
Introduced new xUnit test files covering the Terminal.Gui ANSI handling layer, including driver, input, parser, encoder, and OSC 8 hyperlinking. Tests verify keyboard and mouse parsing, driver resizing and buffer logic, clipboard, request/response scheduling, and robust URL hyperlink wrapping. All tests are parallelizable, cover edge cases, and improve maintainability of the ANSI infrastructure.
* Fixed namespace
* Fix: Update file name casing for ANSI driver files
* Refactor: add low-level driver tests and test base class
Adds comprehensive low-level and unit tests for Terminal.Gui's driver infrastructure, covering ANSI, Unix, .NET, and Windows backends. Tests include input/output construction, buffer handling, key/mouse event injection, and Unicode/wide character rendering. Introduces OutputBufferWideCharTests for #4466, and TestDriverBase for reusable test driver setup. All tests use xUnit and are organized for platform-specific execution, improving coverage and reliability of driver internals.
* disbled test that fails in GH runners sometimes.
* Phase 5 Part 1: Add ITimeProvider and test mode to Application layer
- Updated Application.Create() to accept optional ITimeProvider parameter
- Added Application.CreateForTesting() factory method with VirtualTimeProvider
- Updated ApplicationImpl constructor to accept ITimeProvider and testMode
- Added GetTimeProvider() method to IApplication interface
- Added GetTimeProvider() implementation in ApplicationImpl
- Build succeeds with 0 errors
Next: Pass ITimeProvider to components (MouseInterpreter, AnsiResponseParser) and wire up TestInputSource in test mode
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Phase 5 Part 2: Wire ITimeProvider through InputProcessor and AnsiResponseParser
- Updated InputProcessorImpl to accept ITimeProvider and pass to MouseInterpreter and AnsiResponseParser
- Updated all derived InputProcessors (Net, Windows, Unix, ANSI) to accept and forward ITimeProvider
- Updated AnsiResponseParserBase to accept ITimeProvider and use it instead of DateTime.Now
- Updated AnsiResponseParser<T> and AnsiResponseParser to pass ITimeProvider to base class
- Build succeeds with 0 errors
Next: Update component factories to accept and pass ITimeProvider, then wire up TestInputSource in test mode
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix build errors - add ITimeProvider to test instantiations
- Updated TestDriverBase to pass SystemTimeProvider to AnsiResponseParser and AnsiInputProcessor
- Fixed all test files to pass ITimeProvider (or null) to InputProcessor constructors
- Fixed AnsiResponseParser instantiations in test files to include SystemTimeProvider
- Updated AnsiResponseParserTests class fields and method instantiations
- Build succeeds with 0 errors
- All 7 VirtualTimeProvider tests pass
- All 15 MouseInterpreter tests pass
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Code cleanup.
* warnings
* Phase 5 Part 3: Wire ITimeProvider through component factories
- Updated IComponentFactory.CreateInputProcessor() to accept optional ITimeProvider parameter
- Updated ComponentFactoryImpl abstract class with new signature
- Updated all factory implementations (Ansi, Net, Unix, Windows) to pass ITimeProvider to InputProcessors
- Updated MainLoopCoordinator to accept and pass ITimeProvider to factory
- Updated ApplicationImpl.CreateSubcomponents to pass ITimeProvider to MainLoopCoordinator
- Fixed ApplicationImplTests mock setup for optional parameter in expression tree
- Build succeeds with 0 errors
- All 7 VirtualTimeProvider tests pass
Phase 5 complete: ITimeProvider now fully wired through application layer
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Phase 5 Complete + Phase 6: Input injection examples
Phase 5 completion:
- Added IApplication.GetInputInjector() method
- Added ApplicationImpl.GetInputInjector() implementation
- Added Application.CreateForTesting() factory method
- All infrastructure now complete and wired
Phase 6: Example tests demonstrating simplified API
- Created 7 comprehensive example tests showing new API benefits
- Examples cover: simple injection, virtual time, sequences, combinations, timing
- All 7 tests passing
- Tests demonstrate 60-70% code reduction vs old 3-step pattern
- Examples show deterministic, fast testing without Thread.Sleep
Build: ✅ 0 errors
Tests: ✅ 7/7 example tests passing, 7/7 VirtualTimeProvider tests passing
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Port GuiTestContext to use new input injection infrastructure
- Updated GuiTestContext to use VirtualTimeProvider for deterministic time control
- Ported InjectKeyEvent to use app.InjectKey() (new simplified API)
- Ported InjectMouseEvent to use app.InjectMouse() (new simplified API)
- Updated mouse timestamps to use virtual time instead of DateTime.Now
- Added TimeProvider property to expose VirtualTimeProvider for advanced test scenarios
- Added new ApplicationImpl constructor accepting IComponentFactory, ITimeProvider, and testMode
- All GuiTestContext tests pass (24/24 basic, 59/60 key events, 12/12 mouse events)
- Tests now benefit from virtual time control for deterministic, fast testing
Benefits:
- Tests execute with deterministic time - no more Thread.Sleep
- Virtual time allows testing time-dependent features (double-click, timeouts)
- Simplified injection API reduces test complexity
- Backward compatible - existing tests continue to work
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix GetTimeProvider extension method to delegate to interface
Fixed issue where InputInjectionExtensions had duplicate GetTimeProvider/GetInputInjector extension methods that conflicted with interface methods. Removed duplicates and kept only the convenience extension methods (InjectKey, InjectMouse, InjectSequence).
Note: 14 Menu/MenuBar tests are failing but these appear to be pre-existing issues not caused by the GuiTestContext porting. Tests were passing at commit
|
||
|
|
171a26a350 |
Removes the v1 Menu stuff. Preps for #4148 (#4402)
|
||
|
|
a6258ed398 |
Updates IListDataSource.Render to rename the start parameter to viewportXOffset (#4392)
* Add comprehensive unit tests for WindowsKeyConverter - Implement 118 parallelizable unit tests for WindowsKeyConverter - Cover ToKey and ToKeyInfo methods with full bidirectional testing - Test basic characters, modifiers, special keys, function keys - Test VK_PACKET Unicode/IME input - Test OEM keys, NumPad keys, and lock states - Include round-trip conversion tests - All tests passing successfully Fixes #4389 * Rename `start` parameter to `viewportXOffset` for clarity The `start` parameter in several methods and interfaces has been renamed to `viewportXOffset` to better reflect its purpose as the horizontal offset of the viewport during string rendering. - Updated method signatures in `ListViewWithSelection` to use `viewportXOffset` instead of `start`, including default values. - Modified the `RenderUstr` method in `ListViewWithSelection` to use `viewportXOffset` for calculating the starting index. - Renamed the `start` parameter to `viewportXOffset` in the `IListDataSource` interface and updated its documentation. - Replaced all occurrences of `start` with `viewportXOffset` in the `ListWrapper<T>` class, including method calls and logic. - Updated the `RenderUstr` method in `ListWrapper<T>` to use `viewportXOffset` for substring calculations. - Adjusted the test method in `ListViewTests.cs` to reflect the parameter name change. These changes improve code readability and make the parameter's role in rendering logic more explicit. * Remove WindowsKeyConverterTests class that was added by mistake * Modernized ListView and IListDataSource - Tons of new unit tests Refactored `ListView` and `IListDataSource` to improve readability, maintainability, and functionality. Introduced `ListWrapper<T>` as a default implementation of `IListDataSource` for easier integration with standard collections. Enhanced `ListView` with better handling of marking, selection, and scrolling. Replaced `viewportXOffset` with `viewportX` for horizontal scrolling. Added `EnsureSelectedItemVisible` to maintain visibility of the selected item. Updated `IListDataSource` with detailed XML documentation and added `SuspendCollectionChangedEvent` for bulk updates. Improved null safety with nullable reference types. Added comprehensive unit tests for `ListWrapper<T>` and `IListDataSource` to ensure robustness. Modernized the codebase with C# features like expression-bodied members and pattern matching. Fixed bugs related to `SelectedItem` validation and rendering artifacts. * Improve index validation in ComboBox and ListView Enhance robustness by adding stricter checks for valid indices in ComboBox and ListView. Updated conditions in the `_listview.SelectedItemChanged` event handler to ensure `e.Item` is non-negative before accessing `_searchSet`. Modified the `SetValue` method to use `e.Item` instead of `_listview.SelectedItem`. In ListView, updated the `OnSelectedChanged` method to validate that `SelectedItem` is non-negative (`>= 0`) before accessing the `Source` list. These changes prevent potential out-of-range errors and improve code safety. * Refactor and enhance test coverage across modules Refactored and added new tests to improve coverage, readability, and consistency across multiple test files. Key changes include: - **ShortcutTests.cs**: Added tests for `BindKeyToApplication` and removed redundant tests. - **SourcesManagerTests.cs**: Renamed `Update_*` tests to `Load_*` for clarity. - **ArrangementTests.cs**: Reintroduced `MouseGrabHandler` tests, added `ViewArrangement` flag tests, and improved structure. - **NeedsDrawTests.cs**: Replaced `Application.Screen.Size` with fixed dimensions for better isolation. - **DimAutoTests.cs**: Updated layout tests to use fixed dimensions. - **FrameTests.cs**: Standardized object initialization and validated frame behavior. - **SubViewTests.cs**: Improved formatting and modernized event handling. - **NumericUpDownTests.cs**: Decoupled layout tests from screen size. General improvements: - Enhanced formatting and removed redundant tests. - Added comments for clarity. - Introduced `ITestOutputHelper` for better debugging in `ArrangementTests`. * Refactor to use nullable types for better null safety Enabled nullable reference types across the codebase to improve null safety and prevent potential null reference issues. Refactored `SelectedItem` and related properties from `int` to `int?` to represent no selection with `null` instead of `-1`. Updated logic, event arguments, and method signatures to handle nullable values consistently. Simplified object initialization using modern C# syntax and improved code readability with interpolated strings. Added null checks and early returns to prevent runtime errors. Enhanced error handling by throwing `ArgumentOutOfRangeException` for invalid values. Updated tests to reflect the changes, replacing assertions for `-1` with `null` and ensuring proper handling of nullable values. Cleaned up redundant code and improved formatting for better maintainability. * on` functionality has been deprecated, refactored, or removed from the `Shortcut` class. * Refactor: Transition to instance-based architecture Updated `Run-LocalCoverage.ps1` to increase `--blame-hang-timeout` from 10s to 60s. Improved null safety in `GuiTestContext` by adding null-conditional operators. Commented out problematic code in `SetupFakeApplicationAttribute.cs` to prevent test hangs. Excluded `ViewBase` files from `UnitTests.Parallelizable.csproj` and removed redundant folder declarations. Simplified event handling in `IListDataSourceTests.cs` and updated `ListViewTests.cs` to use nullable reference types. Enhanced documentation to emphasize the transition to an instance-based application architecture. Updated examples in `application.md`, `multitasking.md`, and `navigation.md` to reflect the use of `Application.Create()` and `View.App`. Clarified the obsolescence of the static `Application` class. Revised table of contents in `toc.yml` to include new sections like "Application Deep Dive" and "Scheme Deep Dive." Added `dotnet-tools.json` for tool configuration. These changes improve maintainability, testability, and alignment with modern C# practices. * Refactor ListViewTests to use Terminal.Gui framework The `ListViewTests` class has been refactored to replace the `AutoInitShutdown` attribute with explicit application lifecycle management using `IApplication` and `app.Init()` from the `Terminal.Gui` framework. Key changes include: - Rewriting tests to use `Terminal.Gui`'s application lifecycle. - Adding a private `_output` field for logging test output via `ITestOutputHelper`. - Updating `DriverAssert.AssertDriverContentsWithFrameAre` to include `app.Driver` for UI verification. - Rewriting tests like `Clicking_On_Border_Is_Ignored`, `EnsureSelectedItemVisible_SelectedItem`, and others to align with the new framework. - Adding explicit calls to `app.Shutdown()` for proper cleanup. - Enabling nullable reference types with `#nullable enable`. - Updating `using` directives and `namespace` to reflect the new structure. These changes improve test maintainability, compatibility, and diagnostics. * Update Terminal.Gui/Views/CollectionNavigation/CollectionNavigatorBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Terminal.Gui/Views/CollectionNavigation/CollectionNavigatorBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Examples/UICatalog/UICatalogTop.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Terminal.Gui/Views/ListWrapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Terminal.Gui/Views/ListWrapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Updated the `SetMark` method to return `Source.IsMarked(SelectedItem.Value)` for consistency and removed an outdated comment questioning its correctness. Enhanced the exception message in the `SelectedItem` property setter to provide clearer guidance when the value is out of range. * Add comprehensive ListView behavior test coverage Added multiple test methods to validate `ListView` behavior: - `Vertical_ScrollBar_Hides_And_Shows_As_Needed`: Ensures the vertical scrollbar auto-hides/shows based on content height. - `Mouse_Wheel_Scrolls`: Verifies vertical scrolling with the mouse wheel updates `TopItem`. - `SelectedItem_With_Source_Null_Does_Nothing`: Confirms no exceptions occur when setting `SelectedItem` with a `null` source. - `Horizontal_Scroll`: Tests horizontal scrolling, including programmatic and mouse wheel interactions, ensuring `LeftItem` updates correctly. - `SetSourceAsync_SetsSource`: Validates the asynchronous `SetSourceAsync` method updates the source and item count. - `AllowsMultipleSelection_Set_To_False_Unmarks_All_But_Selected`: Ensures disabling multiple selection unmarks all but the selected item. - `Source_CollectionChanged_Remove`: Confirms `SelectedItem` and source count update correctly when items are removed from the source collection. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
d53fcd7485 | Fixes #4374 - Nukes all (?) legacy Driver and Application stuff; revamps tests (#4376) | ||
|
|
fe18c81dc9 | Fixed gitversion | ||
|
|
b0f32811eb |
Fixes #3930 - Splits tests to Tests/UnitTests, Tests/IntegrationTests, Tests/StressTests (#3954)
* Tons of API doc updates * Removed stale test * Removed stale tests * Fixed Skipped Shadow test 1 * Fixed Skipped Shadow test 2 * Fixed Skipped Shadow test 3 * Removed stale test * Removed stale test2 * Explicit unregister of event handler on Application.Driver!.ClearedContents * Added Toplevels to dict * code cleanup * spelling error * Removed stale test3 * Removed stale test4 * Removed stale test5 * added script * tweaked script * tweaked script * Created StressTests project; moved some tests * Created IntegrationTests project; moved some tests * New yml * made old yml just unit tests * Tweaked Button_IsDefault_Raises_Accepted_Correctly * tweaked script * cleaned up ymls * tweakled up ymls * stress tests... * stress tests on ubuntu only * Fixed WindowsDriver in InvokeLeakTest * Fixed WindowsDriver in InvokeLeakTest2 * Added Directory.Packages.props. Added Directory.Build.props * Shortened StressTest time * Removed dupe file. * DemoFiles * Moved all tests to ./Tests dir. * Fixed release build issue * Fixed .sln file * Fixed .sl* files * Fixing ymls * Fixing interation tests * Create link to the file TestHelpers. * Created Tests/UnitTestsParallelizable. Moved all obviously parallelizable tests. Updated yml. * fixing logs * fixing logs2 * fixing logs3 * don't require stress to pass for PRs * Fix a failure? * tweaked script * Coudl this be it? * Moved tons of tests to parallelizable * Fixed some stuff * Script to find duplicate tests * Testing workflows * Updated to v4 * Fix RelativeBasePath issue * Replace powershell to pwsh * Add ignore projects. * Removed dupe unit tests * Code cleanup of tests * Cleaned up test warnings * yml tweak * Moved setter * tweak ymls * just randomly throwing spaghetti at a wall * Enable runing 5 test runners in par * Turned off DEBUG_DISPOSABLE for par tests * RunningUnitTests=true * code cleanup (forcing more Action runs) * DISABLE_DEBUG_IDISPOSABLE * Added View.DebugIDisposable. False by default. * Remobed bogus tareet * Remobed bogus tareet2 * fixed warning * added api doc * fixed warning * fixed warning * fixed warning2 * fixed warning3 * fixed warning4 --------- Co-authored-by: BDisp <bd.bdisp@gmail.com> |
||
|
|
e7a784b27c | Moved scripts | ||
|
|
6b72b3f56b | Remove PowerShell module for analyzers | ||
|
|
9372cce69c | Fixed Scenario tests | ||
|
|
ae630fc181 | Nuke prompt alteration on module load and unload #3464 | ||
|
|
f49002e4e0 | Change file name casing to fix builds on linux | ||
|
|
6c9fef58c3 | Better path handling for Open-Solution and Build-Analyzers | ||
|
|
c5c7f4f463 |
Some improvements to the powershell modules
Make open-solution more reliable. Add some variables that will get used various other places |
||
|
|
9a6c12d2ae | Add README.md for Scripts directory | ||
|
|
8cb748e452 | Reorganized, simplified, and standardized PowerShell modules. | ||
|
|
b9b68ba1a6 | Re-structured and formalized the scripts and modules. | ||
|
|
683c087537 | Add manifest for powershell module | ||
|
|
9682b4d6e9 | Add PowerShell module for convenient analyzer rebuilds | ||
|
|
fe5d51d71c | Standard MIT license text |