ExecutionOrderExamples.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using NUnit.Framework;
  2. using QuestPDF.Examples.Engine;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. using QuestPDF.Infrastructure;
  6. namespace QuestPDF.Examples
  7. {
  8. public class ExecutionOrderExamples
  9. {
  10. [Test]
  11. public void Example()
  12. {
  13. RenderingTest
  14. .Create()
  15. .PageSize(400, 300)
  16. .ProduceImages()
  17. .ShowResults()
  18. .Render(container =>
  19. {
  20. container
  21. .DefaultTextStyle(TextStyle.Default.Size(18))
  22. .Padding(25)
  23. .Row(row =>
  24. {
  25. row.Spacing(25);
  26. row.RelativeItem()
  27. .Border(1)
  28. .Padding(15)
  29. .Background(Colors.Grey.Lighten2)
  30. .Text("Lorem ipsum");
  31. row.RelativeItem()
  32. .Border(1)
  33. .Background(Colors.Grey.Lighten2)
  34. .Padding(15)
  35. .Text("dolor sit amet");
  36. });
  37. });
  38. }
  39. [Test]
  40. public void Example2()
  41. {
  42. RenderingTest
  43. .Create()
  44. .PageSize(200, 200)
  45. .ProduceImages()
  46. .ShowResults()
  47. .Render(container =>
  48. {
  49. container
  50. .Padding(25)
  51. .Border(2)
  52. .Width(150)
  53. .Height(150)
  54. .Background(Colors.Blue.Lighten2)
  55. .PaddingTop(50)
  56. .Background(Colors.Green.Lighten2)
  57. .PaddingRight(50)
  58. .Background(Colors.Red.Lighten2)
  59. .PaddingBottom(50)
  60. .Background(Colors.Amber.Lighten2)
  61. .PaddingLeft(50)
  62. .Background(Colors.Grey.Lighten2);
  63. });
  64. }
  65. }
  66. }