56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
using NUnit.Framework;
|
|
using QuestPDF.Examples.Engine;
|
|
using QuestPDF.Fluent;
|
|
using QuestPDF.Helpers;
|
|
using QuestPDF.Infrastructure;
|
|
|
|
namespace QuestPDF.Examples
|
|
{
|
|
public class RowExamples
|
|
{
|
|
[Test]
|
|
public void Stability()
|
|
{
|
|
// up to version 2021.12, this code would always result with the infinite layout exception
|
|
|
|
RenderingTest
|
|
.Create()
|
|
.ProducePdf()
|
|
.MaxPages(100)
|
|
.PageSize(250, 150)
|
|
.ShowResults()
|
|
.Render(container =>
|
|
{
|
|
container
|
|
.Padding(25)
|
|
.Row(row =>
|
|
{
|
|
row.RelativeColumn().Stack(stack =>
|
|
{
|
|
stack.Item().ShowOnce().Element(CreateBox).Text("X");
|
|
stack.Item().Element(CreateBox).Text("1");
|
|
stack.Item().Element(CreateBox).Text("2");
|
|
});
|
|
|
|
row.RelativeColumn().Stack(stack =>
|
|
{
|
|
stack.Item().Element(CreateBox).Text("1");
|
|
stack.Item().Element(CreateBox).Text("2");
|
|
});
|
|
});
|
|
});
|
|
|
|
static IContainer CreateBox(IContainer container)
|
|
{
|
|
return container
|
|
.ExtendHorizontal()
|
|
.ExtendVertical()
|
|
.Background(Colors.Grey.Lighten4)
|
|
.Border(1)
|
|
.AlignCenter()
|
|
.AlignMiddle()
|
|
.ShowOnce();
|
|
}
|
|
}
|
|
}
|
|
} |