diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs index dc858f950..2d6a5474d 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs +++ b/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 image = decoder.Decode(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(TestImageProvider provider) + where TPixel : struct, IPixel { - string imagePath = @"Bmp/pal8os2v2-16.bmp"; - var testFile = TestFile.Create(imagePath); - using (var stream = new MemoryStream(testFile.Bytes, false)) + using (Image 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); } } } diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 1144a3f7c..8e226d337 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/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 = {