|
|
|
@ -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); |
|
|
|
|