TableTests.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. namespace QuestPDF.LayoutTests;
  2. public class TableTests
  3. {
  4. [Test]
  5. public void RowSpan_CornerCase1()
  6. {
  7. LayoutTest
  8. .HavingSpaceOfSize(200, 400)
  9. .ForContent(content =>
  10. {
  11. content
  12. .Table(table =>
  13. {
  14. table.ColumnsDefinition(columns =>
  15. {
  16. columns.RelativeColumn();
  17. });
  18. table.Cell()
  19. .RowSpan(2)
  20. .Mock("a")
  21. .SolidBlock(100, 100);
  22. table.Cell()
  23. .Mock("b")
  24. .SolidBlock(100, 350);
  25. });
  26. })
  27. .ExpectDrawResult(document =>
  28. {
  29. document
  30. .Page()
  31. .RequiredAreaSize(200, 100)
  32. .Content(page =>
  33. {
  34. page.Mock("a").Position(0, 0).Size(200, 100);
  35. });
  36. document
  37. .Page()
  38. .RequiredAreaSize(200, 350)
  39. .Content(page =>
  40. {
  41. page.Mock("b").Position(0, 0).Size(200, 350);
  42. });
  43. });
  44. }
  45. [Test]
  46. public void RowSpan_CornerCase2()
  47. {
  48. LayoutTest
  49. .HavingSpaceOfSize(200, 400)
  50. .ForContent(content =>
  51. {
  52. content
  53. .Table(table =>
  54. {
  55. table.ColumnsDefinition(columns =>
  56. {
  57. columns.RelativeColumn();
  58. columns.RelativeColumn();
  59. });
  60. table.Cell()
  61. .Column(1)
  62. .Row(1)
  63. .RowSpan(3)
  64. .Mock("a")
  65. .SolidBlock(100, 100);
  66. table.Cell()
  67. .Column(2)
  68. .Row(2)
  69. .Mock("b")
  70. .ContinuousBlock(100, 600);
  71. });
  72. })
  73. .ExpectDrawResult(document =>
  74. {
  75. document
  76. .Page()
  77. .RequiredAreaSize(200, 400)
  78. .Content(page =>
  79. {
  80. page.Mock("a").Position(0, 0).Size(100, 400);
  81. page.Mock("b").Position(100, 0).Size(100, 400);
  82. });
  83. document
  84. .Page()
  85. .RequiredAreaSize(200, 200)
  86. .Content(page =>
  87. {
  88. page.Mock("a").Position(0, 0).Size(100, 200);
  89. page.Mock("b").Position(100, 0).Size(100, 200);
  90. });
  91. });
  92. }
  93. }