|
@@ -9,6 +9,8 @@ namespace QuestPDF.UnitTests
|
|
|
[TestFixture]
|
|
[TestFixture]
|
|
|
public class ConstrainedTests
|
|
public class ConstrainedTests
|
|
|
{
|
|
{
|
|
|
|
|
+ #region Height
|
|
|
|
|
+
|
|
|
[Test]
|
|
[Test]
|
|
|
public void Measure_MinHeight_ExpectWrap()
|
|
public void Measure_MinHeight_ExpectWrap()
|
|
|
{
|
|
{
|
|
@@ -88,5 +90,91 @@ namespace QuestPDF.UnitTests
|
|
|
.ExpectChildMeasure(new Size(400, 100), new Wrap())
|
|
.ExpectChildMeasure(new Size(400, 100), new Wrap())
|
|
|
.CheckMeasureResult(new Wrap());
|
|
.CheckMeasureResult(new Wrap());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region Width
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MinWidth_ExpectWrap()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MinWidth = 100
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(50, 400))
|
|
|
|
|
+ .CheckMeasureResult(new Wrap());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MinWidth_ExtendHeight()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MinWidth = 100,
|
|
|
|
|
+ Child = x.CreateChild()
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(200, 400))
|
|
|
|
|
+ .ExpectChildMeasure(new Size(200, 400), new FullRender(50, 400))
|
|
|
|
|
+ .CheckMeasureResult(new FullRender(100, 400));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MinWidth_PassHeight()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MinWidth = 100,
|
|
|
|
|
+ Child = x.CreateChild()
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(200, 400))
|
|
|
|
|
+ .ExpectChildMeasure(new Size(200, 400), new FullRender(150, 400))
|
|
|
|
|
+ .CheckMeasureResult(new FullRender(150, 400));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MaxWidth_Empty()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxWidth = 100
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(150, 400))
|
|
|
|
|
+ .CheckMeasureResult(new FullRender(0, 0));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MaxWidth_PartialRender()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxWidth = 100,
|
|
|
|
|
+ Child = x.CreateChild()
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(200, 400))
|
|
|
|
|
+ .ExpectChildMeasure(new Size(100, 400), new PartialRender(75, 400))
|
|
|
|
|
+ .CheckMeasureResult(new PartialRender(75, 400));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [Test]
|
|
|
|
|
+ public void Measure_MaxWidth_ExpectWrap()
|
|
|
|
|
+ {
|
|
|
|
|
+ TestPlan
|
|
|
|
|
+ .For(x => new Constrained
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxWidth = 100,
|
|
|
|
|
+ Child = x.CreateChild()
|
|
|
|
|
+ })
|
|
|
|
|
+ .MeasureElement(new Size(200, 400))
|
|
|
|
|
+ .ExpectChildMeasure(new Size(100, 400), new Wrap())
|
|
|
|
|
+ .CheckMeasureResult(new Wrap());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|