ShrinkExamples.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using NUnit.Framework;
  2. using QuestPDF.Examples.Engine;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Helpers;
  5. namespace QuestPDF.Examples
  6. {
  7. public class ShrinkExamples
  8. {
  9. [Test]
  10. public void Shrink_Without()
  11. {
  12. RenderingTest
  13. .Create()
  14. .PageSize(300, 200)
  15. .ProduceImages()
  16. .ShowResults()
  17. .Render(container =>
  18. {
  19. container
  20. .Padding(20)
  21. .Border(2)
  22. .Background(Colors.Grey.Lighten2)
  23. .Padding(20)
  24. .Text("This is test.")
  25. .FontSize(20);
  26. });
  27. }
  28. [Test]
  29. public void Shrink_Horizontal()
  30. {
  31. RenderingTest
  32. .Create()
  33. .PageSize(300, 200)
  34. .ProduceImages()
  35. .ShowResults()
  36. .Render(container =>
  37. {
  38. container
  39. .Padding(20)
  40. .Border(2)
  41. .ShrinkHorizontal()
  42. .Background(Colors.Grey.Lighten2)
  43. .Padding(20)
  44. .Text("This is test.")
  45. .FontSize(20);
  46. });
  47. }
  48. [Test]
  49. public void Shrink_Vertical()
  50. {
  51. RenderingTest
  52. .Create()
  53. .PageSize(300, 200)
  54. .ProduceImages()
  55. .ShowResults()
  56. .Render(container =>
  57. {
  58. container
  59. .Padding(20)
  60. .Border(2)
  61. .ShrinkVertical()
  62. .Background(Colors.Grey.Lighten2)
  63. .Padding(20)
  64. .Text("This is test.")
  65. .FontSize(20);
  66. });
  67. }
  68. [Test]
  69. public void Shrink_Both()
  70. {
  71. RenderingTest
  72. .Create()
  73. .PageSize(300, 200)
  74. .ProduceImages()
  75. .ShowResults()
  76. .Render(container =>
  77. {
  78. container
  79. .Padding(20)
  80. .Border(2)
  81. .Shrink()
  82. .Background(Colors.Grey.Lighten2)
  83. .Padding(20)
  84. .Text("This is test.")
  85. .FontSize(20);
  86. });
  87. }
  88. }
  89. }