Browse Source

Merge pull request #1678 from SixLabors/bp/bmptests

Do not skip 4-bit and 1-bit bmp tests on linux
pull/1680/head
Anton Firszov 5 years ago
committed by GitHub
parent
commit
dcd9890c9d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  2. 26
      tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs

21
tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs

@ -138,14 +138,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
using (Image<TPixel> image = provider.GetImage(BmpDecoder)) using (Image<TPixel> image = provider.GetImage(BmpDecoder))
{ {
image.DebugSave(provider); image.DebugSave(provider);
// The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{
image.CompareToOriginal(provider); image.CompareToOriginal(provider);
} }
} }
}
[Theory] [Theory]
[WithFile(Bit8, PixelTypes.Rgba32)] [WithFile(Bit8, PixelTypes.Rgba32)]
@ -202,34 +197,26 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit_WithDelta<TPixel>(TestImageProvider<TPixel> provider) public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit_WithDelta<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black })) RleSkippedPixelHandling skippedPixelHandling = TestEnvironment.IsWindows ? RleSkippedPixelHandling.Black : RleSkippedPixelHandling.FirstColorOfPalette;
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = skippedPixelHandling }))
{ {
image.DebugSave(provider); image.DebugSave(provider);
// The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{
image.CompareToOriginal(provider); image.CompareToOriginal(provider);
} }
} }
}
[Theory] [Theory]
[WithFile(RLE4, PixelTypes.Rgba32)] [WithFile(RLE4, PixelTypes.Rgba32)]
public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit<TPixel>(TestImageProvider<TPixel> provider) public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black })) RleSkippedPixelHandling skippedPixelHandling = TestEnvironment.IsWindows ? RleSkippedPixelHandling.Black : RleSkippedPixelHandling.FirstColorOfPalette;
using (Image<TPixel> image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = skippedPixelHandling }))
{ {
image.DebugSave(provider); image.DebugSave(provider);
// The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{
image.CompareToOriginal(provider); image.CompareToOriginal(provider);
} }
} }
}
[Theory] [Theory]
[WithFile(RLE8Cut, PixelTypes.Rgba32)] [WithFile(RLE8Cut, PixelTypes.Rgba32)]

26
tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs

@ -180,9 +180,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
TestImageProvider<TPixel> provider, TestImageProvider<TPixel> provider,
BmpBitsPerPixel bitsPerPixel) BmpBitsPerPixel bitsPerPixel)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{
// The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{ {
// Oddly the difference only happens locally but we'll not test for that. // Oddly the difference only happens locally but we'll not test for that.
// I suspect the issue is with the reference codec. // I suspect the issue is with the reference codec.
@ -192,7 +189,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false, customComparer: comparer); TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false, customComparer: comparer);
} }
}
[Theory] [Theory]
[WithFile(Bit4, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel4)] [WithFile(Bit4, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel4)]
@ -200,9 +196,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
TestImageProvider<TPixel> provider, TestImageProvider<TPixel> provider,
BmpBitsPerPixel bitsPerPixel) BmpBitsPerPixel bitsPerPixel)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{
// The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{ {
// Oddly the difference only happens locally but we'll not test for that. // Oddly the difference only happens locally but we'll not test for that.
// I suspect the issue is with the reference codec. // I suspect the issue is with the reference codec.
@ -212,35 +205,20 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true, customComparer: comparer); TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true, customComparer: comparer);
} }
}
[Theory] [Theory]
[WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)] [WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)]
public void Encode_1Bit_WithV3Header_Works<TPixel>( public void Encode_1Bit_WithV3Header_Works<TPixel>(
TestImageProvider<TPixel> provider, TestImageProvider<TPixel> provider,
BmpBitsPerPixel bitsPerPixel) BmpBitsPerPixel bitsPerPixel)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel> => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false);
{
// The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false);
}
}
[Theory] [Theory]
[WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)] [WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)]
public void Encode_1Bit_WithV4Header_Works<TPixel>( public void Encode_1Bit_WithV4Header_Works<TPixel>(
TestImageProvider<TPixel> provider, TestImageProvider<TPixel> provider,
BmpBitsPerPixel bitsPerPixel) BmpBitsPerPixel bitsPerPixel)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel> => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true);
{
// The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows.
if (TestEnvironment.IsWindows)
{
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true);
}
}
[Theory] [Theory]
[WithFile(Bit8Gs, PixelTypes.L8, BmpBitsPerPixel.Pixel8)] [WithFile(Bit8Gs, PixelTypes.L8, BmpBitsPerPixel.Pixel8)]

Loading…
Cancel
Save