Browse Source

skip some of the MemoryManager tests on 32 bit

af/merge-core
Anton Firszov 8 years ago
parent
commit
47439142aa
  1. 18
      tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs
  2. 8
      tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

18
tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs

@ -175,6 +175,12 @@ namespace SixLabors.ImageSharp.Tests.Memory
[Fact] [Fact]
public void CreateWithAggressivePooling() public void CreateWithAggressivePooling()
{ {
if (!TestEnvironment.Is64BitProcess)
{
// can lead to OutOfMemoryException
return;
}
this.MemoryManager = ArrayPoolMemoryManager.CreateWithAggressivePooling(); this.MemoryManager = ArrayPoolMemoryManager.CreateWithAggressivePooling();
Assert.True(this.CheckIsRentingPooledBuffer<Rgba32>(4096 * 4096)); Assert.True(this.CheckIsRentingPooledBuffer<Rgba32>(4096 * 4096));
@ -183,6 +189,12 @@ namespace SixLabors.ImageSharp.Tests.Memory
[Fact] [Fact]
public void CreateDefault() public void CreateDefault()
{ {
if (!TestEnvironment.Is64BitProcess)
{
// can lead to OutOfMemoryException
return;
}
this.MemoryManager = ArrayPoolMemoryManager.CreateDefault(); this.MemoryManager = ArrayPoolMemoryManager.CreateDefault();
Assert.False(this.CheckIsRentingPooledBuffer<Rgba32>(2 * 4096 * 4096)); Assert.False(this.CheckIsRentingPooledBuffer<Rgba32>(2 * 4096 * 4096));
@ -192,6 +204,12 @@ namespace SixLabors.ImageSharp.Tests.Memory
[Fact] [Fact]
public void CreateWithModeratePooling() public void CreateWithModeratePooling()
{ {
if (!TestEnvironment.Is64BitProcess)
{
// can lead to OutOfMemoryException
return;
}
this.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling(); this.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling();
Assert.False(this.CheckIsRentingPooledBuffer<Rgba32>(2048 * 2048)); Assert.False(this.CheckIsRentingPooledBuffer<Rgba32>(2048 * 2048));

8
tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

@ -169,6 +169,7 @@ namespace SixLabors.ImageSharp.Tests
{ {
comparer = ImageComparer.Tolerant(0.5f / 100); comparer = ImageComparer.Tolerant(0.5f / 100);
} }
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
{ {
image.Mutate(process); image.Mutate(process);
@ -192,12 +193,17 @@ namespace SixLabors.ImageSharp.Tests
ImageComparer comparer = null) ImageComparer comparer = null)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
if (comparer == null)
{
comparer = ImageComparer.Tolerant(0.5f / 100);
}
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
{ {
var bounds = new Rectangle(image.Width / 4, image.Width / 4, image.Width / 2, image.Height / 2); var bounds = new Rectangle(image.Width / 4, image.Width / 4, image.Width / 2, image.Height / 2);
image.Mutate(x => process(x, bounds)); image.Mutate(x => process(x, bounds));
image.DebugSave(provider, testOutputDetails); image.DebugSave(provider, testOutputDetails);
image.CompareToReferenceOutput(provider, testOutputDetails); image.CompareToReferenceOutput(comparer, provider, testOutputDetails);
} }
} }

Loading…
Cancel
Save