From 19d18e9949563cf3f18de56d6a0bb18fb8ecf1d8 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Fri, 25 Jun 2021 13:23:02 +0200 Subject: [PATCH] Do not skip 4-bit and 1-bit bmp tests on linux --- .../Formats/Bmp/BmpDecoderTests.cs | 27 ++++---------- .../Formats/Bmp/BmpEncoderTests.cs | 36 +++---------------- 2 files changed, 11 insertions(+), 52 deletions(-) diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs index ef245d4d0d..2b42b65f00 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs @@ -138,12 +138,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp using (Image image = provider.GetImage(BmpDecoder)) { 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); } } @@ -202,15 +197,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit_WithDelta(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black })) + RleSkippedPixelHandling skippedPixelHandling = TestEnvironment.IsWindows ? RleSkippedPixelHandling.Black : RleSkippedPixelHandling.FirstColorOfPalette; + using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = skippedPixelHandling })) { 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); } } @@ -219,15 +210,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void BmpDecoder_CanDecode_RunLengthEncoded_4Bit(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = RleSkippedPixelHandling.Black })) + RleSkippedPixelHandling skippedPixelHandling = TestEnvironment.IsWindows ? RleSkippedPixelHandling.Black : RleSkippedPixelHandling.FirstColorOfPalette; + using (Image image = provider.GetImage(new BmpDecoder { RleSkippedPixelHandling = skippedPixelHandling })) { 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); } } diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs index 70079ee6e5..36619efdfe 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs @@ -179,56 +179,28 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp public void Encode_4Bit_WithV3Header_Works( TestImageProvider provider, BmpBitsPerPixel bitsPerPixel) - where TPixel : unmanaged, IPixel - { - // The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows. - if (TestEnvironment.IsWindows) - { - TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false); - } - } + where TPixel : unmanaged, IPixel => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false); [Theory] [WithFile(Bit4, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel4)] public void Encode_4Bit_WithV4Header_Works( TestImageProvider provider, BmpBitsPerPixel bitsPerPixel) - where TPixel : unmanaged, IPixel - { - // The Magick Reference Decoder can not decode 4-Bit bitmaps, so only execute this on windows. - if (TestEnvironment.IsWindows) - { - TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true); - } - } + where TPixel : unmanaged, IPixel => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true); [Theory] [WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)] public void Encode_1Bit_WithV3Header_Works( TestImageProvider provider, BmpBitsPerPixel bitsPerPixel) - where TPixel : unmanaged, IPixel - { - // The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows. - if (TestEnvironment.IsWindows) - { - TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false); - } - } + where TPixel : unmanaged, IPixel => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false); [Theory] [WithFile(Bit1, PixelTypes.Rgba32, BmpBitsPerPixel.Pixel1)] public void Encode_1Bit_WithV4Header_Works( TestImageProvider provider, BmpBitsPerPixel bitsPerPixel) - where TPixel : unmanaged, IPixel - { - // The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows. - if (TestEnvironment.IsWindows) - { - TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true); - } - } + where TPixel : unmanaged, IPixel => TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true); [Theory] [WithFile(Bit8Gs, PixelTypes.L8, BmpBitsPerPixel.Pixel8)]