Files
Terminal.Gui/UnitTests/View/Draw/DrawEventTests.cs
2025-03-01 15:22:23 -07:00

33 lines
869 B
C#

#nullable enable
using System.Text;
using Xunit.Abstractions;
namespace Terminal.Gui.ViewTests;
[Trait ("Category", "Output")]
public class DrawEventTests (ITestOutputHelper _output)
{
[Fact]
[AutoInitShutdown]
public void DrawContentComplete_Event_Is_Always_Called ()
{
var viewCalled = false;
var tvCalled = false;
var view = new View { Width = 10, Height = 10, Text = "View" };
view.DrawComplete += (s, e) => viewCalled = true;
var tv = new TextView { Y = 11, Width = 10, Height = 10 };
tv.DrawComplete += (s, e) => tvCalled = true;
var top = new Toplevel ();
top.Add (view, tv);
RunState runState = Application.Begin (top);
Application.RunIteration (ref runState);
Assert.True (viewCalled);
Assert.True (tvCalled);
top.Dispose ();
}
}