Browse Source

drop almost all usages of FileTestBase

pull/910/head
Anton Firszov 7 years ago
parent
commit
7e57fce307
  1. 19
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs
  2. 15
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs
  3. 9
      tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs
  4. 6
      tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs

19
tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs

@ -12,7 +12,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{ {
public class BinaryDitherTests : FileTestBase public class BinaryDitherTests
{ {
public static readonly string[] CommonTestImages = public static readonly string[] CommonTestImages =
{ {
@ -40,14 +40,15 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{ "Stucki", KnownDiffusers.Stucki }, { "Stucki", KnownDiffusers.Stucki },
}; };
public const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24;
private static IOrderedDither DefaultDitherer => KnownDitherers.BayerDither4x4; private static IOrderedDither DefaultDitherer => KnownDitherers.BayerDither4x4;
private static IErrorDiffuser DefaultErrorDiffuser => KnownDiffusers.Atkinson; private static IErrorDiffuser DefaultErrorDiffuser => KnownDiffusers.Atkinson;
[Theory] [Theory]
[WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(OrderedDitherers), PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(OrderedDitherers), 100, 100, DefaultPixelType)] [WithTestPatternImages(nameof(OrderedDitherers), 100, 100, PixelTypes.Rgba32)]
public void BinaryDitherFilter_WorksWithAllDitherers<TPixel>(TestImageProvider<TPixel> provider, string name, IOrderedDither ditherer) public void BinaryDitherFilter_WorksWithAllDitherers<TPixel>(TestImageProvider<TPixel> provider, string name, IOrderedDither ditherer)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -59,8 +60,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFileCollection(nameof(CommonTestImages), nameof(ErrorDiffusers), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(ErrorDiffusers), PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(ErrorDiffusers), 100, 100, DefaultPixelType)] [WithTestPatternImages(nameof(ErrorDiffusers), 100, 100, PixelTypes.Rgba32)]
public void DiffusionFilter_WorksWithAllErrorDiffusers<TPixel>(TestImageProvider<TPixel> provider, string name, IErrorDiffuser diffuser) public void DiffusionFilter_WorksWithAllErrorDiffusers<TPixel>(TestImageProvider<TPixel> provider, string name, IErrorDiffuser diffuser)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -72,7 +73,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)] [WithFile(TestImages.Png.Bike, TestPixelTypes)]
public void BinaryDitherFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider) public void BinaryDitherFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -84,7 +85,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)] [WithFile(TestImages.Png.Bike, TestPixelTypes)]
public void DiffusionFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider) public void DiffusionFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -96,7 +97,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFile(TestImages.Png.CalliphoraPartial, DefaultPixelType)] [WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32)]
public void ApplyDitherFilterInBox<TPixel>(TestImageProvider<TPixel> provider) public void ApplyDitherFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -113,7 +114,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFile(TestImages.Png.CalliphoraPartial, DefaultPixelType)] [WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32)]
public void ApplyDiffusionFilterInBox<TPixel>(TestImageProvider<TPixel> provider) public void ApplyDiffusionFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {

15
tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs

@ -11,17 +11,24 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{ {
using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing;
public class BinaryThresholdTest : FileTestBase public class BinaryThresholdTest
{ {
public static readonly TheoryData<float> BinaryThresholdValues public static readonly TheoryData<float> BinaryThresholdValues
= new TheoryData<float> = new TheoryData<float>
{ {
.25F, .25F,
.75F .75F
}; };
public static readonly string[] CommonTestImages =
{
TestImages.Png.CalliphoraPartial, TestImages.Png.Bike
};
public const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24;
[Theory] [Theory]
[WithFileCollection(nameof(DefaultFiles), nameof(BinaryThresholdValues), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(BinaryThresholdValues), PixelTypes.Rgba32)]
public void ImageShouldApplyBinaryThresholdFilter<TPixel>(TestImageProvider<TPixel> provider, float value) public void ImageShouldApplyBinaryThresholdFilter<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -33,7 +40,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
} }
[Theory] [Theory]
[WithFileCollection(nameof(DefaultFiles), nameof(BinaryThresholdValues), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), nameof(BinaryThresholdValues), PixelTypes.Rgba32)]
public void ImageShouldApplyBinaryThresholdInBox<TPixel>(TestImageProvider<TPixel> provider, float value) public void ImageShouldApplyBinaryThresholdInBox<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {

9
tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs

@ -7,10 +7,15 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
public class PadTest : FileTestBase public class PadTest
{ {
public static readonly string[] CommonTestImages =
{
TestImages.Png.CalliphoraPartial, TestImages.Png.Bike
};
[Theory] [Theory]
[WithFileCollection(nameof(DefaultFiles), DefaultPixelType)] [WithFileCollection(nameof(CommonTestImages), PixelTypes.Rgba32)]
public void ImageShouldPad<TPixel>(TestImageProvider<TPixel> provider) public void ImageShouldPad<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {

6
tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs

@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing;
public class RotateFlipTests : FileTestBase public class RotateFlipTests
{ {
public static readonly string[] FlipFiles = { TestImages.Bmp.F }; public static readonly string[] FlipFiles = { TestImages.Bmp.F };
@ -24,8 +24,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}; };
[Theory] [Theory]
[WithTestPatternImages(nameof(RotateFlipValues), 100, 50, DefaultPixelType)] [WithTestPatternImages(nameof(RotateFlipValues), 100, 50, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(RotateFlipValues), 50, 100, DefaultPixelType)] [WithTestPatternImages(nameof(RotateFlipValues), 50, 100, PixelTypes.Rgba32)]
public void RotateFlip<TPixel>(TestImageProvider<TPixel> provider, RotateMode rotateType, FlipMode flipType) public void RotateFlip<TPixel>(TestImageProvider<TPixel> provider, RotateMode rotateType, FlipMode flipType)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {

Loading…
Cancel
Save