Browse Source

build and testrunning fix

pull/125/head
Anton Firszov 9 years ago
parent
commit
8a08319ce0
  1. 3
      src/ImageSharp/Common/Memory/PixelDataPool{T}.cs
  2. 11
      tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs

3
src/ImageSharp/Common/Memory/PixelDataPool{T}.cs

@ -46,7 +46,8 @@ namespace ImageSharp
/// <returns>The maxArrayLength value</returns> /// <returns>The maxArrayLength value</returns>
internal static int CalculateMaxArrayLength() internal static int CalculateMaxArrayLength()
{ {
if (typeof(IPixel).IsAssignableFrom(typeof(T))) // ReSharper disable once SuspiciousTypeConversion.Global
if (default(T) is IPixel)
{ {
const int MaximumExpectedImageSize = 16384; const int MaximumExpectedImageSize = 16384;
return MaximumExpectedImageSize * MaximumExpectedImageSize; return MaximumExpectedImageSize * MaximumExpectedImageSize;

11
tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs

@ -9,22 +9,21 @@
{ {
public class Color : BulkPixelOperationsTests<ImageSharp.Color> public class Color : BulkPixelOperationsTests<ImageSharp.Color>
{ {
// MemberData does not work without redeclaring the public field in the derived test class: // For 4.6 test runner MemberData does not work without redeclaring the public field in the derived test class:
public static TheoryData<int> ArraySizesData = new TheoryData<int> { 7, 16, 1111 }; public static new TheoryData<int> ArraySizesData => new TheoryData<int> { 7, 16, 1111 };
} }
public class Argb : BulkPixelOperationsTests<ImageSharp.Argb> public class Argb : BulkPixelOperationsTests<ImageSharp.Argb>
{ {
// MemberData does not work without redeclaring the public field in the derived test class: // For 4.6 test runner MemberData does not work without redeclaring the public field in the derived test class:
public static TheoryData<int> ArraySizesData = new TheoryData<int> { 7, 16, 1111 }; public static new TheoryData<int> ArraySizesData => new TheoryData<int> { 7, 16, 1111 };
} }
} }
public abstract class BulkPixelOperationsTests<TColor> public abstract class BulkPixelOperationsTests<TColor>
where TColor : struct, IPixel<TColor> where TColor : struct, IPixel<TColor>
{ {
// The field is private so it can be safely redeclared in inherited non-abstract test classes. public static TheoryData<int> ArraySizesData => new TheoryData<int> { 7, 16, 1111 };
private static TheoryData<int> ArraySizesData = new TheoryData<int> { 7, 16, 1111 };
[Theory] [Theory]
[MemberData(nameof(ArraySizesData))] [MemberData(nameof(ArraySizesData))]

Loading…
Cancel
Save