diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs index 26f12fc193..0521889045 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs @@ -49,10 +49,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP [WithFile(Lossy.NoFilter03, PixelTypes.Rgba32)] [WithFile(Lossy.NoFilter04, PixelTypes.Rgba32)] [WithFile(Lossy.NoFilter05, PixelTypes.Rgba32)] - [WithFile(Lossy.NoFilter06, PixelTypes.Rgba32)] - [WithFile(Lossy.NoFilter07, PixelTypes.Rgba32)] - [WithFile(Lossy.NoFilter08, PixelTypes.Rgba32)] - [WithFile(Lossy.NoFilter09, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationNoFilter01, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationNoFilter02, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationNoFilter03, PixelTypes.Rgba32)] public void WebpDecoder_CanDecode_Lossy_WithoutFilter(TestImageProvider provider) where TPixel : struct, IPixel { @@ -79,6 +78,29 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP } } + [Theory] + [WithFile(Lossy.IccpComplexFilter, PixelTypes.Rgba32)] + [WithFile(Lossy.VeryShort, PixelTypes.Rgba32)] + [WithFile(Lossy.BikeComplexFilter, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter01, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter02, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter03, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter04, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter05, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter06, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter07, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter08, PixelTypes.Rgba32)] + [WithFile(Lossy.ComplexFilter09, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Lossy_WithComplexFilter(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(WebpDecoder)) + { + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + } + [Theory] [WithFile(Lossy.Small01, PixelTypes.Rgba32)] [WithFile(Lossy.Small02, PixelTypes.Rgba32)] @@ -95,17 +117,46 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP } [Theory] - [WithFile(Lossy.IccpComplexFilter, PixelTypes.Rgba32)] - [WithFile(Lossy.VeryShort, PixelTypes.Rgba32)] - [WithFile(Lossy.BikeComplexFilter, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter01, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter02, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter03, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter04, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter05, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter06, PixelTypes.Rgba32)] - [WithFile(Lossy.ComplexFilter07, PixelTypes.Rgba32)] - public void WebpDecoder_CanDecode_Lossy_WithComplexFilter(TestImageProvider provider) + [WithFile(Lossy.SegmentationNoFilter04, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationNoFilter05, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationNoFilter06, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationComplexFilter01, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationComplexFilter02, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationComplexFilter03, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationComplexFilter04, PixelTypes.Rgba32)] + [WithFile(Lossy.SegmentationComplexFilter05, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Lossy_WithPartitions(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(WebpDecoder)) + { + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + } + + [Theory] + [WithFile(Lossy.Partitions01, PixelTypes.Rgba32)] + [WithFile(Lossy.Partitions02, PixelTypes.Rgba32)] + [WithFile(Lossy.Partitions03, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Lossy_WithSegmentation(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(WebpDecoder)) + { + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + } + + [Theory] + [WithFile(Lossy.Sharpness01, PixelTypes.Rgba32)] + [WithFile(Lossy.Sharpness02, PixelTypes.Rgba32)] + [WithFile(Lossy.Sharpness03, PixelTypes.Rgba32)] + [WithFile(Lossy.Sharpness04, PixelTypes.Rgba32)] + [WithFile(Lossy.Sharpness05, PixelTypes.Rgba32)] + [WithFile(Lossy.Sharpness06, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Lossy_WithSharpnessLevel(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage(WebpDecoder)) diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 5b5a3f6f39..87fdf520a6 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -435,10 +435,7 @@ namespace SixLabors.ImageSharp.Tests public const string NoFilter03 = "WebP/vp80-00-comprehensive-005.webp"; public const string NoFilter04 = "WebP/vp80-01-intra-1417.webp"; public const string NoFilter05 = "WebP/vp80-02-inter-1402.webp"; - public const string NoFilter06 = "WebP/vp80-03-segmentation-1401.webp"; - public const string NoFilter07 = "WebP/vp80-03-segmentation-1403.webp"; - public const string NoFilter08 = "WebP/vp80-03-segmentation-1407.webp"; - public const string NoFilter09 = "WebP/test.webp"; + public const string NoFilter06 = "WebP/test.webp"; // Lossy images with a simple filter. public const string SimpleFilter01 = "WebP/segment01.webp"; @@ -461,6 +458,32 @@ namespace SixLabors.ImageSharp.Tests public const string ComplexFilter08 = "WebP/vp80-00-comprehensive-016.webp"; public const string ComplexFilter09 = "WebP/vp80-00-comprehensive-017.webp"; + // Lossy with partitions. + public const string Partitions01 = "WebP/vp80-04-partitions-1404.webp"; + public const string Partitions02 = "WebP/vp80-04-partitions-1405.webp"; + public const string Partitions03 = "WebP/vp80-04-partitions-1406.webp"; + + // Lossy with segmentation. + public const string SegmentationNoFilter01 = "WebP/vp80-03-segmentation-1401.webp"; + public const string SegmentationNoFilter02 = "WebP/vp80-03-segmentation-1403.webp"; + public const string SegmentationNoFilter03 = "WebP/vp80-03-segmentation-1407.webp"; + public const string SegmentationNoFilter04 = "WebP/vp80-03-segmentation-1408.webp"; + public const string SegmentationNoFilter05 = "WebP/vp80-03-segmentation-1409.webp"; + public const string SegmentationNoFilter06 = "WebP/vp80-03-segmentation-1410.webp"; + public const string SegmentationComplexFilter01 = "WebP/vp80-03-segmentation-1413.webp"; + public const string SegmentationComplexFilter02 = "WebP/vp80-03-segmentation-1425.webp"; + public const string SegmentationComplexFilter03 = "WebP/vp80-03-segmentation-1426.webp"; + public const string SegmentationComplexFilter04 = "WebP/vp80-03-segmentation-1427.webp"; + public const string SegmentationComplexFilter05 = "WebP/vp80-03-segmentation-1432.webp"; + + // Lossy with sharpness level. + public const string Sharpness01 = "WebP/vp80-05-sharpness-1428.webp"; + public const string Sharpness02 = "WebP/vp80-05-sharpness-1429.webp"; + public const string Sharpness03 = "WebP/vp80-05-sharpness-1430.webp"; + public const string Sharpness04 = "WebP/vp80-05-sharpness-1431.webp"; + public const string Sharpness05 = "WebP/vp80-05-sharpness-1433.webp"; + public const string Sharpness06 = "WebP/vp80-05-sharpness-1434.webp"; + // Very small images (all with complex filter). public const string Small01 = "WebP/small_13x1.webp"; public const string Small02 = "WebP/small_1x1.webp";