DriverTests.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Text;
  2. using UnitTests.ViewsTests;
  3. using Xunit.Abstractions;
  4. namespace UnitTests.DriverTests;
  5. public class DriverTests (ITestOutputHelper output)
  6. {
  7. private readonly ITestOutputHelper _output = output;
  8. [Theory]
  9. [InlineData ("fake")]
  10. [InlineData ("windows")]
  11. [InlineData ("dotnet")]
  12. [InlineData ("unix")]
  13. public void All_Drivers_Init_Shutdown_Cross_Platform (string driverName = null)
  14. {
  15. Application.Init (null, driverName: driverName);
  16. Application.Shutdown ();
  17. }
  18. [Theory]
  19. [InlineData ("fake")]
  20. [InlineData ("windows")]
  21. [InlineData ("dotnet")]
  22. [InlineData ("unix")]
  23. public void All_Drivers_Run_Cross_Platform (string driverName = null)
  24. {
  25. Application.Init (null, driverName: driverName);
  26. Application.StopAfterFirstIteration = true;
  27. Application.Run ().Dispose ();
  28. Application.Shutdown ();
  29. }
  30. [Theory]
  31. [InlineData ("fake")]
  32. [InlineData ("windows")]
  33. [InlineData ("dotnet")]
  34. [InlineData ("unix")]
  35. public void All_Drivers_LayoutAndDraw_Cross_Platform (string driverName = null)
  36. {
  37. Application.Init (null, driverName: driverName);
  38. Application.StopAfterFirstIteration = true;
  39. Application.Run<TestTop> ().Dispose ();
  40. DriverAssert.AssertDriverContentsWithFrameAre (expectedLook: driverName!, _output);
  41. Application.Shutdown ();
  42. }
  43. }
  44. public class TestTop : Toplevel
  45. {
  46. /// <inheritdoc />
  47. public override void BeginInit ()
  48. {
  49. Text = Driver!.GetName ()!;
  50. BorderStyle = LineStyle.None;
  51. base.BeginInit ();
  52. }
  53. }