62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using NUnit.Framework;
|
|
using QuestPDF.Drawing;
|
|
using QuestPDF.Elements;
|
|
using QuestPDF.Infrastructure;
|
|
using QuestPDF.UnitTests.TestEngine;
|
|
|
|
namespace QuestPDF.UnitTests
|
|
{
|
|
[TestFixture]
|
|
public class ShrinkTests
|
|
{
|
|
[Test]
|
|
public void Measure() => SimpleContainerTests.Measure<Shrink>();
|
|
|
|
[Test]
|
|
public void Draw_Wrap()
|
|
{
|
|
TestPlan
|
|
.For(x => new Shrink
|
|
{
|
|
Child = x.CreateChild(),
|
|
ShrinkVertical = true,
|
|
ShrinkHorizontal = true
|
|
})
|
|
.DrawElement(new Size(400, 300))
|
|
.ExpectChildMeasure(expectedInput: new Size(400, 300), returns: SpacePlan.Wrap())
|
|
.CheckDrawResult();
|
|
}
|
|
|
|
[Test]
|
|
public void Measure_PartialRender()
|
|
{
|
|
TestPlan
|
|
.For(x => new Shrink
|
|
{
|
|
Child = x.CreateChild(),
|
|
ShrinkVertical = true,
|
|
ShrinkHorizontal = true
|
|
})
|
|
.MeasureElement(new Size(400, 300))
|
|
.ExpectChildMeasure(expectedInput: new Size(400, 300), returns: SpacePlan.PartialRender(200, 100))
|
|
.ExpectChildDraw(new Size(200, 100))
|
|
.CheckDrawResult();
|
|
}
|
|
|
|
[Test]
|
|
public void Measure_FullRender()
|
|
{
|
|
TestPlan
|
|
.For(x => new Shrink
|
|
{
|
|
Child = x.CreateChild(),
|
|
ShrinkVertical = true,
|
|
ShrinkHorizontal = true
|
|
})
|
|
.MeasureElement(new Size(500, 400))
|
|
.ExpectChildMeasure(expectedInput: new Size(500, 400), returns: SpacePlan.FullRender(300, 200))
|
|
.ExpectChildDraw(new Size(300, 200))
|
|
.CheckDrawResult();
|
|
}
|
|
}
|
|
} |