diff --git a/tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs b/tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs index 11cb861578..a2e162a0e5 100644 --- a/tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs +++ b/tests/ImageSharp.Tests/Memory/ArrayPoolMemoryManagerTests.cs @@ -175,6 +175,12 @@ namespace SixLabors.ImageSharp.Tests.Memory [Fact] public void CreateWithAggressivePooling() { + if (!TestEnvironment.Is64BitProcess) + { + // can lead to OutOfMemoryException + return; + } + this.MemoryManager = ArrayPoolMemoryManager.CreateWithAggressivePooling(); Assert.True(this.CheckIsRentingPooledBuffer(4096 * 4096)); @@ -183,6 +189,12 @@ namespace SixLabors.ImageSharp.Tests.Memory [Fact] public void CreateDefault() { + if (!TestEnvironment.Is64BitProcess) + { + // can lead to OutOfMemoryException + return; + } + this.MemoryManager = ArrayPoolMemoryManager.CreateDefault(); Assert.False(this.CheckIsRentingPooledBuffer(2 * 4096 * 4096)); @@ -192,6 +204,12 @@ namespace SixLabors.ImageSharp.Tests.Memory [Fact] public void CreateWithModeratePooling() { + if (!TestEnvironment.Is64BitProcess) + { + // can lead to OutOfMemoryException + return; + } + this.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling(); Assert.False(this.CheckIsRentingPooledBuffer(2048 * 2048)); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs index 21174d9e71..530ff8ee7e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs @@ -169,6 +169,7 @@ namespace SixLabors.ImageSharp.Tests { comparer = ImageComparer.Tolerant(0.5f / 100); } + using (Image image = provider.GetImage()) { image.Mutate(process); @@ -192,12 +193,17 @@ namespace SixLabors.ImageSharp.Tests ImageComparer comparer = null) where TPixel : struct, IPixel { + if (comparer == null) + { + comparer = ImageComparer.Tolerant(0.5f / 100); + } + using (Image image = provider.GetImage()) { var bounds = new Rectangle(image.Width / 4, image.Width / 4, image.Width / 2, image.Height / 2); image.Mutate(x => process(x, bounds)); image.DebugSave(provider, testOutputDetails); - image.CompareToReferenceOutput(provider, testOutputDetails); + image.CompareToReferenceOutput(comparer, provider, testOutputDetails); } }