HyperlinkTests.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 HyperlinkTests : 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(15);
  21. column.Item()
  22. .SemanticHeader1()
  23. .Text("Conformance Test: Hyperlinks")
  24. .FontSize(24)
  25. .Bold()
  26. .FontColor(Colors.Blue.Darken2);
  27. column.Item().Text("Please find the link below:");
  28. column.Item()
  29. .SemanticLink("Link to the QuestPDF website")
  30. .Hyperlink("https://www.questpdf.com")
  31. .Text("QuestPDF website")
  32. .Underline()
  33. .FontColor(Colors.Blue.Darken2);
  34. });
  35. });
  36. });
  37. }
  38. protected override SemanticTreeNode? GetExpectedSemanticTree()
  39. {
  40. return ExpectedSemanticTree.DocumentRoot(root =>
  41. {
  42. root.Child("H1", h1 => h1.Alt("Conformance Test: Hyperlinks"));
  43. root.Child("P");
  44. root.Child("Link", link =>
  45. {
  46. link.Alt("Link to the QuestPDF website");
  47. link.Child("P");
  48. });
  49. });
  50. }
  51. }