MultiColumnTests.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using QuestPDF.ConformanceTests.TestEngine;
  2. using QuestPDF.Drawing;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. namespace QuestPDF.ConformanceTests;
  6. internal class MultiColumnTests : ConformanceTestBase
  7. {
  8. protected override Document GetDocumentUnderTest()
  9. {
  10. return Document
  11. .Create(document =>
  12. {
  13. document.Page(page =>
  14. {
  15. page.Margin(60);
  16. page.Content()
  17. .MultiColumn(multiColumn =>
  18. {
  19. multiColumn.Spacing(75);
  20. multiColumn
  21. .Spacer()
  22. .PaddingHorizontal(25)
  23. .Background(Colors.Blue.Lighten4)
  24. .RotateLeft()
  25. .AlignMiddle()
  26. .AlignCenter()
  27. .Text("This text should not be a part of the semantic tree")
  28. .FontColor(Colors.Blue.Darken4)
  29. .Bold();
  30. multiColumn
  31. .Content()
  32. .Column(column =>
  33. {
  34. column.Spacing(25);
  35. foreach (var i in Enumerable.Range(1, 25))
  36. {
  37. column.Item()
  38. .AlignCenter()
  39. .Background(Colors.Grey.Lighten3)
  40. .Padding(10)
  41. .Text(text =>
  42. {
  43. text.Span($"Chapter {i}: ").Bold();
  44. text.Span(Placeholders.LoremIpsum());
  45. });
  46. }
  47. });
  48. });
  49. });
  50. });
  51. }
  52. protected override SemanticTreeNode? GetExpectedSemanticTree()
  53. {
  54. return ExpectedSemanticTree.DocumentRoot(root =>
  55. {
  56. foreach (var i in Enumerable.Range(1, 25))
  57. root.Child("P");
  58. });
  59. }
  60. }