Browse Source

updated unit test to be in line with the other tests

af/merge-core
popow 7 years ago
parent
commit
c4d80dbbf4
  1. 33
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  2. 1
      tests/ImageSharp.Tests/TestImages.cs

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

@ -11,6 +11,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
using static TestImages.Bmp;
public class BmpDecoderTests
@ -88,33 +89,15 @@ namespace SixLabors.ImageSharp.Tests
}
}
[Fact]
public void DecodeOs22XShortHeader_VeryfyDimensions()
{
string imagePath = @"Bmp/pal8os2v2-16.bmp";
var testFile = TestFile.Create(imagePath);
using (var stream = new MemoryStream(testFile.Bytes, false))
{
var decoder = new BmpDecoder();
using (Image<Rgba32> image = decoder.Decode<Rgba32>(Configuration.Default, stream))
{
Assert.Equal(127, image.Width);
Assert.Equal(64, image.Height);
}
}
}
[Fact]
public void IdentifyOs22XShortHeader_VeryfyDimensions()
[Theory]
[WithFile(Os2v2Short, PixelTypes.Rgba32)]
public void BmpDecoder_CanDecode_Os2v2XShortHeader<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
string imagePath = @"Bmp/pal8os2v2-16.bmp";
var testFile = TestFile.Create(imagePath);
using (var stream = new MemoryStream(testFile.Bytes, false))
using (Image<TPixel> image = provider.GetImage(new BmpDecoder()))
{
IImageInfo imageInfo = Image.Identify(stream);
Assert.Equal(127, imageInfo.Width);
Assert.Equal(64, imageInfo.Height);
Assert.Equal(8, imageInfo.PixelType.BitsPerPixel);
image.DebugSave(provider, "png");
image.CompareToOriginal(provider);
}
}
}

1
tests/ImageSharp.Tests/TestImages.cs

@ -201,6 +201,7 @@ 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";
public const string Os2v2Short = "Bmp/pal8os2v2-16.bmp";
public static readonly string[] All
= {

Loading…
Cancel
Save