diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs index 21056bdc61..285da42cd2 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs @@ -283,6 +283,26 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp image.VerifyEncoder(provider, "webp", $"with_alpha_compressed_{compressed}", encoder, ImageComparer.Tolerant(0.04f)); } + [Theory] + [WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32)] + public void Encode_Lossy_WithCompressedAlpha_AlphaShouldBeSmaller(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + var encoder = new WebpEncoder() + { + FileFormat = WebpFileFormatType.Lossy, + UseAlphaCompression = true + }; + + using Image image = provider.GetImage(); + using (var memoryStream = new MemoryStream()) + { + image.SaveAsWebp(memoryStream, encoder); + int size = memoryStream.ToArray().Length; + Assert.True(size < 16300); + } + } + [Theory] [WithFile(TestPatternOpaque, PixelTypes.Rgba32)] [WithFile(TestPatternOpaqueSmall, PixelTypes.Rgba32)]