Browse Source

Add encoding test pattern tests

pull/1552/head
Brian Popow 5 years ago
parent
commit
24fec9b4bc
  1. 15
      tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs

15
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<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> 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()
{

Loading…
Cancel
Save