LineTests.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using QuestPDF.ConformanceTests.TestEngine;
  2. using QuestPDF.Drawing;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. using QuestPDF.Infrastructure;
  6. namespace QuestPDF.ConformanceTests;
  7. internal class LineTests : ConformanceTestBase
  8. {
  9. protected override Document GetDocumentUnderTest()
  10. {
  11. return Document
  12. .Create(document =>
  13. {
  14. document.Page(page =>
  15. {
  16. page.Margin(60);
  17. page.Content()
  18. .Column(column =>
  19. {
  20. column.Spacing(25);
  21. column.Item()
  22. .SemanticHeader1()
  23. .Text("Conformance Test: Line Elements")
  24. .FontSize(24)
  25. .Bold()
  26. .FontColor(Colors.Blue.Darken2);
  27. column.Item()
  28. .Text("Line elements should be rendered but semantically treated as artifacts.");
  29. column.Item()
  30. .LineHorizontal(2)
  31. .LineColor(Colors.Red.Medium);
  32. column.Item()
  33. .Text(Placeholders.LoremIpsum());
  34. column.Item()
  35. .LineHorizontal(4)
  36. .LineColor(Colors.Green.Medium)
  37. .LineDashPattern([6, 6, 12, 6]);
  38. column.Item()
  39. .SemanticDivision()
  40. .Background(Colors.Grey.Lighten3).Row(row =>
  41. {
  42. row.RelativeItem()
  43. .PaddingVertical(25)
  44. .AlignRight()
  45. .Text("Text on the left side");
  46. row.AutoItem()
  47. .PaddingHorizontal(25)
  48. .LineVertical(4)
  49. .LineGradient([ Colors.Blue.Lighten2, Colors.Blue.Darken2 ]);
  50. row.RelativeItem()
  51. .PaddingVertical(25)
  52. .Text("Text on the right side");
  53. });
  54. });
  55. });
  56. });
  57. }
  58. protected override SemanticTreeNode? GetExpectedSemanticTree()
  59. {
  60. return ExpectedSemanticTree.DocumentRoot(root =>
  61. {
  62. root.Child("H1", h1 => h1.Alt("Conformance Test: Line Elements"));
  63. root.Child("P");
  64. root.Child("P");
  65. root.Child("Div", div =>
  66. {
  67. div.Child("P");
  68. div.Child("P");
  69. });
  70. });
  71. }
  72. }