Skip to content

Commit

Permalink
Add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
BobLd committed Jul 30, 2023
1 parent ecb6c75 commit 590d74d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/UglyToad.PdfPig.Rendering.Skia.Tests/RenderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ public void d_22060_A1_01_Plans_1()
RenderDocument("22060_A1_01_Plans-1");
}

[Fact]
public void cat_genetics_bobld()
{
RenderDocument("cat-genetics_bobld");
}

private static void RenderDocument(string path)
{
const float scale = 1.5f;

using (var document = PdfDocument.Open(Helpers.GetDocumentPath(path)))
{
document.AddPageFactory<SKPicture>(typeof(SkiaPageFactory));
Expand All @@ -38,7 +46,7 @@ private static void RenderDocument(string path)
Assert.NotNull(picture);

using (var fs = new FileStream($"{path}_{p}.png", FileMode.Create))
using (var image = SKImage.FromPicture(picture, new SKSizeI((int)page.Width, (int)page.Height)))
using (var image = SKImage.FromPicture(picture, new SKSizeI((int)(page.Width * scale), (int)(page.Height * scale)), SKMatrix.CreateScale(scale, scale)))
using (SKData d = image.Encode(SKEncodedImageFormat.Png, 100))
{
d.SaveTo(fs);
Expand Down

0 comments on commit 590d74d

Please sign in to comment.