LineTests.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. namespace QuestPDF.LayoutTests;
  2. public class LineTests
  3. {
  4. [Test]
  5. public void VerticalLineRequiresSpaceEqualToItsThickness()
  6. {
  7. LayoutTest
  8. .HavingSpaceOfSize(5, 100)
  9. .ForContent(content =>
  10. {
  11. content.Shrink().LineVertical(10);
  12. })
  13. .ExpectLayoutException("The line thickness is greater than the available horizontal space.");
  14. }
  15. [Test]
  16. public void HorizontalLineRequiresSpaceEqualToItsThickness()
  17. {
  18. LayoutTest
  19. .HavingSpaceOfSize(100, 5)
  20. .ForContent(content =>
  21. {
  22. content.Shrink().LineHorizontal(10);
  23. })
  24. .ExpectLayoutException("The line thickness is greater than the available vertical space.");
  25. }
  26. #region Stateful
  27. [Test]
  28. public void CheckRenderingState()
  29. {
  30. LayoutTest
  31. .HavingSpaceOfSize(240, 100)
  32. .ForContent(content =>
  33. {
  34. content.ShrinkVertical().Mock("a").LineHorizontal(2);
  35. })
  36. .ExpectDrawResult(document =>
  37. {
  38. document
  39. .Page()
  40. .RequiredAreaSize(0, 2)
  41. .Content(page =>
  42. {
  43. page.Mock("a").Position(0, 0).Size(240, 2).State(true);
  44. });
  45. });
  46. }
  47. #endregion
  48. }