From 5cc0397acbfce6a0154abcc51ec2d0d0c8c8976d Mon Sep 17 00:00:00 2001 From: MarcinZiabek Date: Wed, 19 Oct 2022 23:20:19 +0200 Subject: [PATCH] Added more examples for the Shrink element --- QuestPDF.Examples/ShrinkExamples.cs | 93 +++++++++++++++++++++++++++++ QuestPDF/Fluent/ShrinkExtensions.cs | 2 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 QuestPDF.Examples/ShrinkExamples.cs diff --git a/QuestPDF.Examples/ShrinkExamples.cs b/QuestPDF.Examples/ShrinkExamples.cs new file mode 100644 index 0000000..eb4fe29 --- /dev/null +++ b/QuestPDF.Examples/ShrinkExamples.cs @@ -0,0 +1,93 @@ +using NUnit.Framework; +using QuestPDF.Examples.Engine; +using QuestPDF.Fluent; +using QuestPDF.Helpers; + +namespace QuestPDF.Examples +{ + public class ShrinkExamples + { + [Test] + public void Shrink_Without() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Horizontal() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .ShrinkHorizontal() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Vertical() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .ShrinkVertical() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + + [Test] + public void Shrink_Both() + { + RenderingTest + .Create() + .PageSize(300, 200) + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(20) + .Border(2) + .Shrink() + .Background(Colors.Grey.Lighten2) + .Padding(20) + .Text("This is test.") + .FontSize(20); + }); + } + } +} \ No newline at end of file diff --git a/QuestPDF/Fluent/ShrinkExtensions.cs b/QuestPDF/Fluent/ShrinkExtensions.cs index 53510de..befb9ef 100644 --- a/QuestPDF/Fluent/ShrinkExtensions.cs +++ b/QuestPDF/Fluent/ShrinkExtensions.cs @@ -16,7 +16,7 @@ namespace QuestPDF.Fluent public static IContainer Shrink(this IContainer element) { - return element.ExtendVertical().ExtendHorizontal(); + return element.ShrinkVertical().ShrinkHorizontal(); } public static IContainer ShrinkVertical(this IContainer element)