-
-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Shrink APIimplementation * Code refactoring * Improvements and fixes to the LayoutTestEngine * Updated Shrink API tests to the new approach * Fixed build
- Loading branch information
1 parent
bb73d53
commit a3ae684
Showing
19 changed files
with
315 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace QuestPDF.LayoutTests | ||
{ | ||
[SetUpFixture] | ||
public class Setup | ||
{ | ||
[OneTimeSetUp] | ||
public static void Configure() | ||
{ | ||
QuestPDF.Settings.License = LicenseType.Community; | ||
QuestPDF.LayoutTests.TestEngine.Settings.LayoutTestVisualizationStrategy = LayoutTestVisualizationStrategy.WhenFailure; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
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); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.