From 33a46c13e1e5984e863963fdcb7ed22ef6166231 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 29 May 2017 23:49:59 +1000 Subject: [PATCH] Lomograph --- .../ColorMatrix/ColorBlindnessTest.cs | 4 +- .../Processing/ColorMatrix/HueTest.cs | 4 +- .../Processing/ColorMatrix/LomographTest.cs | 48 +++++++++++++++++++ .../Processors/Filters/LomographTest.cs | 48 ------------------- 4 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs delete mode 100644 tests/ImageSharp.Tests/Processors/Filters/LomographTest.cs diff --git a/tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs index 4a8273281..24df04fdf 100644 --- a/tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/ColorMatrix/ColorBlindnessTest.cs @@ -33,7 +33,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix using (Image image = provider.GetImage()) { image.ColorBlindness(colorBlindness) - .DebugSave(provider, null, Extensions.Bmp); + .DebugSave(provider, colorBlindness.ToString(), Extensions.Bmp); } } @@ -48,7 +48,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); image.ColorBlindness(colorBlindness, bounds) - .DebugSave(provider, null, Extensions.Bmp); + .DebugSave(provider, colorBlindness.ToString(), Extensions.Bmp); // Draw identical shapes over the bounded and compare to ensure changes are constrained. image.Fill(NamedColors.HotPink, bounds); diff --git a/tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs b/tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs index 1e0760194..9b6510631 100644 --- a/tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/ColorMatrix/HueTest.cs @@ -26,7 +26,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix using (Image image = provider.GetImage()) { image.Hue(value) - .DebugSave(provider, null, Extensions.Bmp); + .DebugSave(provider, value, Extensions.Bmp); } } @@ -41,7 +41,7 @@ namespace ImageSharp.Tests.Processing.ColorMatrix var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); image.Hue(value, bounds) - .DebugSave(provider, null, Extensions.Bmp); + .DebugSave(provider, value, Extensions.Bmp); // Draw identical shapes over the bounded and compare to ensure changes are constrained. image.Fill(NamedColors.HotPink, bounds); diff --git a/tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs b/tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs new file mode 100644 index 000000000..2ea686fd9 --- /dev/null +++ b/tests/ImageSharp.Tests/Processing/ColorMatrix/LomographTest.cs @@ -0,0 +1,48 @@ +// +// 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 LomographTest : FileTestBase + { + [Theory] + [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] + public void ImageShouldApplyLomographFilter(TestImageProvider provider) + where TPixel : struct, IPixel + { + using (Image image = provider.GetImage()) + { + image.Lomograph() + .DebugSave(provider, null, Extensions.Bmp); + } + } + + [Theory] + [WithFileCollection(nameof(AllBmpFiles), StandardPixelTypes)] + public void ImageShouldApplyLomographFilterInBox(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.Lomograph(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/LomographTest.cs b/tests/ImageSharp.Tests/Processors/Filters/LomographTest.cs deleted file mode 100644 index 6ceedecbd..000000000 --- a/tests/ImageSharp.Tests/Processors/Filters/LomographTest.cs +++ /dev/null @@ -1,48 +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 LomographTest : FileTestBase - { - [Fact] - public void ImageShouldApplyLomographFilter() - { - string path = this.CreateOutputDirectory("Lomograph"); - - foreach (TestFile file in Files) - { - using (Image image = file.CreateImage()) - using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) - { - image.Lomograph().Save(output); - } - } - } - - [Fact] - public void ImageShouldApplyLomographFilterInBox() - { - string path = this.CreateOutputDirectory("Lomograph"); - - foreach (TestFile file in Files) - { - string filename = file.GetFileName("InBox"); - using (Image image = file.CreateImage()) - using (FileStream output = File.OpenWrite($"{path}/{filename}")) - { - image.Lomograph(new Rectangle(image.Width / 4, image.Width / 4, image.Width / 2, image.Height / 2)) - .Save(output); - } - } - } - } -} \ No newline at end of file