Browse Source

Add Magick compatible input image

pull/1851/head
Ynse Hoornenborg 4 years ago
parent
commit
1aa27bd3ef
  1. 5
      tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs
  2. 8
      tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs
  3. 2
      tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs
  4. 2
      tests/ImageSharp.Tests/TestImages.cs
  5. 3
      tests/Images/Input/Pbm/grayscale_plain_magick.pgm
  6. 3
      tests/Images/Input/Pbm/rgb_plain_magick.ppm

5
tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs

@ -4,7 +4,6 @@
using System.IO;
using SixLabors.ImageSharp.Formats.Pbm;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Xunit;
using static SixLabors.ImageSharp.Tests.TestImages.Pbm;
@ -18,9 +17,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
[InlineData(BlackAndWhitePlain, PbmColorType.BlackAndWhite)]
[InlineData(BlackAndWhiteBinary, PbmColorType.BlackAndWhite)]
[InlineData(GrayscalePlain, PbmColorType.Grayscale)]
[InlineData(GrayscalePlainMagick, PbmColorType.Grayscale)]
[InlineData(GrayscaleBinary, PbmColorType.Grayscale)]
[InlineData(GrayscaleBinaryWide, PbmColorType.Grayscale)]
[InlineData(RgbPlain, PbmColorType.Rgb)]
[InlineData(RgbPlainMagick, PbmColorType.Rgb)]
[InlineData(RgbBinary, PbmColorType.Rgb)]
public void ImageLoadCanDecode(string imagePath, PbmColorType expectedColorType)
{
@ -42,6 +43,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
[InlineData(BlackAndWhitePlain)]
[InlineData(BlackAndWhiteBinary)]
[InlineData(GrayscalePlain)]
[InlineData(GrayscalePlainMagick)]
[InlineData(GrayscaleBinary)]
[InlineData(GrayscaleBinaryWide)]
public void ImageLoadL8CanDecode(string imagePath)
@ -59,6 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
[Theory]
[InlineData(RgbPlain)]
[InlineData(RgbPlainMagick)]
[InlineData(RgbBinary)]
public void ImageLoadRgb24CanDecode(string imagePath)
{

8
tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs

@ -93,24 +93,20 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
public void PbmEncoder_P4_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestPbmEncoderCore(provider, PbmColorType.BlackAndWhite, PbmEncoding.Binary);
/* Disabled as Magick throws an error reading the input image
[Theory]
[WithFile(GrayscalePlain, PixelTypes.Rgb24)]
[WithFile(GrayscalePlainMagick, PixelTypes.Rgb24)]
public void PbmEncoder_P2_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestPbmEncoderCore(provider, PbmColorType.Grayscale, PbmEncoding.Plain);
*/
[Theory]
[WithFile(GrayscaleBinary, PixelTypes.Rgb24)]
public void PbmEncoder_P5_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestPbmEncoderCore(provider, PbmColorType.Grayscale, PbmEncoding.Binary);
/* Disabled as Magick throws an error reading the input image
[Theory]
[WithFile(RgbPlain, PixelTypes.Rgb24)]
[WithFile(RgbPlainMagick, PixelTypes.Rgb24)]
public void PbmEncoder_P3_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestPbmEncoderCore(provider, PbmColorType.Rgb, PbmEncoding.Plain);
*/
[Theory]
[WithFile(RgbBinary, PixelTypes.Rgb24)]

2
tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs

@ -18,6 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
[InlineData(BlackAndWhiteBinary)]
[InlineData(GrayscalePlain)]
[InlineData(GrayscalePlainNormalized)]
[InlineData(GrayscalePlainMagick)]
[InlineData(GrayscaleBinary)]
public void PbmGrayscaleImageCanRoundTrip(string imagePath)
{
@ -38,6 +39,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm
[Theory]
[InlineData(RgbPlain)]
[InlineData(RgbPlainNormalized)]
[InlineData(RgbPlainMagick)]
[InlineData(RgbBinary)]
public void PbmColorImageCanRoundTrip(string imagePath)
{

2
tests/ImageSharp.Tests/TestImages.cs

@ -875,9 +875,11 @@ namespace SixLabors.ImageSharp.Tests
public const string GrayscaleBinaryWide = "Pbm/Gene-UP WebSocket RunImageMask.pgm";
public const string GrayscalePlain = "Pbm/grayscale_plain.pgm";
public const string GrayscalePlainNormalized = "Pbm/grayscale_plain_normalized.pgm";
public const string GrayscalePlainMagick = "Pbm/grayscale_plain_magick.pgm";
public const string RgbBinary = "Pbm/00000_00000.ppm";
public const string RgbPlain = "Pbm/rgb_plain.ppm";
public const string RgbPlainNormalized = "Pbm/rgb_plain_normalized.ppm";
public const string RgbPlainMagick = "Pbm/rgb_plain_magick.ppm";
}
}
}

3
tests/Images/Input/Pbm/grayscale_plain_magick.pgm

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

3
tests/Images/Input/Pbm/rgb_plain_magick.ppm

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