diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs index 828fc0dcd..1741ea2c6 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs @@ -4,6 +4,7 @@ using System.IO; using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; using static SixLabors.ImageSharp.Tests.TestImages.WebP; @@ -96,6 +97,20 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp image.VerifyEncoder(provider, "webp", testOutputDetails, encoder, customComparer: GetComparer(quality)); } + [Theory] + [WithTestPatternImages(187, 221, PixelTypes.Rgba32)] + [WithTestPatternImages(100, 118, PixelTypes.Rgba32)] + public void Encode_Lossy_WorksWithTestPattern(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + // Encoding lossy images with transparency is not yet supported, therefor the test image will be made opaque. + image.Mutate(img => img.MakeOpaque()); + var encoder = new WebpEncoder() { Lossy = true }; + image.VerifyEncoder(provider, "webp", string.Empty, encoder); + } + [Fact] public void Encode_Lossless_OneByOnePixel_Works() {