Browse Source

clean up filter tests + smaller output images

pull/404/head
Anton Firszov 8 years ago
parent
commit
3c2e10bd14
  1. 2
      src/ImageSharp/Processing/Processors/Filters/BlackWhiteProcessor.cs
  2. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs
  3. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs
  4. 4
      tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs
  5. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs
  6. 12
      tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
  7. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs
  8. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs
  9. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs
  10. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs
  11. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs
  12. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs
  13. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs
  14. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs
  15. 10
      tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs

2
src/ImageSharp/Processing/Processors/Filters/BlackWhiteProcessor.cs

@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
/// Applies a black and white filter matrix to the image
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class BlackWhiteProcessor<TPixel> : FilterProcessor<TPixel>
internal class BlackWhiteProcessor<TPixel> : FilterProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{
/// <summary>

10
tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class BlackWhiteTest : FileTestBase
public class BlackWhiteTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyBlackWhiteFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyBlackWhiteFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyBlackWhiteFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyBlackWhiteFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs

@ -9,7 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
public class BrightnessTest : FileTestBase
public class BrightnessTest
{
public static readonly TheoryData<float> BrightnessValues
= new TheoryData<float>
@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
};
[Theory]
[WithTestPatternImages(nameof(BrightnessValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyBrightnessFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(BrightnessValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyBrightnessFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
}
[Theory]
[WithTestPatternImages(nameof(BrightnessValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyBrightnessFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(BrightnessValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyBrightnessFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

4
tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs

@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
[Theory]
[WithTestPatternImages(nameof(ColorBlindnessFilters), 100, 100, DefaultPixelType)]
public void ImageShouldApplyColorBlindnessFilter<TPixel>(TestImageProvider<TPixel> provider, ColorBlindness colorBlindness)
public void ApplyColorBlindnessFilter<TPixel>(TestImageProvider<TPixel> provider, ColorBlindness colorBlindness)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
[Theory]
[WithTestPatternImages(nameof(ColorBlindnessFilters), 100, 100, DefaultPixelType)]
public void ImageShouldApplyColorBlindnessFilterInBox<TPixel>(TestImageProvider<TPixel> provider, ColorBlindness colorBlindness)
public void ApplyColorBlindnessFilterInBox<TPixel>(TestImageProvider<TPixel> provider, ColorBlindness colorBlindness)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs

@ -9,7 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
public class ContrastTest : FileTestBase
public class ContrastTest
{
public static readonly TheoryData<float> ContrastValues
= new TheoryData<float>
@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
};
[Theory]
[WithTestPatternImages(nameof(ContrastValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyContrastFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(ContrastValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyContrastFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
}
[Theory]
[WithTestPatternImages(nameof(ContrastValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyContrastFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(ContrastValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyContrastFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

12
tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs

@ -11,11 +11,13 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class FilterTest : FileTestBase
public class FilterTest
{
// Testing the generic FilterProcessor with more than one pixel type intentionally.
// There is no need to do this with the specialized ones.
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
public void ApplyFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -29,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs

@ -11,7 +11,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class GrayscaleTest : FileTestBase
public class GrayscaleTest
{
public static readonly TheoryData<GrayscaleMode> GrayscaleModeTypes
= new TheoryData<GrayscaleMode>
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
/// Use test patterns over loaded images to save decode time.
/// </summary>
[Theory]
[WithTestPatternImages(nameof(GrayscaleModeTypes), 100, 100, DefaultPixelType)]
public void ImageShouldApplyGrayscaleFilter<TPixel>(TestImageProvider<TPixel> provider, GrayscaleMode value)
[WithTestPatternImages(nameof(GrayscaleModeTypes), 48, 48, PixelTypes.Rgba32)]
public void ApplyGrayscaleFilter<TPixel>(TestImageProvider<TPixel> provider, GrayscaleMode value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -45,8 +45,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(nameof(GrayscaleModeTypes), 100, 100, DefaultPixelType)]
public void ImageShouldApplyGrayscaleFilterInBox<TPixel>(TestImageProvider<TPixel> provider, GrayscaleMode value)
[WithTestPatternImages(nameof(GrayscaleModeTypes), 48, 48, PixelTypes.Rgba32)]
public void ApplyGrayscaleFilterInBox<TPixel>(TestImageProvider<TPixel> provider, GrayscaleMode value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs

@ -9,7 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class HueTest : FileTestBase
public class HueTest
{
public static readonly TheoryData<int> HueValues
= new TheoryData<int>
@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
};
[Theory]
[WithTestPatternImages(nameof(HueValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyHueFilter<TPixel>(TestImageProvider<TPixel> provider, int value)
[WithTestPatternImages(nameof(HueValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyHueFilter<TPixel>(TestImageProvider<TPixel> provider, int value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(nameof(HueValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyHueFilterInBox<TPixel>(TestImageProvider<TPixel> provider, int value)
[WithTestPatternImages(nameof(HueValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyHueFilterInBox<TPixel>(TestImageProvider<TPixel> provider, int value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
public class InvertTest : FileTestBase
public class InvertTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyInvertFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyInvertFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyInvertFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyInvertFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class KodachromeTest : FileTestBase
public class KodachromeTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyKodachromeFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyKodachromeFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyKodachromeFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyKodachromeFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class LomographTest : FileTestBase
public class LomographTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyLomographFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyLomographFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyLomographFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyLomographFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs

@ -9,7 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
{
public class OpacityTest : FileTestBase
public class OpacityTest
{
public static readonly TheoryData<float> AlphaValues
= new TheoryData<float>
@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
};
[Theory]
[WithTestPatternImages(nameof(AlphaValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyAlphaFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(AlphaValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyAlphaFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects
}
[Theory]
[WithTestPatternImages(nameof(AlphaValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplyAlphaFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(AlphaValues), 48, 48, PixelTypes.Rgba32)]
public void ApplyAlphaFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class PolaroidTest : FileTestBase
public class PolaroidTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyPolaroidFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyPolaroidFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplyPolaroidFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplyPolaroidFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs

@ -9,7 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class SaturateTest : FileTestBase
public class SaturateTest
{
public static readonly TheoryData<float> SaturationValues
= new TheoryData<float>
@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
};
[Theory]
[WithTestPatternImages(nameof(SaturationValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplySaturationFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(SaturationValues), 48, 48, PixelTypes.Rgba32)]
public void ApplySaturationFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(nameof(SaturationValues), 100, 100, DefaultPixelType)]
public void ImageShouldApplySaturationFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
[WithTestPatternImages(nameof(SaturationValues), 48, 48, PixelTypes.Rgba32)]
public void ApplySaturationFilterInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

10
tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs

@ -9,11 +9,11 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
public class SepiaTest : FileTestBase
public class SepiaTest
{
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplySepiaFilter<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplySepiaFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
}
[Theory]
[WithTestPatternImages(100, 100, DefaultPixelType)]
public void ImageShouldApplySepiaFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
[WithTestPatternImages(48, 48, PixelTypes.Rgba32)]
public void ApplySepiaFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> source = provider.GetImage())

Loading…
Cancel
Save