From f5d91a6ce126a48b35f9783d7b72902d132df869 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Sat, 29 Feb 2020 22:30:28 +0100 Subject: [PATCH] Add more webp lossy test cases --- .../Formats/WebP/WebPDecoderTests.cs | 23 +++++++++++++++++++ tests/ImageSharp.Tests/TestImages.cs | 19 ++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs index 24324ffe32..26f12fc193 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs @@ -66,6 +66,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP [Theory] [WithFile(Lossy.SimpleFilter01, PixelTypes.Rgba32)] [WithFile(Lossy.SimpleFilter02, PixelTypes.Rgba32)] + [WithFile(Lossy.SimpleFilter03, PixelTypes.Rgba32)] + [WithFile(Lossy.SimpleFilter04, PixelTypes.Rgba32)] + [WithFile(Lossy.SimpleFilter05, PixelTypes.Rgba32)] public void WebpDecoder_CanDecode_Lossy_WithSimpleFilter(TestImageProvider provider) where TPixel : struct, IPixel { @@ -76,12 +79,32 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP } } + [Theory] + [WithFile(Lossy.Small01, PixelTypes.Rgba32)] + [WithFile(Lossy.Small02, PixelTypes.Rgba32)] + [WithFile(Lossy.Small03, PixelTypes.Rgba32)] + [WithFile(Lossy.Small04, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Lossy_VerySmall(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage(WebpDecoder)) + { + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + } + [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) where TPixel : struct, IPixel { diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index c15a5ab811..5b5a3f6f39 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -443,13 +443,29 @@ namespace SixLabors.ImageSharp.Tests // Lossy images with a simple filter. public const string SimpleFilter01 = "WebP/segment01.webp"; public const string SimpleFilter02 = "WebP/segment02.webp"; + public const string SimpleFilter03 = "WebP/vp80-00-comprehensive-003.webp"; + public const string SimpleFilter04 = "WebP/vp80-00-comprehensive-007.webp"; + public const string SimpleFilter05 = "WebP/test-nostrong.webp"; - // Losyy images with a complex filter. + // Lossy images with a complex filter. public const string IccpComplexFilter = "WebP/lossy_iccp.webp"; public const string VeryShort = "WebP/very_short.webp"; public const string BikeComplexFilter = "WebP/bike_lossy_complex_filter.webp"; public const string ComplexFilter01 = "WebP/vp80-02-inter-1418.webp"; public const string ComplexFilter02 = "WebP/vp80-02-inter-1418.webp"; + public const string ComplexFilter03 = "WebP/vp80-00-comprehensive-002.webp"; + public const string ComplexFilter04 = "WebP/vp80-00-comprehensive-006.webp"; + public const string ComplexFilter05 = "WebP/vp80-00-comprehensive-009.webp"; + public const string ComplexFilter06 = "WebP/vp80-00-comprehensive-012.webp"; + public const string ComplexFilter07 = "WebP/vp80-00-comprehensive-015.webp"; + public const string ComplexFilter08 = "WebP/vp80-00-comprehensive-016.webp"; + public const string ComplexFilter09 = "WebP/vp80-00-comprehensive-017.webp"; + + // Very small images (all with complex filter). + public const string Small01 = "WebP/small_13x1.webp"; + public const string Small02 = "WebP/small_1x1.webp"; + public const string Small03 = "WebP/small_1x13.webp"; + public const string Small04 = "WebP/small_31x13.webp"; // Lossy images with an alpha channel. public const string Alpha1 = "WebP/lossy_alpha1.webp"; @@ -457,6 +473,7 @@ namespace SixLabors.ImageSharp.Tests public const string Alpha3 = "WebP/lossy_alpha3.webp"; public const string Alpha4 = "WebP/lossy_alpha4.webp"; public const string AlphaNoCompression = "WebP/alpha_no_compression.webp"; + } public static readonly string[] All =