Skip to content

Commit

Permalink
Change ScreenshotOptions.Quality type (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok authored and Meir017 committed Aug 23, 2018
1 parent a6c1c6c commit e510b19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions lib/PuppeteerSharp.Tests/PageTests/ScreenshotTests.cs
Expand Up @@ -265,5 +265,26 @@ public void ShouldInferScreenshotTypeFromName()
Assert.Equal(ScreenshotType.Png, ScreenshotOptions.GetScreenshotTypeFromFile("Test.png"));
Assert.Null(ScreenshotOptions.GetScreenshotTypeFromFile("Test.exe"));
}

[Fact]
public async Task ShouldWorkWithQuality()
{
using (var page = await Browser.NewPageAsync())
{
await page.SetViewportAsync(new ViewPortOptions
{
Width = 500,
Height = 500
});
await page.GoToAsync(TestConstants.ServerUrl + "/grid.html");
var screenshot = await page.ScreenshotDataAsync(new ScreenshotOptions
{
Type = ScreenshotType.Jpeg,
FullPage = true,
Quality = 100
});
Assert.True(ScreenshotHelper.PixelMatch("screenshot-grid-fullpage.png", screenshot));
}
}
}
}
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/ScreenshotOptions.cs
Expand Up @@ -48,7 +48,7 @@ public class ScreenshotOptions
/// </summary>
/// <value>The quality.</value>
[JsonProperty("quality")]
public decimal? Quality { get; set; }
public int? Quality { get; set; }

internal static ScreenshotType? GetScreenshotTypeFromFile(string file)
{
Expand Down

0 comments on commit e510b19

Please sign in to comment.