Browse Source
Merge branch 'master' into af/fix-MagicReferenceDecoder
pull/1772/head
James Jackson-South
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
16 additions and
4 deletions
-
tests/ImageSharp.Tests/Image/ImageFrameTests.cs
-
tests/ImageSharp.Tests/Image/ImageTests.cs
-
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
-
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
|
|
|
@ -16,7 +16,8 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
private void LimitBufferCapacity(int bufferCapacityInBytes) |
|
|
|
{ |
|
|
|
var allocator = (ArrayPoolMemoryAllocator)this.configuration.MemoryAllocator; |
|
|
|
var allocator = ArrayPoolMemoryAllocator.CreateDefault(); |
|
|
|
this.configuration.MemoryAllocator = allocator; |
|
|
|
allocator.BufferCapacityInBytes = bufferCapacityInBytes; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -99,7 +99,8 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
|
|
|
|
private void LimitBufferCapacity(int bufferCapacityInBytes) |
|
|
|
{ |
|
|
|
var allocator = (ArrayPoolMemoryAllocator)this.configuration.MemoryAllocator; |
|
|
|
var allocator = ArrayPoolMemoryAllocator.CreateDefault(); |
|
|
|
this.configuration.MemoryAllocator = allocator; |
|
|
|
allocator.BufferCapacityInBytes = bufferCapacityInBytes; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -21,11 +21,20 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
public abstract partial class TestImageProvider<TPixel> : ITestImageProvider, IXunitSerializable |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
// Create a Configuration with Configuration.CreateDefaultInstance(),
|
|
|
|
// but use the shared MemoryAllocator from Configuration.Default.MemoryAllocator
|
|
|
|
private static Configuration CreateDefaultConfiguration() |
|
|
|
{ |
|
|
|
var configuration = Configuration.CreateDefaultInstance(); |
|
|
|
configuration.MemoryAllocator = ImageSharp.Configuration.Default.MemoryAllocator; |
|
|
|
return configuration; |
|
|
|
} |
|
|
|
|
|
|
|
public PixelTypes PixelType { get; private set; } = typeof(TPixel).GetPixelType(); |
|
|
|
|
|
|
|
public virtual string SourceFileOrDescription => string.Empty; |
|
|
|
|
|
|
|
public Configuration Configuration { get; set; } = Configuration.CreateDefaultInstance(); |
|
|
|
public Configuration Configuration { get; set; } = CreateDefaultConfiguration(); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the utility instance to provide information about the test image & manage input/output.
|
|
|
|
|
|
|
|
@ -663,7 +663,8 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
this TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
var allocator = (ArrayPoolMemoryAllocator)provider.Configuration.MemoryAllocator; |
|
|
|
var allocator = ArrayPoolMemoryAllocator.CreateDefault(); |
|
|
|
provider.Configuration.MemoryAllocator = allocator; |
|
|
|
return new AllocatorBufferCapacityConfigurator(allocator, Unsafe.SizeOf<TPixel>()); |
|
|
|
} |
|
|
|
|
|
|
|
|