// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests.Processing.Processors.Effects { using ImageSharp.PixelFormats; using ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; using Xunit; public class InvertTest : FileTestBase { [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyInvertFilter(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage()) { image.Mutate(x => x.Invert()); image.DebugSave(provider); } } [Theory] [WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] public void ImageShouldApplyInvertFilterInBox(TestImageProvider provider) where TPixel : struct, IPixel { using (Image source = provider.GetImage()) using (var image = source.Clone()) { var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.Invert(bounds)); image.DebugSave(provider); PercentageImageComparer_Old.EnsureProcessorChangesAreConstrained(source, image, bounds); } } } }