|
|
|
@ -5,6 +5,7 @@ using System; |
|
|
|
|
|
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
|
using SixLabors.ImageSharp.Processing; |
|
|
|
using SixLabors.ImageSharp.Processing.Processors.Dithering; |
|
|
|
using SixLabors.ImageSharp.Processing.Processors.Quantization; |
|
|
|
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; |
|
|
|
using Xunit; |
|
|
|
@ -152,6 +153,13 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Quantization |
|
|
|
new WuQuantizer(OrderedDitherOptions), |
|
|
|
}; |
|
|
|
|
|
|
|
public static readonly TheoryData<IDither> DefaultInstanceDitherers |
|
|
|
= new TheoryData<IDither> |
|
|
|
{ |
|
|
|
default(ErrorDither), |
|
|
|
default(OrderedDither) |
|
|
|
}; |
|
|
|
|
|
|
|
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
@ -217,5 +225,20 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Quantization |
|
|
|
testOutputDetails: testOutputDetails, |
|
|
|
appendPixelTypeToFileName: false); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(DefaultInstanceDitherers))] |
|
|
|
public void ShouldThrowForDefaultDitherInstance(IDither dither) |
|
|
|
{ |
|
|
|
void Command() |
|
|
|
{ |
|
|
|
using var image = new Image<Rgba32>(10, 10); |
|
|
|
var quantizer = new WebSafePaletteQuantizer(); |
|
|
|
quantizer.Options.Dither = dither; |
|
|
|
image.Mutate(x => x.Quantize(quantizer)); |
|
|
|
} |
|
|
|
|
|
|
|
Assert.Throws<ImageProcessingException>(Command); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|