📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
1.1 KiB

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects;
[Trait("Category", "Processors")]
[GroupOutput("Effects")]
public class PixelateTest
{
public static readonly TheoryData<int> PixelateValues = new() { 4, 8 };
[Theory]
[WithFile(TestImages.Png.Ducky, nameof(PixelateValues), PixelTypes.Rgba32)]
public void FullImage<TPixel>(TestImageProvider<TPixel> provider, int value)
where TPixel : unmanaged, IPixel<TPixel>
{
provider.RunValidatingProcessorTest(x => x.Pixelate(value), value, appendPixelTypeToFileName: false);
}
[Theory]
[WithTestPatternImages(nameof(PixelateValues), 320, 240, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.CalliphoraPartial, nameof(PixelateValues), PixelTypes.Rgba32)]
public void InBox<TPixel>(TestImageProvider<TPixel> provider, int value)
where TPixel : unmanaged, IPixel<TPixel>
{
provider.RunRectangleConstrainedValidatingProcessorTest((x, rect) => x.Pixelate(value, rect), value);
}
}