Browse Source

Add unit test for issue #1014

af/merge-core
Brian Popow 7 years ago
parent
commit
c3d5f4bd29
  1. 24
      tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
  2. 8
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Png/issues/Issue_1014_1.png
  4. 3
      tests/Images/Input/Png/issues/Issue_1014_2.png
  5. 3
      tests/Images/Input/Png/issues/Issue_1014_3.png
  6. 3
      tests/Images/Input/Png/issues/Issue_1014_4.png
  7. 3
      tests/Images/Input/Png/issues/Issue_1014_5.png
  8. 3
      tests/Images/Input/Png/issues/Issue_1014_6.png

24
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs

@ -75,6 +75,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
TestImages.Png.GrayAlpha8BitInterlaced
};
public static readonly string[] TestImagesIssue1014 =
{
TestImages.Png.Issue1014_1, TestImages.Png.Issue1014_2,
TestImages.Png.Issue1014_3, TestImages.Png.Issue1014_4,
TestImages.Png.Issue1014_5, TestImages.Png.Issue1014_6
};
[Theory]
[WithFileCollection(nameof(CommonTestImages), PixelTypes.Rgba32)]
public void Decode<TPixel>(TestImageProvider<TPixel> provider)
@ -199,5 +206,22 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
Assert.Equal(expectedPixelSize, Image.Identify(stream)?.PixelType?.BitsPerPixel);
}
}
[Theory]
[WithFileCollection(nameof(TestImagesIssue1014), PixelTypes.Rgba32)]
public void Issue1014<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
System.Exception ex = Record.Exception(
() =>
{
using (Image<TPixel> image = provider.GetImage(new PngDecoder()))
{
image.DebugSave(provider);
// TODO: compare to expected output
}
});
Assert.Null(ex);
}
}
}

8
tests/ImageSharp.Tests/TestImages.cs

@ -82,6 +82,14 @@ namespace SixLabors.ImageSharp.Tests
public const string Ducky = "Png/ducky.png";
public const string Rainbow = "Png/rainbow.png";
// Issue 1014: https://github.com/SixLabors/ImageSharp/issues/1014
public const string Issue1014_1 = "Png/issues/Issue_1014_1.png";
public const string Issue1014_2 = "Png/issues/Issue_1014_2.png";
public const string Issue1014_3 = "Png/issues/Issue_1014_3.png";
public const string Issue1014_4 = "Png/issues/Issue_1014_4.png";
public const string Issue1014_5 = "Png/issues/Issue_1014_5.png";
public const string Issue1014_6 = "Png/issues/Issue_1014_6.png";
public static class Bad
{
// Odd chunk lengths

3
tests/Images/Input/Png/issues/Issue_1014_1.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e986d0ff909fc92b0f325c6012ca4123674b239c54647bbdf3fc0c7ace3e4327
size 3965

3
tests/Images/Input/Png/issues/Issue_1014_2.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e042b3aa6c17db70a9fe7fda4fae1c90388d32480ac44e9f87341279c845fd11
size 6626

3
tests/Images/Input/Png/issues/Issue_1014_3.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6ca6190682c99ec1c00fe2bac7fee86902bcf8a2db43a781452bf137eb1b962a
size 4157

3
tests/Images/Input/Png/issues/Issue_1014_4.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03c6ee008225ac18f2966842772d5afa64e318f41b552c3d63d1a9fdd3544eff
size 3328

3
tests/Images/Input/Png/issues/Issue_1014_5.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1163cd03933f2b23e1ae27baa848a5c2d3f41f0b3457a33dd9523c40e610076b
size 4085

3
tests/Images/Input/Png/issues/Issue_1014_6.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c60f7be42794764f970149dd967bcd15c2f7f783b82a3edf528e7556eeb6c806
size 2114
Loading…
Cancel
Save