mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Initial plan * Phase 1: Update IConsoleDriver.Init() to return void instead of MainLoop Co-authored-by: tig <585482+tig@users.noreply.github.com> * Phase 2: Remove legacy MainLoop infrastructure Co-authored-by: tig <585482+tig@users.noreply.github.com> * Complete Phase 1 and Phase 2 - All tests pass Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update deep dive docs to reflect MainLoop removal 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> Co-authored-by: Tig <tig@users.noreply.github.com>
59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
using UnitTests;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace UnitTests.LayoutTests;
|
|
|
|
public class AllViewsDrawTests (ITestOutputHelper output) : TestsAllViews
|
|
{
|
|
[Theory]
|
|
[SetupFakeDriver] // Required for spinner view that wants to register timeouts
|
|
[MemberData (nameof (AllViewTypes))]
|
|
public void AllViews_Draw_Does_Not_Layout (Type viewType)
|
|
{
|
|
Application.ResetState (true);
|
|
// Required for spinner view that wants to register timeouts
|
|
|
|
var view = (View)CreateInstanceIfNotGeneric (viewType);
|
|
|
|
if (view == null)
|
|
{
|
|
output.WriteLine ($"Ignoring {viewType} - It's a Generic");
|
|
|
|
return;
|
|
}
|
|
|
|
output.WriteLine ($"Testing {viewType}");
|
|
|
|
if (view is IDesignable designable)
|
|
{
|
|
designable.EnableForDesign ();
|
|
}
|
|
|
|
var drawCompleteCount = 0;
|
|
view.DrawComplete += (s, e) => drawCompleteCount++;
|
|
|
|
var layoutStartedCount = 0;
|
|
view.SubViewLayout += (s, e) => layoutStartedCount++;
|
|
|
|
var layoutCompleteCount = 0;
|
|
view.SubViewsLaidOut += (s, e) => layoutCompleteCount++;
|
|
|
|
view.SetNeedsLayout ();
|
|
view.Layout ();
|
|
|
|
Assert.Equal (0, drawCompleteCount);
|
|
Assert.Equal (1, layoutStartedCount);
|
|
Assert.Equal (1, layoutCompleteCount);
|
|
|
|
if (view.Visible)
|
|
{
|
|
view.SetNeedsDraw ();
|
|
view.Draw ();
|
|
|
|
Assert.Equal (1, drawCompleteCount);
|
|
Assert.Equal (1, layoutStartedCount);
|
|
Assert.Equal (1, layoutCompleteCount);
|
|
}
|
|
}
|
|
}
|