diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdEntryTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdEntryTests.cs index 846495f671..8cd7e4e9e9 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdEntryTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdEntryTests.cs @@ -16,20 +16,20 @@ namespace ImageSharp.Tests public class TiffDecoderIfdEntryTests { [Theory] - [InlineDataAttribute(TiffType.Byte, 1u, 1u)] - [InlineDataAttribute(TiffType.Ascii, 1u, 1u)] - [InlineDataAttribute(TiffType.Short, 1u, 2u)] - [InlineDataAttribute(TiffType.Long, 1u, 4u)] - [InlineDataAttribute(TiffType.Rational, 1u, 8u)] - [InlineDataAttribute(TiffType.SByte, 1u, 1u)] - [InlineDataAttribute(TiffType.Undefined, 1u, 1u)] - [InlineDataAttribute(TiffType.SShort, 1u, 2u)] - [InlineDataAttribute(TiffType.SLong, 1u, 4u)] - [InlineDataAttribute(TiffType.SRational, 1u, 8u)] - [InlineDataAttribute(TiffType.Float, 1u, 4u)] - [InlineDataAttribute(TiffType.Double, 1u, 8u)] - [InlineDataAttribute(TiffType.Ifd, 1u, 4u)] - [InlineDataAttribute((TiffType)999, 1u, 0u)] + [InlineDataAttribute((ushort)TiffType.Byte, 1u, 1u)] + [InlineDataAttribute((ushort)TiffType.Ascii, 1u, 1u)] + [InlineDataAttribute((ushort)TiffType.Short, 1u, 2u)] + [InlineDataAttribute((ushort)TiffType.Long, 1u, 4u)] + [InlineDataAttribute((ushort)TiffType.Rational, 1u, 8u)] + [InlineDataAttribute((ushort)TiffType.SByte, 1u, 1u)] + [InlineDataAttribute((ushort)TiffType.Undefined, 1u, 1u)] + [InlineDataAttribute((ushort)TiffType.SShort, 1u, 2u)] + [InlineDataAttribute((ushort)TiffType.SLong, 1u, 4u)] + [InlineDataAttribute((ushort)TiffType.SRational, 1u, 8u)] + [InlineDataAttribute((ushort)TiffType.Float, 1u, 4u)] + [InlineDataAttribute((ushort)TiffType.Double, 1u, 8u)] + [InlineDataAttribute((ushort)TiffType.Ifd, 1u, 4u)] + [InlineDataAttribute((ushort)999, 1u, 0u)] public void GetSizeOfData_SingleItem_ReturnsCorrectSize(ushort type, uint count, uint expectedSize) { TiffIfdEntry entry = new TiffIfdEntry(TiffTags.ImageWidth, (TiffType)type, count, new byte[4]); @@ -38,20 +38,20 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, 15u, 15u)] - [InlineDataAttribute(TiffType.Ascii, 20u, 20u)] - [InlineDataAttribute(TiffType.Short, 18u, 36u)] - [InlineDataAttribute(TiffType.Long, 4u, 16u)] - [InlineDataAttribute(TiffType.Rational, 9u, 72u)] - [InlineDataAttribute(TiffType.SByte, 5u, 5u)] - [InlineDataAttribute(TiffType.Undefined, 136u, 136u)] - [InlineDataAttribute(TiffType.SShort, 12u, 24u)] - [InlineDataAttribute(TiffType.SLong, 15u, 60u)] - [InlineDataAttribute(TiffType.SRational, 10u, 80u)] - [InlineDataAttribute(TiffType.Float, 2u, 8u)] - [InlineDataAttribute(TiffType.Double, 2u, 16u)] - [InlineDataAttribute(TiffType.Ifd, 10u, 40u)] - [InlineDataAttribute((TiffType)999, 1050u, 0u)] + [InlineDataAttribute((ushort)TiffType.Byte, 15u, 15u)] + [InlineDataAttribute((ushort)TiffType.Ascii, 20u, 20u)] + [InlineDataAttribute((ushort)TiffType.Short, 18u, 36u)] + [InlineDataAttribute((ushort)TiffType.Long, 4u, 16u)] + [InlineDataAttribute((ushort)TiffType.Rational, 9u, 72u)] + [InlineDataAttribute((ushort)TiffType.SByte, 5u, 5u)] + [InlineDataAttribute((ushort)TiffType.Undefined, 136u, 136u)] + [InlineDataAttribute((ushort)TiffType.SShort, 12u, 24u)] + [InlineDataAttribute((ushort)TiffType.SLong, 15u, 60u)] + [InlineDataAttribute((ushort)TiffType.SRational, 10u, 80u)] + [InlineDataAttribute((ushort)TiffType.Float, 2u, 8u)] + [InlineDataAttribute((ushort)TiffType.Double, 2u, 16u)] + [InlineDataAttribute((ushort)TiffType.Ifd, 10u, 40u)] + [InlineDataAttribute((ushort)999, 1050u, 0u)] public void GetSizeOfData_Array_ReturnsCorrectSize(ushort type, uint count, uint expectedSize) { TiffIfdEntry entry = new TiffIfdEntry(TiffTags.ImageWidth, (TiffType)type, count, new byte[4]); @@ -60,28 +60,28 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, 1u, new byte[] { 17 }, false)] - [InlineDataAttribute(TiffType.Byte, 1u, new byte[] { 17 }, true)] - [InlineDataAttribute(TiffType.Byte, 2u, new byte[] { 17, 28 }, false)] - [InlineDataAttribute(TiffType.Byte, 2u, new byte[] { 17, 28 }, true)] - [InlineDataAttribute(TiffType.Byte, 4u, new byte[] { 17, 28, 2, 9 }, false)] - [InlineDataAttribute(TiffType.Byte, 4u, new byte[] { 17, 28, 2, 9 }, true)] - [InlineDataAttribute(TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, false)] - [InlineDataAttribute(TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, true)] - [InlineDataAttribute(TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, false)] - [InlineDataAttribute(TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, true)] - [InlineDataAttribute(TiffType.Short, 1u, new byte[] { 17, 28 }, false)] - [InlineDataAttribute(TiffType.Short, 1u, new byte[] { 17, 28 }, true)] - [InlineDataAttribute(TiffType.Short, 2u, new byte[] { 17, 28, 2, 9 }, false)] - [InlineDataAttribute(TiffType.Short, 2u, new byte[] { 17, 28, 2, 9 }, true)] - [InlineDataAttribute(TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, false)] - [InlineDataAttribute(TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, true)] - [InlineDataAttribute(TiffType.Long, 1u, new byte[] { 17, 28, 2, 9 }, false)] - [InlineDataAttribute(TiffType.Long, 1u, new byte[] { 17, 28, 2, 9 }, true)] - [InlineDataAttribute(TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] - [InlineDataAttribute(TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] - [InlineDataAttribute(TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] - [InlineDataAttribute(TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 1u, new byte[] { 17 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 1u, new byte[] { 17 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 2u, new byte[] { 17, 28 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 2u, new byte[] { 17, 28 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 4u, new byte[] { 17, 28, 2, 9 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 4u, new byte[] { 17, 28, 2, 9 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, true)] + [InlineDataAttribute((ushort)TiffType.Short, 1u, new byte[] { 17, 28 }, false)] + [InlineDataAttribute((ushort)TiffType.Short, 1u, new byte[] { 17, 28 }, true)] + [InlineDataAttribute((ushort)TiffType.Short, 2u, new byte[] { 17, 28, 2, 9 }, false)] + [InlineDataAttribute((ushort)TiffType.Short, 2u, new byte[] { 17, 28, 2, 9 }, true)] + [InlineDataAttribute((ushort)TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, false)] + [InlineDataAttribute((ushort)TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, true)] + [InlineDataAttribute((ushort)TiffType.Long, 1u, new byte[] { 17, 28, 2, 9 }, false)] + [InlineDataAttribute((ushort)TiffType.Long, 1u, new byte[] { 17, 28, 2, 9 }, true)] + [InlineDataAttribute((ushort)TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] + [InlineDataAttribute((ushort)TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] + [InlineDataAttribute((ushort)TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] + [InlineDataAttribute((ushort)TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] public void ReadBytes_ReturnsExpectedData(ushort type, uint count, byte[] bytes, bool isLittleEndian) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, count, bytes), isLittleEndian); @@ -95,16 +95,16 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, false)] - [InlineDataAttribute(TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, true)] - [InlineDataAttribute(TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, false)] - [InlineDataAttribute(TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, true)] - [InlineDataAttribute(TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, false)] - [InlineDataAttribute(TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, true)] - [InlineDataAttribute(TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] - [InlineDataAttribute(TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] - [InlineDataAttribute(TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] - [InlineDataAttribute(TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 5u, new byte[] { 17, 28, 2, 9, 13 }, true)] + [InlineDataAttribute((ushort)TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, false)] + [InlineDataAttribute((ushort)TiffType.Byte, 10u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2, 127, 86 }, true)] + [InlineDataAttribute((ushort)TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, false)] + [InlineDataAttribute((ushort)TiffType.Short, 3u, new byte[] { 17, 28, 2, 9, 13, 37 }, true)] + [InlineDataAttribute((ushort)TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] + [InlineDataAttribute((ushort)TiffType.Long, 2u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] + [InlineDataAttribute((ushort)TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, false)] + [InlineDataAttribute((ushort)TiffType.Rational, 1u, new byte[] { 17, 28, 2, 9, 13, 37, 18, 2 }, true)] public void ReadBytes_CachesDataLongerThanFourBytes(ushort type, uint count, byte[] bytes, bool isLittleEndian) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, count, bytes), isLittleEndian); @@ -118,36 +118,36 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, true, new byte[] { 0, 1, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.Byte, true, new byte[] { 1, 2, 3, 4 }, 1)] - [InlineDataAttribute(TiffType.Byte, true, new byte[] { 255, 2, 3, 4 }, 255)] - [InlineDataAttribute(TiffType.Byte, false, new byte[] { 0, 1, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.Byte, false, new byte[] { 1, 2, 3, 4 }, 1)] - [InlineDataAttribute(TiffType.Byte, false, new byte[] { 255, 2, 3, 4 }, 255)] - [InlineDataAttribute(TiffType.Short, true, new byte[] { 0, 0, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.Short, true, new byte[] { 1, 0, 2, 3 }, 1)] - [InlineDataAttribute(TiffType.Short, true, new byte[] { 0, 1, 2, 3 }, 256)] - [InlineDataAttribute(TiffType.Short, true, new byte[] { 2, 1, 2, 3 }, 258)] - [InlineDataAttribute(TiffType.Short, true, new byte[] { 255, 255, 2, 3 }, UInt16.MaxValue)] - [InlineDataAttribute(TiffType.Short, false, new byte[] { 0, 0, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.Short, false, new byte[] { 0, 1, 2, 3 }, 1)] - [InlineDataAttribute(TiffType.Short, false, new byte[] { 1, 0, 2, 3 }, 256)] - [InlineDataAttribute(TiffType.Short, false, new byte[] { 1, 2, 2, 3 }, 258)] - [InlineDataAttribute(TiffType.Short, false, new byte[] { 255, 255, 2, 3 }, UInt16.MaxValue)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 0, 0, 0, 0 }, 0)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 1, 0, 0, 0 }, 1)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 0, 1, 0, 0 }, 256)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 0, 0, 1, 0 }, 256 * 256)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 0, 0, 0, 1 }, 256 * 256 * 256)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 1, 2, 3, 4 }, 67305985)] - [InlineDataAttribute(TiffType.Long, true, new byte[] { 255, 255, 255, 255 }, UInt32.MaxValue)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 0, 0, 0, 0 }, 0)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 0, 0, 0, 1 }, 1)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 0, 0, 1, 0 }, 256)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 0, 1, 0, 0 }, 256 * 256)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 1, 0, 0, 0 }, 256 * 256 * 256)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 4, 3, 2, 1 }, 67305985)] - [InlineDataAttribute(TiffType.Long, false, new byte[] { 255, 255, 255, 255 }, UInt32.MaxValue)] + [InlineDataAttribute((ushort)TiffType.Byte, true, new byte[] { 0, 1, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.Byte, true, new byte[] { 1, 2, 3, 4 }, 1)] + [InlineDataAttribute((ushort)TiffType.Byte, true, new byte[] { 255, 2, 3, 4 }, 255)] + [InlineDataAttribute((ushort)TiffType.Byte, false, new byte[] { 0, 1, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.Byte, false, new byte[] { 1, 2, 3, 4 }, 1)] + [InlineDataAttribute((ushort)TiffType.Byte, false, new byte[] { 255, 2, 3, 4 }, 255)] + [InlineDataAttribute((ushort)TiffType.Short, true, new byte[] { 0, 0, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.Short, true, new byte[] { 1, 0, 2, 3 }, 1)] + [InlineDataAttribute((ushort)TiffType.Short, true, new byte[] { 0, 1, 2, 3 }, 256)] + [InlineDataAttribute((ushort)TiffType.Short, true, new byte[] { 2, 1, 2, 3 }, 258)] + [InlineDataAttribute((ushort)TiffType.Short, true, new byte[] { 255, 255, 2, 3 }, UInt16.MaxValue)] + [InlineDataAttribute((ushort)TiffType.Short, false, new byte[] { 0, 0, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.Short, false, new byte[] { 0, 1, 2, 3 }, 1)] + [InlineDataAttribute((ushort)TiffType.Short, false, new byte[] { 1, 0, 2, 3 }, 256)] + [InlineDataAttribute((ushort)TiffType.Short, false, new byte[] { 1, 2, 2, 3 }, 258)] + [InlineDataAttribute((ushort)TiffType.Short, false, new byte[] { 255, 255, 2, 3 }, UInt16.MaxValue)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 0, 0, 0, 0 }, 0)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 1, 0, 0, 0 }, 1)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 0, 1, 0, 0 }, 256)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 0, 0, 1, 0 }, 256 * 256)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 0, 0, 0, 1 }, 256 * 256 * 256)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 1, 2, 3, 4 }, 67305985)] + [InlineDataAttribute((ushort)TiffType.Long, true, new byte[] { 255, 255, 255, 255 }, UInt32.MaxValue)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 0, 0, 0, 0 }, 0)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 0, 0, 0, 1 }, 1)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 0, 0, 1, 0 }, 256)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 0, 1, 0, 0 }, 256 * 256)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 1, 0, 0, 0 }, 256 * 256 * 256)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 4, 3, 2, 1 }, 67305985)] + [InlineDataAttribute((ushort)TiffType.Long, false, new byte[] { 255, 255, 255, 255 }, UInt32.MaxValue)] public void ReadUnsignedInteger_ReturnsValue(ushort type, bool isLittleEndian, byte[] bytes, uint expectedValue) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, bytes), isLittleEndian); @@ -158,17 +158,17 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadUnsignedInteger_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -179,12 +179,12 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, true)] - [InlineDataAttribute(TiffType.Short, true)] - [InlineDataAttribute(TiffType.Long, true)] - [InlineDataAttribute(TiffType.Byte, false)] - [InlineDataAttribute(TiffType.Short, false)] - [InlineDataAttribute(TiffType.Long, false)] + [InlineDataAttribute((ushort)TiffType.Byte, true)] + [InlineDataAttribute((ushort)TiffType.Short, true)] + [InlineDataAttribute((ushort)TiffType.Long, true)] + [InlineDataAttribute((ushort)TiffType.Byte, false)] + [InlineDataAttribute((ushort)TiffType.Short, false)] + [InlineDataAttribute((ushort)TiffType.Long, false)] public void ReadUnsignedInteger_ThrowsExceptionIfCountIsNotOne(ushort type, bool isLittleEndian) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 2, new byte[4]), isLittleEndian); @@ -195,36 +195,36 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.SByte, true, new byte[] { 0, 1, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.SByte, true, new byte[] { 1, 2, 3, 4 }, 1)] - [InlineDataAttribute(TiffType.SByte, true, new byte[] { 255, 2, 3, 4 }, -1)] - [InlineDataAttribute(TiffType.SByte, false, new byte[] { 0, 1, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.SByte, false, new byte[] { 1, 2, 3, 4 }, 1)] - [InlineDataAttribute(TiffType.SByte, false, new byte[] { 255, 2, 3, 4 }, -1)] - [InlineDataAttribute(TiffType.SShort, true, new byte[] { 0, 0, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.SShort, true, new byte[] { 1, 0, 2, 3 }, 1)] - [InlineDataAttribute(TiffType.SShort, true, new byte[] { 0, 1, 2, 3 }, 256)] - [InlineDataAttribute(TiffType.SShort, true, new byte[] { 2, 1, 2, 3 }, 258)] - [InlineDataAttribute(TiffType.SShort, true, new byte[] { 255, 255, 2, 3 }, -1)] - [InlineDataAttribute(TiffType.SShort, false, new byte[] { 0, 0, 2, 3 }, 0)] - [InlineDataAttribute(TiffType.SShort, false, new byte[] { 0, 1, 2, 3 }, 1)] - [InlineDataAttribute(TiffType.SShort, false, new byte[] { 1, 0, 2, 3 }, 256)] - [InlineDataAttribute(TiffType.SShort, false, new byte[] { 1, 2, 2, 3 }, 258)] - [InlineDataAttribute(TiffType.SShort, false, new byte[] { 255, 255, 2, 3 }, -1)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 0, 0, 0, 0 }, 0)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 1, 0, 0, 0 }, 1)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 0, 1, 0, 0 }, 256)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 0, 0, 1, 0 }, 256 * 256)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 0, 0, 0, 1 }, 256 * 256 * 256)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 1, 2, 3, 4 }, 67305985)] - [InlineDataAttribute(TiffType.SLong, true, new byte[] { 255, 255, 255, 255 }, -1)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 0, 0, 0, 0 }, 0)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 0, 0, 0, 1 }, 1)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 0, 0, 1, 0 }, 256)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 0, 1, 0, 0 }, 256 * 256)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 1, 0, 0, 0 }, 256 * 256 * 256)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 4, 3, 2, 1 }, 67305985)] - [InlineDataAttribute(TiffType.SLong, false, new byte[] { 255, 255, 255, 255 }, -1)] + [InlineDataAttribute((ushort)TiffType.SByte, true, new byte[] { 0, 1, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.SByte, true, new byte[] { 1, 2, 3, 4 }, 1)] + [InlineDataAttribute((ushort)TiffType.SByte, true, new byte[] { 255, 2, 3, 4 }, -1)] + [InlineDataAttribute((ushort)TiffType.SByte, false, new byte[] { 0, 1, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.SByte, false, new byte[] { 1, 2, 3, 4 }, 1)] + [InlineDataAttribute((ushort)TiffType.SByte, false, new byte[] { 255, 2, 3, 4 }, -1)] + [InlineDataAttribute((ushort)TiffType.SShort, true, new byte[] { 0, 0, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.SShort, true, new byte[] { 1, 0, 2, 3 }, 1)] + [InlineDataAttribute((ushort)TiffType.SShort, true, new byte[] { 0, 1, 2, 3 }, 256)] + [InlineDataAttribute((ushort)TiffType.SShort, true, new byte[] { 2, 1, 2, 3 }, 258)] + [InlineDataAttribute((ushort)TiffType.SShort, true, new byte[] { 255, 255, 2, 3 }, -1)] + [InlineDataAttribute((ushort)TiffType.SShort, false, new byte[] { 0, 0, 2, 3 }, 0)] + [InlineDataAttribute((ushort)TiffType.SShort, false, new byte[] { 0, 1, 2, 3 }, 1)] + [InlineDataAttribute((ushort)TiffType.SShort, false, new byte[] { 1, 0, 2, 3 }, 256)] + [InlineDataAttribute((ushort)TiffType.SShort, false, new byte[] { 1, 2, 2, 3 }, 258)] + [InlineDataAttribute((ushort)TiffType.SShort, false, new byte[] { 255, 255, 2, 3 }, -1)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 0, 0, 0, 0 }, 0)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 1, 0, 0, 0 }, 1)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 0, 1, 0, 0 }, 256)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 0, 0, 1, 0 }, 256 * 256)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 0, 0, 0, 1 }, 256 * 256 * 256)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 1, 2, 3, 4 }, 67305985)] + [InlineDataAttribute((ushort)TiffType.SLong, true, new byte[] { 255, 255, 255, 255 }, -1)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 0, 0, 0, 0 }, 0)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 0, 0, 0, 1 }, 1)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 0, 0, 1, 0 }, 256)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 0, 1, 0, 0 }, 256 * 256)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 1, 0, 0, 0 }, 256 * 256 * 256)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 4, 3, 2, 1 }, 67305985)] + [InlineDataAttribute((ushort)TiffType.SLong, false, new byte[] { 255, 255, 255, 255 }, -1)] public void ReadSignedInteger_ReturnsValue(ushort type, bool isLittleEndian, byte[] bytes, int expectedValue) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, bytes), isLittleEndian); @@ -235,17 +235,17 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadSignedInteger_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -256,12 +256,12 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.SByte, true)] - [InlineDataAttribute(TiffType.SShort, true)] - [InlineDataAttribute(TiffType.SLong, true)] - [InlineDataAttribute(TiffType.SByte, false)] - [InlineDataAttribute(TiffType.SShort, false)] - [InlineDataAttribute(TiffType.SLong, false)] + [InlineDataAttribute((ushort)TiffType.SByte, true)] + [InlineDataAttribute((ushort)TiffType.SShort, true)] + [InlineDataAttribute((ushort)TiffType.SLong, true)] + [InlineDataAttribute((ushort)TiffType.SByte, false)] + [InlineDataAttribute((ushort)TiffType.SShort, false)] + [InlineDataAttribute((ushort)TiffType.SLong, false)] public void ReadSignedInteger_ThrowsExceptionIfCountIsNotOne(ushort type, bool isLittleEndian) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 2, new byte[4]), isLittleEndian); @@ -272,22 +272,22 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte, 1, true, new byte[] { 0, 1, 2, 3 }, new uint[] { 0 })] - [InlineDataAttribute(TiffType.Byte, 3, true, new byte[] { 0, 1, 2, 3 }, new uint[] { 0, 1, 2 })] - [InlineDataAttribute(TiffType.Byte, 7, true, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 0, 1, 2, 3, 4, 5, 6 })] - [InlineDataAttribute(TiffType.Byte, 1, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 0 })] - [InlineDataAttribute(TiffType.Byte, 3, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 0, 1, 2 })] - [InlineDataAttribute(TiffType.Byte, 7, false, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 0, 1, 2, 3, 4, 5, 6 })] - [InlineDataAttribute(TiffType.Short, 1, true, new byte[] { 1, 0, 3, 2 }, new uint[] { 1 })] - [InlineDataAttribute(TiffType.Short, 2, true, new byte[] { 1, 0, 3, 2 }, new uint[] { 1, 515 })] - [InlineDataAttribute(TiffType.Short, 3, true, new byte[] { 1, 0, 3, 2, 5, 4, 6, 7, 8 }, new uint[] { 1, 515, 1029 })] - [InlineDataAttribute(TiffType.Short, 1, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 1 })] - [InlineDataAttribute(TiffType.Short, 2, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 1, 515 })] - [InlineDataAttribute(TiffType.Short, 3, false, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 1, 515, 1029 })] - [InlineDataAttribute(TiffType.Long, 1, true, new byte[] { 4, 3, 2, 1 }, new uint[] { 0x01020304 })] - [InlineDataAttribute(TiffType.Long, 2, true, new byte[] { 4, 3, 2, 1, 6, 5, 4, 3, 99, 99 }, new uint[] { 0x01020304, 0x03040506 })] - [InlineDataAttribute(TiffType.Long, 1, false, new byte[] { 1, 2, 3, 4 }, new uint[] { 0x01020304 })] - [InlineDataAttribute(TiffType.Long, 2, false, new byte[] { 1, 2, 3, 4, 3, 4, 5, 6, 99, 99 }, new uint[] { 0x01020304, 0x03040506 })] + [InlineDataAttribute((ushort)TiffType.Byte, 1, true, new byte[] { 0, 1, 2, 3 }, new uint[] { 0 })] + [InlineDataAttribute((ushort)TiffType.Byte, 3, true, new byte[] { 0, 1, 2, 3 }, new uint[] { 0, 1, 2 })] + [InlineDataAttribute((ushort)TiffType.Byte, 7, true, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 0, 1, 2, 3, 4, 5, 6 })] + [InlineDataAttribute((ushort)TiffType.Byte, 1, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 0 })] + [InlineDataAttribute((ushort)TiffType.Byte, 3, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 0, 1, 2 })] + [InlineDataAttribute((ushort)TiffType.Byte, 7, false, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 0, 1, 2, 3, 4, 5, 6 })] + [InlineDataAttribute((ushort)TiffType.Short, 1, true, new byte[] { 1, 0, 3, 2 }, new uint[] { 1 })] + [InlineDataAttribute((ushort)TiffType.Short, 2, true, new byte[] { 1, 0, 3, 2 }, new uint[] { 1, 515 })] + [InlineDataAttribute((ushort)TiffType.Short, 3, true, new byte[] { 1, 0, 3, 2, 5, 4, 6, 7, 8 }, new uint[] { 1, 515, 1029 })] + [InlineDataAttribute((ushort)TiffType.Short, 1, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 1 })] + [InlineDataAttribute((ushort)TiffType.Short, 2, false, new byte[] { 0, 1, 2, 3 }, new uint[] { 1, 515 })] + [InlineDataAttribute((ushort)TiffType.Short, 3, false, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new uint[] { 1, 515, 1029 })] + [InlineDataAttribute((ushort)TiffType.Long, 1, true, new byte[] { 4, 3, 2, 1 }, new uint[] { 0x01020304 })] + [InlineDataAttribute((ushort)TiffType.Long, 2, true, new byte[] { 4, 3, 2, 1, 6, 5, 4, 3, 99, 99 }, new uint[] { 0x01020304, 0x03040506 })] + [InlineDataAttribute((ushort)TiffType.Long, 1, false, new byte[] { 1, 2, 3, 4 }, new uint[] { 0x01020304 })] + [InlineDataAttribute((ushort)TiffType.Long, 2, false, new byte[] { 1, 2, 3, 4, 3, 4, 5, 6, 99, 99 }, new uint[] { 0x01020304, 0x03040506 })] public void ReadUnsignedIntegerArray_ReturnsValue(ushort type, int count, bool isLittleEndian, byte[] bytes, uint[] expectedValue) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, (uint)expectedValue.Length, bytes), isLittleEndian); @@ -298,17 +298,17 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadUnsignedIntegerArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -319,22 +319,22 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.SByte, 1, true, new byte[] { 0, 1, 2, 3 }, new int[] { 0 })] - [InlineDataAttribute(TiffType.SByte, 3, true, new byte[] { 0, 255, 2, 3 }, new int[] { 0, -1, 2 })] - [InlineDataAttribute(TiffType.SByte, 7, true, new byte[] { 0, 255, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 0, -1, 2, 3, 4, 5, 6 })] - [InlineDataAttribute(TiffType.SByte, 1, false, new byte[] { 0, 1, 2, 3 }, new int[] { 0 })] - [InlineDataAttribute(TiffType.SByte, 3, false, new byte[] { 0, 255, 2, 3 }, new int[] { 0, -1, 2 })] - [InlineDataAttribute(TiffType.SByte, 7, false, new byte[] { 0, 255, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 0, -1, 2, 3, 4, 5, 6 })] - [InlineDataAttribute(TiffType.SShort, 1, true, new byte[] { 1, 0, 3, 2 }, new int[] { 1 })] - [InlineDataAttribute(TiffType.SShort, 2, true, new byte[] { 1, 0, 255, 255 }, new int[] { 1, -1 })] - [InlineDataAttribute(TiffType.SShort, 3, true, new byte[] { 1, 0, 255, 255, 5, 4, 6, 7, 8 }, new int[] { 1, -1, 1029 })] - [InlineDataAttribute(TiffType.SShort, 1, false, new byte[] { 0, 1, 2, 3 }, new int[] { 1 })] - [InlineDataAttribute(TiffType.SShort, 2, false, new byte[] { 0, 1, 255, 255 }, new int[] { 1, -1 })] - [InlineDataAttribute(TiffType.SShort, 3, false, new byte[] { 0, 1, 255, 255, 4, 5, 6, 7, 8 }, new int[] { 1, -1, 1029 })] - [InlineDataAttribute(TiffType.SLong, 1, true, new byte[] { 4, 3, 2, 1 }, new int[] { 0x01020304 })] - [InlineDataAttribute(TiffType.SLong, 2, true, new byte[] { 4, 3, 2, 1, 255, 255, 255, 255, 99, 99 }, new int[] { 0x01020304, -1 })] - [InlineDataAttribute(TiffType.SLong, 1, false, new byte[] { 1, 2, 3, 4 }, new int[] { 0x01020304 })] - [InlineDataAttribute(TiffType.SLong, 2, false, new byte[] { 1, 2, 3, 4, 255, 255, 255, 255, 99, 99 }, new int[] { 0x01020304, -1 })] + [InlineDataAttribute((ushort)TiffType.SByte, 1, true, new byte[] { 0, 1, 2, 3 }, new int[] { 0 })] + [InlineDataAttribute((ushort)TiffType.SByte, 3, true, new byte[] { 0, 255, 2, 3 }, new int[] { 0, -1, 2 })] + [InlineDataAttribute((ushort)TiffType.SByte, 7, true, new byte[] { 0, 255, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 0, -1, 2, 3, 4, 5, 6 })] + [InlineDataAttribute((ushort)TiffType.SByte, 1, false, new byte[] { 0, 1, 2, 3 }, new int[] { 0 })] + [InlineDataAttribute((ushort)TiffType.SByte, 3, false, new byte[] { 0, 255, 2, 3 }, new int[] { 0, -1, 2 })] + [InlineDataAttribute((ushort)TiffType.SByte, 7, false, new byte[] { 0, 255, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 0, -1, 2, 3, 4, 5, 6 })] + [InlineDataAttribute((ushort)TiffType.SShort, 1, true, new byte[] { 1, 0, 3, 2 }, new int[] { 1 })] + [InlineDataAttribute((ushort)TiffType.SShort, 2, true, new byte[] { 1, 0, 255, 255 }, new int[] { 1, -1 })] + [InlineDataAttribute((ushort)TiffType.SShort, 3, true, new byte[] { 1, 0, 255, 255, 5, 4, 6, 7, 8 }, new int[] { 1, -1, 1029 })] + [InlineDataAttribute((ushort)TiffType.SShort, 1, false, new byte[] { 0, 1, 2, 3 }, new int[] { 1 })] + [InlineDataAttribute((ushort)TiffType.SShort, 2, false, new byte[] { 0, 1, 255, 255 }, new int[] { 1, -1 })] + [InlineDataAttribute((ushort)TiffType.SShort, 3, false, new byte[] { 0, 1, 255, 255, 4, 5, 6, 7, 8 }, new int[] { 1, -1, 1029 })] + [InlineDataAttribute((ushort)TiffType.SLong, 1, true, new byte[] { 4, 3, 2, 1 }, new int[] { 0x01020304 })] + [InlineDataAttribute((ushort)TiffType.SLong, 2, true, new byte[] { 4, 3, 2, 1, 255, 255, 255, 255, 99, 99 }, new int[] { 0x01020304, -1 })] + [InlineDataAttribute((ushort)TiffType.SLong, 1, false, new byte[] { 1, 2, 3, 4 }, new int[] { 0x01020304 })] + [InlineDataAttribute((ushort)TiffType.SLong, 2, false, new byte[] { 1, 2, 3, 4, 255, 255, 255, 255, 99, 99 }, new int[] { 0x01020304, -1 })] public void ReadSignedIntegerArray_ReturnsValue(ushort type, int count, bool isLittleEndian, byte[] bytes, int[] expectedValue) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, (uint)expectedValue.Length, bytes), isLittleEndian); @@ -345,17 +345,17 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadSignedIntegerArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -384,19 +384,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadString_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -493,19 +493,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadUnsignedRational_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -516,19 +516,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadSignedRational_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -539,19 +539,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadUnsignedRationalArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -562,19 +562,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadSignedRationalArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -631,19 +631,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadFloat_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -691,19 +691,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Double)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Double)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadFloatArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -740,19 +740,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadDouble_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); @@ -803,19 +803,19 @@ namespace ImageSharp.Tests } [Theory] - [InlineDataAttribute(TiffType.Byte)] - [InlineDataAttribute(TiffType.Ascii)] - [InlineDataAttribute(TiffType.Short)] - [InlineDataAttribute(TiffType.Long)] - [InlineDataAttribute(TiffType.Rational)] - [InlineDataAttribute(TiffType.SByte)] - [InlineDataAttribute(TiffType.Undefined)] - [InlineDataAttribute(TiffType.SShort)] - [InlineDataAttribute(TiffType.SLong)] - [InlineDataAttribute(TiffType.SRational)] - [InlineDataAttribute(TiffType.Float)] - [InlineDataAttribute(TiffType.Ifd)] - [InlineDataAttribute((TiffType)99)] + [InlineDataAttribute((ushort)TiffType.Byte)] + [InlineDataAttribute((ushort)TiffType.Ascii)] + [InlineDataAttribute((ushort)TiffType.Short)] + [InlineDataAttribute((ushort)TiffType.Long)] + [InlineDataAttribute((ushort)TiffType.Rational)] + [InlineDataAttribute((ushort)TiffType.SByte)] + [InlineDataAttribute((ushort)TiffType.Undefined)] + [InlineDataAttribute((ushort)TiffType.SShort)] + [InlineDataAttribute((ushort)TiffType.SLong)] + [InlineDataAttribute((ushort)TiffType.SRational)] + [InlineDataAttribute((ushort)TiffType.Float)] + [InlineDataAttribute((ushort)TiffType.Ifd)] + [InlineDataAttribute((ushort)99)] public void ReadDoubleArray_ThrowsExceptionIfInvalidType(ushort type) { (TiffDecoderCore decoder, TiffIfdEntry entry) = GenerateTestIfdEntry(TiffGenEntry.Bytes(TiffTags.ImageWidth, (TiffType)type, 1, new byte[4]), true); diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdTests.cs index a8d01cf27e..fc557bf6f2 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderIfdTests.cs @@ -101,7 +101,7 @@ namespace ImageSharp.Tests TiffIfdEntry entry = ifd.Entries[1]; byte[] expectedData = isLittleEndian ? new byte[] { 210, 0, 0, 0 } : new byte[] { 0, 0, 0, 210 }; - Assert.NotNull(entry); + Assert.Equal(TiffTags.ImageLength, entry.Tag); Assert.Equal(TiffType.Long, entry.Type); Assert.Equal(1u, entry.Count); diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs index 3d6cf355ac..efb02f3183 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs @@ -68,16 +68,16 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffCompression.None, TiffCompressionType.None)] - [InlineData(true, TiffCompression.None, TiffCompressionType.None)] - [InlineData(false, TiffCompression.PackBits, TiffCompressionType.PackBits)] - [InlineData(true, TiffCompression.PackBits, TiffCompressionType.PackBits)] - [InlineData(false, TiffCompression.Deflate, TiffCompressionType.Deflate)] - [InlineData(true, TiffCompression.Deflate, TiffCompressionType.Deflate)] - [InlineData(false, TiffCompression.OldDeflate, TiffCompressionType.Deflate)] - [InlineData(true, TiffCompression.OldDeflate, TiffCompressionType.Deflate)] - [InlineData(false, TiffCompression.Lzw, TiffCompressionType.Lzw)] - [InlineData(true, TiffCompression.Lzw, TiffCompressionType.Lzw)] + [InlineData(false, (ushort)TiffCompression.None, (int)TiffCompressionType.None)] + [InlineData(true, (ushort)TiffCompression.None, (int)TiffCompressionType.None)] + [InlineData(false, (ushort)TiffCompression.PackBits, (int)TiffCompressionType.PackBits)] + [InlineData(true, (ushort)TiffCompression.PackBits, (int)TiffCompressionType.PackBits)] + [InlineData(false, (ushort)TiffCompression.Deflate, (int)TiffCompressionType.Deflate)] + [InlineData(true, (ushort)TiffCompression.Deflate, (int)TiffCompressionType.Deflate)] + [InlineData(false, (ushort)TiffCompression.OldDeflate, (int)TiffCompressionType.Deflate)] + [InlineData(true, (ushort)TiffCompression.OldDeflate, (int)TiffCompressionType.Deflate)] + [InlineData(false, (ushort)TiffCompression.Lzw, (int)TiffCompressionType.Lzw)] + [InlineData(true, (ushort)TiffCompression.Lzw, (int)TiffCompressionType.Lzw)] public void ReadImageFormat_DeterminesCorrectCompressionImplementation(bool isLittleEndian, ushort compression, int compressionType) { Stream stream = CreateTiffGenIfd() @@ -92,21 +92,21 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffCompression.Ccitt1D)] - [InlineData(false, TiffCompression.CcittGroup3Fax)] - [InlineData(false, TiffCompression.CcittGroup4Fax)] - [InlineData(false, TiffCompression.ItuTRecT43)] - [InlineData(false, TiffCompression.ItuTRecT82)] - [InlineData(false, TiffCompression.Jpeg)] - [InlineData(false, TiffCompression.OldJpeg)] + [InlineData(false, (ushort)TiffCompression.Ccitt1D)] + [InlineData(false, (ushort)TiffCompression.CcittGroup3Fax)] + [InlineData(false, (ushort)TiffCompression.CcittGroup4Fax)] + [InlineData(false, (ushort)TiffCompression.ItuTRecT43)] + [InlineData(false, (ushort)TiffCompression.ItuTRecT82)] + [InlineData(false, (ushort)TiffCompression.Jpeg)] + [InlineData(false, (ushort)TiffCompression.OldJpeg)] [InlineData(false, 999)] - [InlineData(true, TiffCompression.Ccitt1D)] - [InlineData(true, TiffCompression.CcittGroup3Fax)] - [InlineData(true, TiffCompression.CcittGroup4Fax)] - [InlineData(true, TiffCompression.ItuTRecT43)] - [InlineData(true, TiffCompression.ItuTRecT82)] - [InlineData(true, TiffCompression.Jpeg)] - [InlineData(true, TiffCompression.OldJpeg)] + [InlineData(true, (ushort)TiffCompression.Ccitt1D)] + [InlineData(true, (ushort)TiffCompression.CcittGroup3Fax)] + [InlineData(true, (ushort)TiffCompression.CcittGroup4Fax)] + [InlineData(true, (ushort)TiffCompression.ItuTRecT43)] + [InlineData(true, (ushort)TiffCompression.ItuTRecT82)] + [InlineData(true, (ushort)TiffCompression.Jpeg)] + [InlineData(true, (ushort)TiffCompression.OldJpeg)] [InlineData(true, 999)] public void ReadImageFormat_ThrowsExceptionForUnsupportedCompression(bool isLittleEndian, ushort compression) { @@ -123,34 +123,34 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new[] { 3 }, TiffColorType.WhiteIsZero)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new[] { 3 }, TiffColorType.WhiteIsZero)] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new[] { 8 }, TiffColorType.WhiteIsZero8)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new[] { 8 }, TiffColorType.WhiteIsZero8)] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new[] { 4 }, TiffColorType.WhiteIsZero4)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new[] { 4 }, TiffColorType.WhiteIsZero4)] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new[] { 1 }, TiffColorType.WhiteIsZero1)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new[] { 1 }, TiffColorType.WhiteIsZero1)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new[] { 3 }, TiffColorType.BlackIsZero)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new[] { 3 }, TiffColorType.BlackIsZero)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new[] { 8 }, TiffColorType.BlackIsZero8)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new[] { 8 }, TiffColorType.BlackIsZero8)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new[] { 4 }, TiffColorType.BlackIsZero4)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new[] { 4 }, TiffColorType.BlackIsZero4)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new[] { 1 }, TiffColorType.BlackIsZero1)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new[] { 1 }, TiffColorType.BlackIsZero1)] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new[] { 3 }, TiffColorType.PaletteColor)] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new[] { 3 }, TiffColorType.PaletteColor)] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new[] { 8 }, TiffColorType.PaletteColor)] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new[] { 8 }, TiffColorType.PaletteColor)] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new[] { 4 }, TiffColorType.PaletteColor)] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new[] { 4 }, TiffColorType.PaletteColor)] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new[] { 1 }, TiffColorType.PaletteColor)] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new[] { 1 }, TiffColorType.PaletteColor)] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, TiffColorType.Rgb)] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, TiffColorType.Rgb)] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, TiffColorType.Rgb888)] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, TiffColorType.Rgb888)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 3 }, (int)TiffColorType.WhiteIsZero)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 3 }, (int)TiffColorType.WhiteIsZero)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 8 }, (int)TiffColorType.WhiteIsZero8)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 8 }, (int)TiffColorType.WhiteIsZero8)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 4 }, (int)TiffColorType.WhiteIsZero4)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 4 }, (int)TiffColorType.WhiteIsZero4)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 1 }, (int)TiffColorType.WhiteIsZero1)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 1 }, (int)TiffColorType.WhiteIsZero1)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 3 }, (int)TiffColorType.BlackIsZero)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 3 }, (int)TiffColorType.BlackIsZero)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 8 }, (int)TiffColorType.BlackIsZero8)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 8 }, (int)TiffColorType.BlackIsZero8)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 4 }, (int)TiffColorType.BlackIsZero4)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 4 }, (int)TiffColorType.BlackIsZero4)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 1 }, (int)TiffColorType.BlackIsZero1)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 1 }, (int)TiffColorType.BlackIsZero1)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 3 }, (int)TiffColorType.PaletteColor)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 3 }, (int)TiffColorType.PaletteColor)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 8 }, (int)TiffColorType.PaletteColor)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 8 }, (int)TiffColorType.PaletteColor)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 4 }, (int)TiffColorType.PaletteColor)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 4 }, (int)TiffColorType.PaletteColor)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 1 }, (int)TiffColorType.PaletteColor)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 1 }, (int)TiffColorType.PaletteColor)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, (int)TiffColorType.Rgb)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, (int)TiffColorType.Rgb)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, (int)TiffColorType.Rgb888)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, (int)TiffColorType.Rgb888)] public void ReadImageFormat_DeterminesCorrectColorImplementation_Chunky(bool isLittleEndian, ushort photometricInterpretation, int[] bitsPerSample, int colorType) { Stream stream = CreateTiffGenIfd() @@ -167,10 +167,10 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, TiffColorType.RgbPlanar)] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, TiffColorType.RgbPlanar)] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, TiffColorType.RgbPlanar)] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, TiffColorType.RgbPlanar)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, (int)TiffColorType.RgbPlanar)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 4, 4, 4 }, (int)TiffColorType.RgbPlanar)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, (int)TiffColorType.RgbPlanar)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8, 8 }, (int)TiffColorType.RgbPlanar)] public void ReadImageFormat_DeterminesCorrectColorImplementation_Planar(bool isLittleEndian, ushort photometricInterpretation, int[] bitsPerSample, int colorType) { Stream stream = CreateTiffGenIfd() @@ -187,10 +187,10 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, TiffColorType.WhiteIsZero1)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, TiffColorType.WhiteIsZero1)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, TiffColorType.BlackIsZero1)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, TiffColorType.BlackIsZero1)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, (int)TiffColorType.WhiteIsZero1)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, (int)TiffColorType.WhiteIsZero1)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, (int)TiffColorType.BlackIsZero1)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, (int)TiffColorType.BlackIsZero1)] public void ReadImageFormat_DeterminesCorrectColorImplementation_DefaultsToBilevel(bool isLittleEndian, ushort photometricInterpretation, int colorType) { Stream stream = CreateTiffGenIfd() @@ -206,8 +206,8 @@ namespace ImageSharp.Tests } // [Theory] - // [InlineData(false, new[] { 8 }, TiffColorType.WhiteIsZero8)] - // [InlineData(true, new[] { 8 }, TiffColorType.WhiteIsZero8)] + // [InlineData(false, new[] { 8 }, (int)TiffColorType.WhiteIsZero8)] + // [InlineData(true, new[] { 8 }, (int)TiffColorType.WhiteIsZero8)] // public void ReadImageFormat_UsesDefaultColorImplementationForCcitt1D(bool isLittleEndian, int[] bitsPerSample, int colorType) // { // Stream stream = CreateTiffGenIfd() @@ -240,23 +240,23 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.CieLab)] - [InlineData(false, TiffPhotometricInterpretation.ColorFilterArray)] - [InlineData(false, TiffPhotometricInterpretation.IccLab)] - [InlineData(false, TiffPhotometricInterpretation.ItuLab)] - [InlineData(false, TiffPhotometricInterpretation.LinearRaw)] - [InlineData(false, TiffPhotometricInterpretation.Separated)] - [InlineData(false, TiffPhotometricInterpretation.TransparencyMask)] - [InlineData(false, TiffPhotometricInterpretation.YCbCr)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.CieLab)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.ColorFilterArray)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.IccLab)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.ItuLab)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.LinearRaw)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Separated)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.TransparencyMask)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.YCbCr)] [InlineData(false, 999)] - [InlineData(true, TiffPhotometricInterpretation.CieLab)] - [InlineData(true, TiffPhotometricInterpretation.ColorFilterArray)] - [InlineData(true, TiffPhotometricInterpretation.IccLab)] - [InlineData(true, TiffPhotometricInterpretation.ItuLab)] - [InlineData(true, TiffPhotometricInterpretation.LinearRaw)] - [InlineData(true, TiffPhotometricInterpretation.Separated)] - [InlineData(true, TiffPhotometricInterpretation.TransparencyMask)] - [InlineData(true, TiffPhotometricInterpretation.YCbCr)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.CieLab)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.ColorFilterArray)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.IccLab)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.ItuLab)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.LinearRaw)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Separated)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.TransparencyMask)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.YCbCr)] [InlineData(true, 999)] public void ReadImageFormat_ThrowsExceptionForUnsupportedPhotometricInterpretation(bool isLittleEndian, ushort photometricInterpretation) { @@ -297,10 +297,10 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero)] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero)] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero)] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero)] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero)] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero)] public void ReadImageFormat_ReadsBitsPerSample_DefaultsToBilevel(bool isLittleEndian, ushort photometricInterpretation) { Stream stream = CreateTiffGenIfd() @@ -333,24 +333,24 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new int[] { })] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new int[] { })] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new int[] { })] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new int[] { })] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new int[] { })] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new int[] { })] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new int[] { })] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new int[] { })] - [InlineData(false, TiffPhotometricInterpretation.WhiteIsZero, new[] { 8, 8 })] - [InlineData(true, TiffPhotometricInterpretation.WhiteIsZero, new[] { 8, 8 })] - [InlineData(false, TiffPhotometricInterpretation.BlackIsZero, new[] { 8, 8 })] - [InlineData(true, TiffPhotometricInterpretation.BlackIsZero, new[] { 8, 8 })] - [InlineData(false, TiffPhotometricInterpretation.PaletteColor, new[] { 8, 8 })] - [InlineData(true, TiffPhotometricInterpretation.PaletteColor, new[] { 8, 8 })] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 8 })] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 8 })] - [InlineData(false, TiffPhotometricInterpretation.Rgb, new[] { 8, 8 })] - [InlineData(true, TiffPhotometricInterpretation.Rgb, new[] { 8, 8 })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new int[] { })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new int[] { })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new int[] { })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new int[] { })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new int[] { })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new int[] { })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new int[] { })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new int[] { })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 8, 8 })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.WhiteIsZero, new[] { 8, 8 })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 8, 8 })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.BlackIsZero, new[] { 8, 8 })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 8, 8 })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.PaletteColor, new[] { 8, 8 })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8 })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8 })] + [InlineData(false, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8 })] + [InlineData(true, (ushort)TiffPhotometricInterpretation.Rgb, new[] { 8, 8 })] public void ReadImageFormat_ThrowsExceptionForUnsupportedNumberOfSamples(bool isLittleEndian, ushort photometricInterpretation, int[] bitsPerSample) { Stream stream = CreateTiffGenIfd() @@ -400,10 +400,10 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(false, TiffPlanarConfiguration.Chunky)] - [InlineData(true, TiffPlanarConfiguration.Chunky)] - [InlineData(false, TiffPlanarConfiguration.Planar)] - [InlineData(true, TiffPlanarConfiguration.Planar)] + [InlineData(false, (ushort)TiffPlanarConfiguration.Chunky)] + [InlineData(true, (ushort)TiffPlanarConfiguration.Chunky)] + [InlineData(false, (ushort)TiffPlanarConfiguration.Planar)] + [InlineData(true, (ushort)TiffPlanarConfiguration.Planar)] public void ReadImageFormat_ReadsPlanarConfiguration(bool isLittleEndian, int planarConfiguration) { Stream stream = CreateTiffGenIfd() @@ -437,21 +437,21 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 1 }, 160, 80, 20 * 80)] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 1 }, 153, 80, 20 * 80)] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 3 }, 100, 80, 38 * 80)] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 4 }, 100, 80, 50 * 80)] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 4 }, 99, 80, 50 * 80)] - [InlineData(TiffColorType.WhiteIsZero, new uint[] { 8 }, 100, 80, 100 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 1 }, 160, 80, 20 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 1 }, 153, 80, 20 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 3 }, 100, 80, 38 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 4 }, 100, 80, 50 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 4 }, 99, 80, 50 * 80)] - [InlineData(TiffColorType.PaletteColor, new uint[] { 8 }, 100, 80, 100 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 300 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 150 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 200 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 1 }, 160, 80, 20 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 1 }, 153, 80, 20 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 3 }, 100, 80, 38 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 4 }, 100, 80, 50 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 4 }, 99, 80, 50 * 80)] + [InlineData((ushort)TiffColorType.WhiteIsZero, new uint[] { 8 }, 100, 80, 100 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 1 }, 160, 80, 20 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 1 }, 153, 80, 20 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 3 }, 100, 80, 38 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 4 }, 100, 80, 50 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 4 }, 99, 80, 50 * 80)] + [InlineData((ushort)TiffColorType.PaletteColor, new uint[] { 8 }, 100, 80, 100 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 300 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 150 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 200 * 80)] public void CalculateImageBufferSize_ReturnsCorrectSize_Chunky(ushort colorType, uint[] bitsPerSample, int width, int height, int expectedResult) { TiffDecoderCore decoder = new TiffDecoderCore(null, null); @@ -465,18 +465,18 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 0, 100 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 1, 100 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 2, 100 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 0, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 1, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 2, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 0, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 1, 100 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 2, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 0, 50 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 1, 99 * 80)] - [InlineData(TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 2, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 0, 100 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 1, 100 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 8, 8, 8 }, 100, 80, 2, 100 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 0, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 1, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 4, 4 }, 100, 80, 2, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 0, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 1, 100 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 100, 80, 2, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 0, 50 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 1, 99 * 80)] + [InlineData((ushort)TiffColorType.Rgb, new uint[] { 4, 8, 4 }, 99, 80, 2, 50 * 80)] public void CalculateImageBufferSize_ReturnsCorrectSize_Planar(ushort colorType, uint[] bitsPerSample, int width, int height, int plane, int expectedResult) { diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderMetadataTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderMetadataTests.cs index e418d0d670..ab2ab5f75b 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderMetadataTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderMetadataTests.cs @@ -132,7 +132,7 @@ namespace ImageSharp.Tests decoder.ReadMetadata(ifd, image); var metadata = image.MetaData.Properties.FirstOrDefault(m => m.Name == metadataName)?.Value; - Assert.Equal(null, metadata); + Assert.Null(metadata); } } } \ No newline at end of file diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffIfd/TiffIfdTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffIfd/TiffIfdTests.cs index 97e46ef4e6..26ec20963e 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffIfd/TiffIfdTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffIfd/TiffIfdTests.cs @@ -35,7 +35,7 @@ namespace ImageSharp.Tests TiffIfdEntry? entry = ifd.GetIfdEntry(30); - Assert.Equal(true, entry.HasValue); + Assert.True(entry.HasValue); Assert.Equal(30, entry.Value.Tag); } @@ -53,7 +53,7 @@ namespace ImageSharp.Tests TiffIfdEntry? entry = ifd.GetIfdEntry(25); - Assert.Equal(false, entry.HasValue); + Assert.False(entry.HasValue); } [Fact] @@ -70,7 +70,7 @@ namespace ImageSharp.Tests bool success = ifd.TryGetIfdEntry(30, out var entry); - Assert.Equal(true, success); + Assert.True(success); Assert.Equal(30, entry.Tag); } @@ -88,7 +88,7 @@ namespace ImageSharp.Tests bool success = ifd.TryGetIfdEntry(25, out var entry); - Assert.Equal(false, success); + Assert.False(success); Assert.Equal(0, entry.Tag); } } diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/Utils/SubStreamTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/Utils/SubStreamTests.cs index b57a77c74c..34997a90cf 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/Utils/SubStreamTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/Utils/SubStreamTests.cs @@ -316,6 +316,7 @@ namespace ImageSharp.Tests Assert.Equal("Invalid seek origin.", e.Message); } + [Fact] public void SetLength_ThrowsNotSupportedException() { Stream innerStream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); diff --git a/tests/ImageSharp.Formats.Tiff.Tests/ImageSharp.Formats.Tiff.Tests.csproj b/tests/ImageSharp.Formats.Tiff.Tests/ImageSharp.Formats.Tiff.Tests.csproj index 3e861f778c..8d3d1db362 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/ImageSharp.Formats.Tiff.Tests.csproj +++ b/tests/ImageSharp.Formats.Tiff.Tests/ImageSharp.Formats.Tiff.Tests.csproj @@ -8,8 +8,8 @@ - - + +