Skip to content

Commit e510b19

Browse files
kblokMeir017
authored andcommitted
Change ScreenshotOptions.Quality type (#540)
1 parent a6c1c6c commit e510b19

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

lib/PuppeteerSharp.Tests/PageTests/ScreenshotTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,26 @@ public void ShouldInferScreenshotTypeFromName()
265265
Assert.Equal(ScreenshotType.Png, ScreenshotOptions.GetScreenshotTypeFromFile("Test.png"));
266266
Assert.Null(ScreenshotOptions.GetScreenshotTypeFromFile("Test.exe"));
267267
}
268+
269+
[Fact]
270+
public async Task ShouldWorkWithQuality()
271+
{
272+
using (var page = await Browser.NewPageAsync())
273+
{
274+
await page.SetViewportAsync(new ViewPortOptions
275+
{
276+
Width = 500,
277+
Height = 500
278+
});
279+
await page.GoToAsync(TestConstants.ServerUrl + "/grid.html");
280+
var screenshot = await page.ScreenshotDataAsync(new ScreenshotOptions
281+
{
282+
Type = ScreenshotType.Jpeg,
283+
FullPage = true,
284+
Quality = 100
285+
});
286+
Assert.True(ScreenshotHelper.PixelMatch("screenshot-grid-fullpage.png", screenshot));
287+
}
288+
}
268289
}
269290
}

lib/PuppeteerSharp/ScreenshotOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ScreenshotOptions
4848
/// </summary>
4949
/// <value>The quality.</value>
5050
[JsonProperty("quality")]
51-
public decimal? Quality { get; set; }
51+
public int? Quality { get; set; }
5252

5353
internal static ScreenshotType? GetScreenshotTypeFromFile(string file)
5454
{

0 commit comments

Comments
 (0)