mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Migrate 210 tests to UnitTests.Parallelizable, add CreateFakeDriver helper, prove View.Draw() works in parallel tests, and provide comprehensive performance analysis (#4297)
* Initial plan * Migrate Category A test files to UnitTests.Parallelizable (135 tests) Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add 11 ButtonTests to Parallelizable, remove from UnitTests Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add comprehensive test migration report Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add comprehensive performance analysis of UnitTests Co-authored-by: tig <585482+tig@users.noreply.github.com> * Migrate 2 Autocomplete tests and add Text tests analysis Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add proof-of-concept: TextFormatter.Draw works in parallel tests with local driver Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add CreateFakeDriver helper to ParallelizableBase and migrate 4 TextFormatterTests Co-authored-by: tig <585482+tig@users.noreply.github.com> * Remove proof-of-concept test from AutocompleteTests Co-authored-by: tig <585482+tig@users.noreply.github.com> * Move Scheme-accessing tests back to UnitTests to fix intermittent failures Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update parallel tests README to document ConfigurationManager/SchemeManager restrictions Co-authored-by: tig <585482+tig@users.noreply.github.com> * Document static member restriction in parallel tests README Co-authored-by: tig <585482+tig@users.noreply.github.com> * Restore accidentally deleted ButtonTests.Accept_Cancel_Event_OnAccept_Returns_True test Co-authored-by: tig <585482+tig@users.noreply.github.com> * Migrate Accept_Cancel_Event_OnAccept_Returns_True test to Parallelizable 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>
This commit is contained in:
44
Tests/UnitTestsParallelizable/Text/AutocompleteTests.cs
Normal file
44
Tests/UnitTestsParallelizable/Text/AutocompleteTests.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using TerminalGuiFluentTesting;
|
||||
using UnitTests;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Terminal.Gui.TextTests;
|
||||
|
||||
/// <summary>
|
||||
/// Pure unit tests for Autocomplete functionality that don't require Application or Driver.
|
||||
/// Integration tests for Autocomplete (popup behavior, rendering) remain in UnitTests.
|
||||
/// </summary>
|
||||
public class AutocompleteTests : UnitTests.Parallelizable.ParallelizableBase
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
public AutocompleteTests (ITestOutputHelper output)
|
||||
{
|
||||
_output = output;
|
||||
}
|
||||
[Fact]
|
||||
public void Test_GenerateSuggestions_Simple ()
|
||||
{
|
||||
var ac = new TextViewAutocomplete ();
|
||||
|
||||
((SingleWordSuggestionGenerator)ac.SuggestionGenerator).AllSuggestions =
|
||||
new () { "fish", "const", "Cobble" };
|
||||
|
||||
var tv = new TextView ();
|
||||
tv.InsertText ("co");
|
||||
|
||||
ac.HostControl = tv;
|
||||
|
||||
ac.GenerateSuggestions (
|
||||
new (
|
||||
Cell.ToCellList (tv.Text),
|
||||
2
|
||||
)
|
||||
);
|
||||
|
||||
Assert.Equal (2, ac.Suggestions.Count);
|
||||
Assert.Equal ("const", ac.Suggestions [0].Title);
|
||||
Assert.Equal ("Cobble", ac.Suggestions [1].Title);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user