Browse Source

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

af/merge-core
popow 7 years ago
parent
commit
a6919d4b15
  1. 24
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  2. 3
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Bmp/pal8-0.bmp
  4. 3
      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
= {

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

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

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

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