Browse Source

Merge branch 'master' into feature/fix-576

pull/591/head
Anton Firsov 8 years ago
committed by GitHub
parent
commit
7ef04892fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs
  2. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs
  3. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs
  4. 8
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  5. 25
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
  6. 12
      tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

14
src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs

@ -157,13 +157,13 @@ namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers
}
finally
{
this.vwt.Dispose();
this.vmr.Dispose();
this.vmg.Dispose();
this.vmb.Dispose();
this.vma.Dispose();
this.m2.Dispose();
this.tag.Dispose();
this.vwt?.Dispose();
this.vmr?.Dispose();
this.vmg?.Dispose();
this.vmb?.Dispose();
this.vma?.Dispose();
this.m2?.Dispose();
this.tag?.Dispose();
}
}

2
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Baseline.cs

@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void DecodeBaselineJpeg_PdfJs<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess)
if (SkipTest(provider))
{
// skipping to avoid OutOfMemoryException on CI
return;

2
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Progressive.cs

@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void DecodeProgressiveJpeg_Orig<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess)
if (SkipTest(provider))
{
// skipping to avoid OutOfMemoryException on CI
return;

8
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

@ -48,11 +48,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
string[] largeImagesToSkipOn32Bit =
{
TestImages.Jpeg.Baseline.Jpeg420Exif,
TestImages.Jpeg.Issues.BadZigZagProgressive385
TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159,
TestImages.Jpeg.Issues.BadZigZagProgressive385,
TestImages.Jpeg.Issues.NoEoiProgressive517,
TestImages.Jpeg.Issues.BadRstProgressive518,
};
return TestEnvironment.RunsOnCI && !TestEnvironment.Is64BitProcess
&& largeImagesToSkipOn32Bit.Contains(provider.SourceFileOrDescription);
return !TestEnvironment.Is64BitProcess && largeImagesToSkipOn32Bit.Contains(provider.SourceFileOrDescription);
}
public JpegDecoderTests(ITestOutputHelper output)

25
tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs

@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Tests
public bool Equals(Key other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
if (!this.commonValues.Equals(other.commonValues)) return false;
@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return this.Equals((Key)obj);
@ -133,15 +133,14 @@ namespace SixLabors.ImageSharp.Tests
{
Guard.NotNull(decoder, nameof(decoder));
Key key = new Key(this.PixelType, this.FilePath, decoder);
if (!TestEnvironment.Is64BitProcess)
{
return LoadImage(decoder);
}
Image<TPixel> cachedImage = cache.GetOrAdd(
key,
fn =>
{
var testFile = TestFile.Create(this.FilePath);
return Image.Load<TPixel>(this.Configuration, testFile.Bytes, decoder);
});
var key = new Key(this.PixelType, this.FilePath, decoder);
Image<TPixel> cachedImage = cache.GetOrAdd(key, fn => { return LoadImage(decoder); });
return cachedImage.Clone();
}
@ -158,6 +157,12 @@ namespace SixLabors.ImageSharp.Tests
base.Serialize(info);
info.AddValue("path", this.FilePath);
}
private Image<TPixel> LoadImage(IImageDecoder decoder)
{
var testFile = TestFile.Create(this.FilePath);
return Image.Load<TPixel>(this.Configuration, testFile.Bytes, decoder);
}
}
public static string GetFilePathOrNull(ITestImageProvider provider)

12
tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

@ -121,6 +121,12 @@ namespace SixLabors.ImageSharp.Tests
public void GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (!TestEnvironment.Is64BitProcess)
{
// We don't cache with the 32 bit build.
return;
}
Assert.NotNull(provider.Utility.SourceFileOrDescription);
TestDecoder.DoTestThreadSafe(() =>
@ -179,6 +185,12 @@ namespace SixLabors.ImageSharp.Tests
public void GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
if (!TestEnvironment.Is64BitProcess)
{
// We don't cache with the 32 bit build.
return;
}
Assert.NotNull(provider.Utility.SourceFileOrDescription);
TestDecoderWithParameters.DoTestThreadSafe(() =>

Loading…
Cancel
Save