From cbfa6825c11f261cd62c9b11089d979e36b1da2a Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 29 May 2017 23:43:35 +1000 Subject: [PATCH] Kodachrome --- .../Processing/ColorMatrix/BlackWhiteTest.cs | 4 +- .../Processing/ColorMatrix/KodachromeTest.cs | 46 ++++++++++++++++++ .../Processors/Filters/KodachromeTest.cs | 47 ------------------- 3 files changed, 48 insertions(+), 49 deletions(-) create mode 100644 tests/ImageSharp.Tests/Processing/ColorMatrix/KodachromeTest.cs delete mode 100644 tests/ImageSharp.Tests/Processors/Filters/KodachromeTest.cs diff --git a/tests/ImageSharp.Tests/Processing/ColorMatrix/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/ColorMatrix/BlackWhiteTest.cs index cc9c42d51..e3083cbe1 100644 --- a/tests/ImageSharp.Tests/Processing/ColorMatrix/BlackWhiteTest.cs +++ b/tests/ImageSharp.Tests/Processing/ColorMatrix/BlackWhiteTest.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix public class BlackWhiteTest : FileTestBase { - [Fact] + [Theory] [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] public void ImageShouldApplyBlackWhiteFilter(TestImageProvider provider) where TPixel : struct, IPixel @@ -23,7 +23,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix } } - [Fact] + [Theory] [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] public void ImageShouldApplyBlackWhiteFilterInBox(TestImageProvider provider) where TPixel : struct, IPixel diff --git a/tests/ImageSharp.Tests/Processing/ColorMatrix/KodachromeTest.cs b/tests/ImageSharp.Tests/Processing/ColorMatrix/KodachromeTest.cs new file mode 100644 index 000000000..ece3eb41a --- /dev/null +++ b/tests/ImageSharp.Tests/Processing/ColorMatrix/KodachromeTest.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Tests.Processing.ColorMatrix +{ + using ImageSharp.PixelFormats; + + using Xunit; + + public class KodachromeTest : FileTestBase + { + [Theory] + [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] + public void ImageShouldApplyKodachromeFilter(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage()) + { + image.Kodachrome() + .DebugSave(provider, null, Extensions.Bmp); + } + } + + [Theory] + [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] + public void ImageShouldApplyKodachromeFilterInBox(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image source = provider.GetImage()) + using (var image = new Image(source)) + { + var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + + image.Kodachrome(bounds) + .DebugSave(provider, null, Extensions.Bmp); + + // Draw identical shapes over the bounded and compare to ensure changes are constrained. + image.Fill(NamedColors.HotPink, bounds); + source.Fill(NamedColors.HotPink, bounds); + ImageComparer.CheckSimilarity(image, source); + } + } + } +} \ No newline at end of file diff --git a/tests/ImageSharp.Tests/Processors/Filters/KodachromeTest.cs b/tests/ImageSharp.Tests/Processors/Filters/KodachromeTest.cs deleted file mode 100644 index 29a459f97..000000000 --- a/tests/ImageSharp.Tests/Processors/Filters/KodachromeTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp.Tests -{ - using System.IO; - - using ImageSharp.PixelFormats; - - using Xunit; - - public class KodachromeTest : FileTestBase - { - [Fact] - public void ImageShouldApplyKodachromeFilter() - { - string path = this.CreateOutputDirectory("Kodachrome"); - - foreach (TestFile file in Files) - { - using (Image image = file.CreateImage()) - using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) - { - image.Kodachrome().Save(output); - } - } - } - - [Fact] - public void ImageShouldApplyKodachromeFilterInBox() - { - string path = this.CreateOutputDirectory("Kodachrome"); - - foreach (TestFile file in Files) - { - string filename = file.GetFileName("InBox"); - using (Image image = file.CreateImage()) - using (FileStream output = File.OpenWrite($"{path}/{filename}")) - { - image.Kodachrome(new Rectangle(10, 10, image.Width / 2, image.Height / 2)).Save(output); - } - } - } - } -} \ No newline at end of file