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

1
tests/ImageSharp.Tests/TestImages.cs

@ -201,6 +201,7 @@ namespace SixLabors.ImageSharp.Tests
public const string Bit16 = "Bmp/test16.bmp"; public const string Bit16 = "Bmp/test16.bmp";
public const string Bit16Inverted = "Bmp/test16-inverted.bmp"; public const string Bit16Inverted = "Bmp/test16-inverted.bmp";
public const string Bit32Rgb = "Bmp/rgb32.bmp"; public const string Bit32Rgb = "Bmp/rgb32.bmp";
public const string Os2v2Short = "Bmp/pal8os2v2-16.bmp";
public static readonly string[] All public static readonly string[] All
= { = {

Loading…
Cancel
Save