Fixes #4374 - Nukes all (?) legacy Driver and Application stuff; revamps tests (#4376)

This commit is contained in:
Tig
2025-11-11 16:29:33 -07:00
committed by GitHub
parent 559dea9239
commit d53fcd7485
310 changed files with 14827 additions and 16911 deletions

View File

@@ -0,0 +1,57 @@
#nullable enable
using UnitTests;
using Xunit.Abstractions;
namespace UnitTests_Parallelizable.ViewsTests;
public class AllViewsDrawTests (ITestOutputHelper output) : TestsAllViews
{
[Theory]
[MemberData (nameof (AllViewTypes))]
public void AllViews_Draw_Does_Not_Layout (Type viewType)
{
IDriver driver = CreateFakeDriver ();
View? view = CreateInstanceIfNotGeneric (viewType);
if (view is 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);
}
}
}