| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- namespace QuestPDF.LayoutTests;
- public class ShrinkTests
- {
- [Test]
- public void Both()
- {
- LayoutTest
- .HavingSpaceOfSize(100, 120)
- .WithContent(content =>
- {
- content
- .Shrink()
- .Mock().Size(60, 200);
- })
- .ExpectedDrawResult(document =>
- {
- document
- .Page()
- .RequiredAreaSize(60, 120)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(60, 120);
- });
-
- document
- .Page()
- .RequiredAreaSize(60, 80)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(60, 80);
- });
- });
- }
-
- [Test]
- public void Vertical()
- {
- LayoutTest
- .HavingSpaceOfSize(100, 120)
- .WithContent(content =>
- {
- content
- .ShrinkVertical()
- .Mock().Size(60, 200);
- })
- .ExpectedDrawResult(document =>
- {
- document
- .Page()
- .RequiredAreaSize(60, 120)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(100, 120);
- });
-
- document
- .Page()
- .RequiredAreaSize(60, 80)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(100, 80);
- });
- });
- }
-
- [Test]
- public void Horizontal()
- {
- LayoutTest
- .HavingSpaceOfSize(100, 120)
- .WithContent(content =>
- {
- content
- .ShrinkHorizontal()
- .Mock().Size(60, 200);
- })
- .ExpectedDrawResult(document =>
- {
- document
- .Page()
- .RequiredAreaSize(60, 120)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(60, 120);
- });
-
- document
- .Page()
- .RequiredAreaSize(60, 80)
- .Content(page =>
- {
- page.Mock().Position(0, 0).Size(60, 120);
- });
- });
- }
-
- [Test]
- public void ContentFromRightToLeft()
- {
- LayoutTest
- .HavingSpaceOfSize(100, 120)
- .WithContent(content =>
- {
- content
- .ContentFromRightToLeft()
- .Shrink()
- .Mock().Size(60, 200);
- })
- .ExpectedDrawResult(document =>
- {
- document
- .Page()
- .RequiredAreaSize(60, 120)
- .Content(page =>
- {
- page.Mock().Position(40, 0).Size(60, 120);
- });
-
- document
- .Page()
- .RequiredAreaSize(60, 80)
- .Content(page =>
- {
- page.Mock().Position(40, 0).Size(60, 80);
- });
- });
- }
- }
|