Browse Source

added Test for decoding windows BMPv2 and one for a bitmap which has 4 bytes per color palette

pull/792/head
popow 7 years ago
parent
commit
0e41c13d3c
  1. 24
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  2. 3
      tests/ImageSharp.Tests/TestImages.cs
  3. BIN
      tests/Images/Input/Bmp/pal8-0.bmp
  4. BIN
      tests/Images/Input/Bmp/pal8os2v1_winv2.bmp

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

@ -55,6 +55,30 @@ namespace SixLabors.ImageSharp.Tests
}
}
[Theory]
[WithFile(WinBmpv2, PixelTypes.Rgba32)]
public void BmpDecoder_CanDecodeBmpv2<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(new BmpDecoder()))
{
image.DebugSave(provider, "png");
image.CompareToOriginal(provider);
}
}
[Theory]
[WithFile(Bit8Palette4, PixelTypes.Rgba32)]
public void BmpDecoder_CanDecode4BytePerEntryPalette<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(new BmpDecoder()))
{
image.DebugSave(provider, "png");
image.CompareToOriginal(provider);
}
}
[Theory]
[InlineData(Car, 24)]
[InlineData(F, 24)]

3
tests/ImageSharp.Tests/TestImages.cs

@ -201,6 +201,9 @@ namespace SixLabors.ImageSharp.Tests
public const string Bit16 = "Bmp/test16.bmp";
public const string Bit16Inverted = "Bmp/test16-inverted.bmp";
public const string Bit32Rgb = "Bmp/rgb32.bmp";
// Note: This format can be called OS/2 BMPv1, or Windows BMPv2
public const string WinBmpv2 = "Bmp/pal8os2v1_winv2.bmp";
public const string Bit8Palette4 = "Bmp/pal8-0.bmp";
public static readonly string[] All
= {

BIN
tests/Images/Input/Bmp/pal8-0.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
tests/Images/Input/Bmp/pal8os2v1_winv2.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Loading…
Cancel
Save