Added more examples for the Shrink element

This commit is contained in:
MarcinZiabek
2022-10-19 23:20:19 +02:00
parent 73448f483c
commit 5cc0397acb
2 changed files with 94 additions and 1 deletions
+93
View File
@@ -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);
});
}
}
}
+1 -1
View File
@@ -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)