2
0

Pos.AlignTests.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Xunit.Abstractions;
  2. using static Terminal.Gui.Dim;
  3. using static Terminal.Gui.Pos;
  4. namespace Terminal.Gui.PosDimTests;
  5. public class PosAlignTests ()
  6. {
  7. [Fact]
  8. public void PosAlign_Constructor ()
  9. {
  10. var posAlign = new PosAlign (Alignment.Justified);
  11. Assert.NotNull (posAlign);
  12. }
  13. [Theory]
  14. [InlineData (Alignment.Left, Alignment.Left, true)]
  15. [InlineData (Alignment.Centered, Alignment.Centered, true)]
  16. [InlineData (Alignment.Left, Alignment.Centered, false)]
  17. [InlineData (Alignment.Centered, Alignment.Left, false)]
  18. public void PosAlign_Equals (Alignment align1, Alignment align2, bool expectedEquals)
  19. {
  20. var posAlign1 = new PosAlign (align1);
  21. var posAlign2 = new PosAlign (align2);
  22. Assert.Equal (expectedEquals, posAlign1.Equals (posAlign2));
  23. Assert.Equal (expectedEquals, posAlign2.Equals (posAlign1));
  24. }
  25. [Fact]
  26. public void PosAlign_ToString ()
  27. {
  28. var posAlign = new PosAlign (Alignment.Justified);
  29. var expectedString = "Align(groupId=0, alignment=Justified)";
  30. Assert.Equal (expectedString, posAlign.ToString ());
  31. }
  32. [Fact]
  33. public void PosAlign_Anchor ()
  34. {
  35. var posAlign = new PosAlign (Alignment.Left);
  36. var width = 50;
  37. var expectedAnchor = -width;
  38. Assert.Equal (expectedAnchor, posAlign.Anchor (width));
  39. }
  40. [Fact]
  41. public void PosAlign_CreatesCorrectInstance ()
  42. {
  43. var pos = Pos.Align (Alignment.Left);
  44. Assert.IsType<PosAlign> (pos);
  45. }
  46. // Tests that test Left alignment
  47. //
  48. }