StopPagingTests.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. namespace QuestPDF.LayoutTests;
  2. public class StopPagingTests
  3. {
  4. [Test]
  5. public void ChildReturnsWrap()
  6. {
  7. LayoutTest
  8. .HavingSpaceOfSize(100, 100)
  9. .ForContent(content =>
  10. {
  11. content.Shrink()
  12. .Mock("a")
  13. .StopPaging() // <-
  14. .Mock("b")
  15. .SolidBlock(200, 200);
  16. })
  17. .ExpectDrawResult(document =>
  18. {
  19. document
  20. .Page()
  21. .RequiredAreaSize(0, 0)
  22. .Content(page =>
  23. {
  24. page.Mock("a").Position(0, 0).Size(0, 0);
  25. });
  26. });
  27. }
  28. [Test]
  29. public void ChildReturnsPartialRender()
  30. {
  31. LayoutTest
  32. .HavingSpaceOfSize(100, 100)
  33. .ForContent(content =>
  34. {
  35. content.Shrink()
  36. .Mock("a")
  37. .StopPaging() // <-
  38. .Mock("b")
  39. .ContinuousBlock(50, 150);
  40. })
  41. .ExpectDrawResult(document =>
  42. {
  43. document
  44. .Page()
  45. .RequiredAreaSize(50, 100)
  46. .Content(page =>
  47. {
  48. page.Mock("a").Position(0, 0).Size(50, 100);
  49. page.Mock("b").Position(0, 0).Size(50, 100);
  50. });
  51. // remaining item space is ignored
  52. });
  53. }
  54. [Test]
  55. public void ChildReturnsFullRender()
  56. {
  57. LayoutTest
  58. .HavingSpaceOfSize(100, 100)
  59. .ForContent(content =>
  60. {
  61. content.Shrink()
  62. .Mock("a")
  63. .StopPaging() // <-
  64. .Mock("b")
  65. .SolidBlock(50, 50);
  66. })
  67. .ExpectDrawResult(document =>
  68. {
  69. document
  70. .Page()
  71. .RequiredAreaSize(50, 50)
  72. .Content(page =>
  73. {
  74. page.Mock("a").Position(0, 0).Size(50, 50);
  75. page.Mock("b").Position(0, 0).Size(50, 50);
  76. });
  77. });
  78. }
  79. [Test]
  80. public void ChildReturnsEmpty()
  81. {
  82. LayoutTest
  83. .HavingSpaceOfSize(100, 100)
  84. .ForContent(content =>
  85. {
  86. content.Shrink()
  87. .Mock("a")
  88. .StopPaging() // <-
  89. .Mock("b");
  90. })
  91. .ExpectDrawResult(document =>
  92. {
  93. document
  94. .Page()
  95. .RequiredAreaSize(0, 0)
  96. .Content(page =>
  97. {
  98. page.Mock("a").Position(0, 0).Size(0, 0);
  99. page.Mock("b").Position(0, 0).Size(0, 0);
  100. });
  101. });
  102. }
  103. }