SvgTests.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using QuestPDF.ConformanceTests.TestEngine;
  2. using QuestPDF.Drawing;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. namespace QuestPDF.ConformanceTests;
  6. internal class SvgTests : 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. .Column(column =>
  18. {
  19. column.Spacing(25);
  20. column.Item()
  21. .SemanticHeader1()
  22. .Text("Conformance Test: SVG")
  23. .FontSize(24)
  24. .Bold()
  25. .FontColor(Colors.Blue.Darken2);
  26. column.Item()
  27. .Text("SVG content should be rendered correctly and possible to be annotated as semantic image. Image taken from: undraw.co");
  28. column.Item()
  29. .SemanticImage("Sample SVG image description")
  30. .Svg("Resources/image.svg");
  31. });
  32. });
  33. });
  34. }
  35. protected override SemanticTreeNode? GetExpectedSemanticTree()
  36. {
  37. return ExpectedSemanticTree.DocumentRoot(root =>
  38. {
  39. root.Child("H1", h1 => h1.Alt("Conformance Test: SVG"));
  40. root.Child("P");
  41. root.Child("Figure", figure => figure.Alt("Sample SVG image description"));
  42. });
  43. }
  44. }