mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
This commit is contained in:
63
Tests/UnitTests/Drivers/DriverTests.cs
Normal file
63
Tests/UnitTests/Drivers/DriverTests.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Text;
|
||||
using UnitTests.ViewsTests;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace UnitTests.DriverTests;
|
||||
|
||||
public class DriverTests (ITestOutputHelper output)
|
||||
{
|
||||
private readonly ITestOutputHelper _output = output;
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData ("fake")]
|
||||
[InlineData ("windows")]
|
||||
[InlineData ("dotnet")]
|
||||
[InlineData ("unix")]
|
||||
public void All_Drivers_Init_Shutdown_Cross_Platform (string driverName = null)
|
||||
{
|
||||
Application.Init (null, driverName: driverName);
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData ("fake")]
|
||||
[InlineData ("windows")]
|
||||
[InlineData ("dotnet")]
|
||||
[InlineData ("unix")]
|
||||
public void All_Drivers_Run_Cross_Platform (string driverName = null)
|
||||
{
|
||||
Application.Init (null, driverName: driverName);
|
||||
Application.StopAfterFirstIteration = true;
|
||||
Application.Run ().Dispose ();
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData ("fake")]
|
||||
[InlineData ("windows")]
|
||||
[InlineData ("dotnet")]
|
||||
[InlineData ("unix")]
|
||||
public void All_Drivers_LayoutAndDraw_Cross_Platform (string driverName = null)
|
||||
{
|
||||
Application.Init (null, driverName: driverName);
|
||||
Application.StopAfterFirstIteration = true;
|
||||
Application.Run<TestTop> ().Dispose ();
|
||||
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (expectedLook: driverName!, _output);
|
||||
|
||||
Application.Shutdown ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class TestTop : Toplevel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void BeginInit ()
|
||||
{
|
||||
Text = Driver!.GetName ()!;
|
||||
BorderStyle = LineStyle.None;
|
||||
base.BeginInit ();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user