mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Subview clean up * New Add/Remove event pattern * Using Logging * cleanup * Subview -> SubView * Test code cleanup. Killed many warnings. * Fix tznind feedback * Refactored AllViewTest helpers * Moved keyboard tests to parallel * Moved mouse tests to parallel * Moved view tests to parallel * Test code cleanup. Killed many warnings. * dupe test * Some mouse tests can't run in parallel because MouseGrabView * Made SpinnerView more testable * Moved more tests * SubViews to IReadOnlyCollection<View> * SubViews to IReadOnlyCollection<View> 2 * scrollbar tests * shortcut tests * Use InternalSubViews vs. _subviews * Nuked View.IsAdded. Added View.SuperViewChanged. * API doc updats * Unit Test tweak * Unit Test tweak
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using UnitTests;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Terminal.Gui.LayoutTests;
|
|
|
|
public class LayoutTests (ITestOutputHelper output) : TestsAllViews
|
|
{
|
|
[Theory]
|
|
[SetupFakeDriver] // Required for spinner view that wants to register timeouts
|
|
[MemberData (nameof (AllViewTypes))]
|
|
public void AllViews_Layout_Does_Not_Draw (Type viewType)
|
|
{
|
|
|
|
// Required for spinner view that wants to register timeouts
|
|
Application.MainLoop = new MainLoop (new FakeMainLoop (Application.Driver));
|
|
|
|
var view = (View)CreateInstanceIfNotGeneric (viewType);
|
|
|
|
if (view == null)
|
|
{
|
|
output.WriteLine ($"Ignoring {viewType} - It's a Generic");
|
|
|
|
return;
|
|
}
|
|
|
|
if (view is IDesignable designable)
|
|
{
|
|
designable.EnableForDesign ();
|
|
}
|
|
|
|
var drawContentCount = 0;
|
|
view.DrawingContent += (s, e) => drawContentCount++;
|
|
|
|
var layoutStartedCount = 0;
|
|
view.SubViewLayout += (s, e) => layoutStartedCount++;
|
|
|
|
var layoutCompleteCount = 0;
|
|
view.SubViewsLaidOut += (s, e) => layoutCompleteCount++;
|
|
|
|
view.SetNeedsLayout ();
|
|
view.SetNeedsDraw();
|
|
view.Layout ();
|
|
|
|
Assert.Equal (0, drawContentCount);
|
|
Assert.Equal (1, layoutStartedCount);
|
|
Assert.Equal (1, layoutCompleteCount);
|
|
}
|
|
}
|