mirror of https://github.com/SixLabors/ImageSharp
13 changed files with 418 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class BlackWhiteTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void BlackWhite_CorrectProcessor() |
|||
{ |
|||
this.operations.BlackWhite(); |
|||
BlackWhiteProcessor p = this.Verify<BlackWhiteProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void BlackWhite_rect_CorrectProcessor() |
|||
{ |
|||
this.operations.BlackWhite(this.rect); |
|||
BlackWhiteProcessor p = this.Verify<BlackWhiteProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Effects |
|||
{ |
|||
public class BrightnessTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Brightness_amount_BrightnessProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Brightness(1.5F); |
|||
BrightnessProcessor processor = this.Verify<BrightnessProcessor>(); |
|||
|
|||
Assert.Equal(1.5F, processor.Amount); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Brightness_amount_rect_BrightnessProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Brightness(1.5F, this.rect); |
|||
BrightnessProcessor processor = this.Verify<BrightnessProcessor>(this.rect); |
|||
|
|||
Assert.Equal(1.5F, processor.Amount); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Collections.Generic; |
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using SixLabors.ImageSharp.Processing.Processors; |
|||
using SixLabors.ImageSharp.Tests.TestUtilities; |
|||
|
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class ColorBlindnessTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
public static IEnumerable<object[]> TheoryData = new[] { |
|||
new object[]{ new TestType<AchromatomalyProcessor>(), ColorBlindnessMode.Achromatomaly }, |
|||
new object[]{ new TestType<AchromatopsiaProcessor>(), ColorBlindnessMode.Achromatopsia }, |
|||
new object[]{ new TestType<DeuteranomalyProcessor>(), ColorBlindnessMode.Deuteranomaly }, |
|||
new object[]{ new TestType<DeuteranopiaProcessor>(), ColorBlindnessMode.Deuteranopia }, |
|||
new object[]{ new TestType<ProtanomalyProcessor>(), ColorBlindnessMode.Protanomaly }, |
|||
new object[]{ new TestType<ProtanopiaProcessor>(), ColorBlindnessMode.Protanopia }, |
|||
new object[]{ new TestType<TritanomalyProcessor>(), ColorBlindnessMode.Tritanomaly }, |
|||
new object[]{ new TestType<TritanopiaProcessor>(), ColorBlindnessMode.Tritanopia } |
|||
}; |
|||
|
|||
[Theory] |
|||
[MemberData(nameof(TheoryData))] |
|||
public void ColorBlindness_CorrectProcessor<T>(TestType<T> testType, ColorBlindnessMode colorBlindness) |
|||
where T : IImageProcessor |
|||
{ |
|||
this.operations.ColorBlindness(colorBlindness); |
|||
T p = this.Verify<T>(); |
|||
} |
|||
[Theory] |
|||
[MemberData(nameof(TheoryData))] |
|||
public void ColorBlindness_rect_CorrectProcessor<T>(TestType<T> testType, ColorBlindnessMode colorBlindness) |
|||
where T : IImageProcessor |
|||
{ |
|||
this.operations.ColorBlindness(colorBlindness, this.rect); |
|||
T p = this.Verify<T>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing.Processors; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Effects |
|||
{ |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
|
|||
public class ContrastTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Contrast_amount_ContrastProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Contrast(1.5F); |
|||
ContrastProcessor processor = this.Verify<ContrastProcessor>(); |
|||
|
|||
Assert.Equal(1.5F, processor.Amount); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Contrast_amount_rect_ContrastProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Contrast(1.5F, this.rect); |
|||
ContrastProcessor processor = this.Verify<ContrastProcessor>(this.rect); |
|||
|
|||
Assert.Equal(1.5F, processor.Amount); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.Collections.Generic; |
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using SixLabors.ImageSharp.Processing.Processors; |
|||
using SixLabors.ImageSharp.Tests.TestUtilities; |
|||
|
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class GrayscaleTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
public static IEnumerable<object[]> ModeTheoryData = new[] { |
|||
new object[]{ new TestType<GrayscaleBt709Processor>(), GrayscaleMode.Bt709 } |
|||
}; |
|||
|
|||
[Theory] |
|||
[MemberData(nameof(ModeTheoryData))] |
|||
public void Grayscale_mode_CorrectProcessor<T>(TestType<T> testType, GrayscaleMode mode) |
|||
where T : IImageProcessor |
|||
{ |
|||
this.operations.Grayscale(mode); |
|||
var p = this.Verify<T>(); |
|||
} |
|||
|
|||
[Theory] |
|||
[MemberData(nameof(ModeTheoryData))] |
|||
public void Grayscale_mode_rect_CorrectProcessor<T>(TestType<T> testType, GrayscaleMode mode) |
|||
where T : IImageProcessor |
|||
{ |
|||
this.operations.Grayscale(mode, this.rect); |
|||
this.Verify<T>(this.rect); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Grayscale_rect_CorrectProcessor() |
|||
{ |
|||
this.operations.Grayscale(this.rect); |
|||
this.Verify<GrayscaleBt709Processor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
|
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class HueTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Hue_amount_HueProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Hue(34f); |
|||
var processor = this.Verify<HueProcessor>(); |
|||
|
|||
Assert.Equal(34f, processor.Degrees); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Hue_amount_rect_HueProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Hue(5f, this.rect); |
|||
var processor = this.Verify<HueProcessor>(this.rect); |
|||
|
|||
Assert.Equal(5f, processor.Degrees); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Effects |
|||
{ |
|||
public class InvertTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Invert_InvertProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Invert(); |
|||
var processor = this.Verify<InvertProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Pixelate_rect_PixelateProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Invert(this.rect); |
|||
var processor = this.Verify<InvertProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class KodachromeTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Kodachrome_amount_KodachromeProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Kodachrome(); |
|||
var processor = this.Verify<KodachromeProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Kodachrome_amount_rect_KodachromeProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Kodachrome(this.rect); |
|||
var processor = this.Verify<KodachromeProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing.Processors; |
|||
using SixLabors.Primitives; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests |
|||
{ |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
|
|||
public class LomographTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Lomograph_amount_LomographProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Lomograph(); |
|||
var processor = this.Verify<LomographProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Lomograph_amount_rect_LomographProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Lomograph(this.rect); |
|||
var processor = this.Verify<LomographProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Effects |
|||
{ |
|||
public class OpacityTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Alpha_amount_AlphaProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Opacity(0.2f); |
|||
OpacityProcessor processor = this.Verify<OpacityProcessor>(); |
|||
|
|||
Assert.Equal(.2f, processor.Amount); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Alpha_amount_rect_AlphaProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Opacity(0.6f, this.rect); |
|||
OpacityProcessor processor = this.Verify<OpacityProcessor>(this.rect); |
|||
|
|||
Assert.Equal(.6f, processor.Amount); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
|
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class PolaroidTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Polaroid_amount_PolaroidProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Polaroid(); |
|||
var processor = this.Verify<PolaroidProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Polaroid_amount_rect_PolaroidProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Polaroid(this.rect); |
|||
var processor = this.Verify<PolaroidProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class SaturateTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Saturation_amount_SaturationProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Saturate(34); |
|||
SaturateProcessor processor = this.Verify<SaturateProcessor>(); |
|||
|
|||
Assert.Equal(34, processor.Amount); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Saturation_amount_rect_SaturationProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Saturate(5, this.rect); |
|||
SaturateProcessor processor = this.Verify<SaturateProcessor>(this.rect); |
|||
|
|||
Assert.Equal(5, processor.Amount); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) Six Labors and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using SixLabors.ImageSharp.Processing; |
|||
using SixLabors.ImageSharp.Processing.Processors.Filters; |
|||
using Xunit; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Processing.Filters |
|||
{ |
|||
public class SepiaTest : BaseImageOperationsExtensionTest |
|||
{ |
|||
[Fact] |
|||
public void Sepia_amount_SepiaProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Sepia(); |
|||
var processor = this.Verify<SepiaProcessor>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Sepia_amount_rect_SepiaProcessorDefaultsSet() |
|||
{ |
|||
this.operations.Sepia(this.rect); |
|||
var processor = this.Verify<SepiaProcessor>(this.rect); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue