mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
330 lines
15 KiB
330 lines
15 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
namespace SixLabors.ImageSharp.Tests
|
|
{
|
|
internal static class IccTestDataPrimitives
|
|
{
|
|
#region UInt16
|
|
|
|
public static readonly byte[] UInt16_0 = { 0x00, 0x00 };
|
|
public static readonly byte[] UInt16_1 = { 0x00, 0x01 };
|
|
public static readonly byte[] UInt16_2 = { 0x00, 0x02 };
|
|
public static readonly byte[] UInt16_3 = { 0x00, 0x03 };
|
|
public static readonly byte[] UInt16_4 = { 0x00, 0x04 };
|
|
public static readonly byte[] UInt16_5 = { 0x00, 0x05 };
|
|
public static readonly byte[] UInt16_6 = { 0x00, 0x06 };
|
|
public static readonly byte[] UInt16_7 = { 0x00, 0x07 };
|
|
public static readonly byte[] UInt16_8 = { 0x00, 0x08 };
|
|
public static readonly byte[] UInt16_9 = { 0x00, 0x09 };
|
|
public static readonly byte[] UInt16_32768 = { 0x80, 0x00 };
|
|
public static readonly byte[] UInt16_Max = { 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region Int16
|
|
|
|
public static readonly byte[] Int16_Min = { 0x80, 0x00 };
|
|
public static readonly byte[] Int16_0 = { 0x00, 0x00 };
|
|
public static readonly byte[] Int16_1 = { 0x00, 0x01 };
|
|
public static readonly byte[] Int16_2 = { 0x00, 0x02 };
|
|
public static readonly byte[] Int16_3 = { 0x00, 0x03 };
|
|
public static readonly byte[] Int16_4 = { 0x00, 0x04 };
|
|
public static readonly byte[] Int16_5 = { 0x00, 0x05 };
|
|
public static readonly byte[] Int16_6 = { 0x00, 0x06 };
|
|
public static readonly byte[] Int16_7 = { 0x00, 0x07 };
|
|
public static readonly byte[] Int16_8 = { 0x00, 0x08 };
|
|
public static readonly byte[] Int16_9 = { 0x00, 0x09 };
|
|
public static readonly byte[] Int16_Max = { 0x7F, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region UInt32
|
|
|
|
public static readonly byte[] UInt32_0 = { 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] UInt32_1 = { 0x00, 0x00, 0x00, 0x01 };
|
|
public static readonly byte[] UInt32_2 = { 0x00, 0x00, 0x00, 0x02 };
|
|
public static readonly byte[] UInt32_3 = { 0x00, 0x00, 0x00, 0x03 };
|
|
public static readonly byte[] UInt32_4 = { 0x00, 0x00, 0x00, 0x04 };
|
|
public static readonly byte[] UInt32_5 = { 0x00, 0x00, 0x00, 0x05 };
|
|
public static readonly byte[] UInt32_6 = { 0x00, 0x00, 0x00, 0x06 };
|
|
public static readonly byte[] UInt32_7 = { 0x00, 0x00, 0x00, 0x07 };
|
|
public static readonly byte[] UInt32_8 = { 0x00, 0x00, 0x00, 0x08 };
|
|
public static readonly byte[] UInt32_9 = { 0x00, 0x00, 0x00, 0x09 };
|
|
public static readonly byte[] UInt32_Max = { 0xFF, 0xFF, 0xFF, 0xFF };
|
|
|
|
|
|
public static readonly uint UInt32_ValRand1 = 1749014123;
|
|
public static readonly uint UInt32_ValRand2 = 3870560989;
|
|
public static readonly uint UInt32_ValRand3 = 1050090334;
|
|
public static readonly uint UInt32_ValRand4 = 3550252874;
|
|
|
|
public static readonly byte[] UInt32_Rand1 = { 0x68, 0x3F, 0xD6, 0x6B };
|
|
public static readonly byte[] UInt32_Rand2 = { 0xE6, 0xB4, 0x12, 0xDD };
|
|
public static readonly byte[] UInt32_Rand3 = { 0x3E, 0x97, 0x1B, 0x5E };
|
|
public static readonly byte[] UInt32_Rand4 = { 0xD3, 0x9C, 0x8F, 0x4A };
|
|
|
|
#endregion
|
|
|
|
#region Int32
|
|
|
|
public static readonly byte[] Int32_Min = { 0x80, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Int32_0 = { 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Int32_1 = { 0x00, 0x00, 0x00, 0x01 };
|
|
public static readonly byte[] Int32_2 = { 0x00, 0x00, 0x00, 0x02 };
|
|
public static readonly byte[] Int32_3 = { 0x00, 0x00, 0x00, 0x03 };
|
|
public static readonly byte[] Int32_4 = { 0x00, 0x00, 0x00, 0x04 };
|
|
public static readonly byte[] Int32_5 = { 0x00, 0x00, 0x00, 0x05 };
|
|
public static readonly byte[] Int32_6 = { 0x00, 0x00, 0x00, 0x06 };
|
|
public static readonly byte[] Int32_7 = { 0x00, 0x00, 0x00, 0x07 };
|
|
public static readonly byte[] Int32_8 = { 0x00, 0x00, 0x00, 0x08 };
|
|
public static readonly byte[] Int32_9 = { 0x00, 0x00, 0x00, 0x09 };
|
|
public static readonly byte[] Int32_Max = { 0x7F, 0xFF, 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region UInt64
|
|
|
|
public static readonly byte[] UInt64_0 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] UInt64_1 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
|
|
public static readonly byte[] UInt64_2 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 };
|
|
public static readonly byte[] UInt64_3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
|
|
public static readonly byte[] UInt64_4 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 };
|
|
public static readonly byte[] UInt64_5 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 };
|
|
public static readonly byte[] UInt64_6 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 };
|
|
public static readonly byte[] UInt64_7 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 };
|
|
public static readonly byte[] UInt64_8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 };
|
|
public static readonly byte[] UInt64_9 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 };
|
|
public static readonly byte[] UInt64_Max = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region Int64
|
|
|
|
public static readonly byte[] Int64_Min = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Int64_0 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Int64_1 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
|
|
public static readonly byte[] Int64_2 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 };
|
|
public static readonly byte[] Int64_3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
|
|
public static readonly byte[] Int64_4 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 };
|
|
public static readonly byte[] Int64_5 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 };
|
|
public static readonly byte[] Int64_6 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 };
|
|
public static readonly byte[] Int64_7 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 };
|
|
public static readonly byte[] Int64_8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 };
|
|
public static readonly byte[] Int64_9 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 };
|
|
public static readonly byte[] Int64_Max = { 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region Single
|
|
|
|
public static readonly byte[] Single_Min = { 0xFF, 0x7F, 0xFF, 0xFF };
|
|
public static readonly byte[] Single_0 = { 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Single_1 = { 0x3F, 0x80, 0x00, 0x00 };
|
|
public static readonly byte[] Single_2 = { 0x40, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Single_3 = { 0x40, 0x40, 0x00, 0x00 };
|
|
public static readonly byte[] Single_4 = { 0x40, 0x80, 0x00, 0x00 };
|
|
public static readonly byte[] Single_5 = { 0x40, 0xA0, 0x00, 0x00 };
|
|
public static readonly byte[] Single_6 = { 0x40, 0xC0, 0x00, 0x00 };
|
|
public static readonly byte[] Single_7 = { 0x40, 0xE0, 0x00, 0x00 };
|
|
public static readonly byte[] Single_8 = { 0x41, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Single_9 = { 0x41, 0x10, 0x00, 0x00 };
|
|
public static readonly byte[] Single_Max = { 0x7F, 0x7F, 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region Double
|
|
|
|
public static readonly byte[] Double_Min = { 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
public static readonly byte[] Double_0 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Double_1 = { 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Double_Max = { 0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
|
|
#endregion
|
|
|
|
#region Fix16
|
|
|
|
public const float Fix16_ValMin = short.MinValue;
|
|
public const float Fix16_ValMax = short.MaxValue + 65535f / 65536f;
|
|
|
|
public static readonly byte[] Fix16_Min = { 0x80, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_0 = { 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_1 = { 0x00, 0x01, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_2 = { 0x00, 0x02, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_3 = { 0x00, 0x03, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_4 = { 0x00, 0x04, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_5 = { 0x00, 0x05, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_6 = { 0x00, 0x06, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_7 = { 0x00, 0x07, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_8 = { 0x00, 0x08, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_9 = { 0x00, 0x09, 0x00, 0x00 };
|
|
public static readonly byte[] Fix16_Max = { 0x7F, 0xFF, 0xFF, 0xFF };
|
|
|
|
public static readonly object[][] Fix16TestData =
|
|
{
|
|
new object[] { Fix16_Min, Fix16_ValMin },
|
|
new object[] { Fix16_0, 0 },
|
|
new object[] { Fix16_4, 4 },
|
|
new object[] { Fix16_Max, Fix16_ValMax },
|
|
};
|
|
|
|
#endregion
|
|
|
|
#region UFix16
|
|
|
|
public const float UFix16_ValMin = 0;
|
|
public const float UFix16_ValMax = ushort.MaxValue + 65535f / 65536f;
|
|
|
|
public static readonly byte[] UFix16_0 = { 0x00, 0x00, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_1 = { 0x00, 0x01, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_2 = { 0x00, 0x02, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_3 = { 0x00, 0x03, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_4 = { 0x00, 0x04, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_5 = { 0x00, 0x05, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_6 = { 0x00, 0x06, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_7 = { 0x00, 0x07, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_8 = { 0x00, 0x08, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_9 = { 0x00, 0x09, 0x00, 0x00 };
|
|
public static readonly byte[] UFix16_Max = { 0xFF, 0xFF, 0xFF, 0xFF };
|
|
|
|
public static readonly object[][] UFix16TestData =
|
|
{
|
|
new object[] { UFix16_0, 0 },
|
|
new object[] { UFix16_4, 4 },
|
|
new object[] { UFix16_Max, UFix16_ValMax },
|
|
};
|
|
|
|
#endregion
|
|
|
|
#region U1Fix15
|
|
|
|
public const float U1Fix15_ValMin = 0;
|
|
public const float U1Fix15_ValMax = 1f + 32767f / 32768f;
|
|
|
|
public static readonly byte[] U1Fix15_0 = { 0x00, 0x00 };
|
|
public static readonly byte[] U1Fix15_1 = { 0x80, 0x00 };
|
|
public static readonly byte[] U1Fix15_Max = { 0xFF, 0xFF };
|
|
|
|
public static readonly object[][] U1Fix15TestData =
|
|
{
|
|
new object[] { U1Fix15_0, 0 },
|
|
new object[] { U1Fix15_1, 1 },
|
|
new object[] { U1Fix15_Max, U1Fix15_ValMax },
|
|
};
|
|
|
|
#endregion
|
|
|
|
#region UFix8
|
|
|
|
public const float UFix8_ValMin = 0;
|
|
public const float UFix8_ValMax = byte.MaxValue + 255f / 256f;
|
|
|
|
public static readonly byte[] UFix8_0 = { 0x00, 0x00 };
|
|
public static readonly byte[] UFix8_1 = { 0x01, 0x00 };
|
|
public static readonly byte[] UFix8_2 = { 0x02, 0x00 };
|
|
public static readonly byte[] UFix8_3 = { 0x03, 0x00 };
|
|
public static readonly byte[] UFix8_4 = { 0x04, 0x00 };
|
|
public static readonly byte[] UFix8_5 = { 0x05, 0x00 };
|
|
public static readonly byte[] UFix8_6 = { 0x06, 0x00 };
|
|
public static readonly byte[] UFix8_7 = { 0x07, 0x00 };
|
|
public static readonly byte[] UFix8_8 = { 0x08, 0x00 };
|
|
public static readonly byte[] UFix8_9 = { 0x09, 0x00 };
|
|
public static readonly byte[] UFix8_Max = { 0xFF, 0xFF };
|
|
|
|
public static readonly object[][] UFix8TestData =
|
|
{
|
|
new object[] { UFix8_0, 0 },
|
|
new object[] { UFix8_4, 4 },
|
|
new object[] { UFix8_Max, UFix8_ValMax },
|
|
};
|
|
|
|
#endregion
|
|
|
|
#region ASCII String
|
|
|
|
public const string Ascii_ValRand = "aBcdEf1234";
|
|
public const string Ascii_ValRand1 = "Ecf3a";
|
|
public const string Ascii_ValRand2 = "2Bd4c";
|
|
public const string Ascii_ValRand3 = "cad14";
|
|
public const string Ascii_ValRand4 = "fd4E1";
|
|
public const string Ascii_ValRandLength4 = "aBcd";
|
|
public const string Ascii_ValNullRand = "aBcd\0Ef\0123";
|
|
|
|
public static readonly byte[] Ascii_Rand = { 97, 66, 99, 100, 69, 102, 49, 50, 51, 52 };
|
|
public static readonly byte[] Ascii_Rand1 = { 69, 99, 102, 51, 97 };
|
|
public static readonly byte[] Ascii_Rand2 = { 50, 66, 100, 52, 99 };
|
|
public static readonly byte[] Ascii_Rand3 = { 99, 97, 100, 49, 52 };
|
|
public static readonly byte[] Ascii_Rand4 = { 102, 100, 52, 69, 49 };
|
|
public static readonly byte[] Ascii_RandLength4 = { 97, 66, 99, 100 };
|
|
public static readonly byte[] Ascii_PaddedRand = { 97, 66, 99, 100, 69, 102, 49, 50, 51, 52, 0, 0, 0, 0 };
|
|
public static readonly byte[] Ascii_NullRand = { 97, 66, 99, 100, 0, 69, 102, 0, 49, 50, 51 };
|
|
|
|
public const int Ascii_Rand_Length = 10;
|
|
public const int Ascii_PaddedRand_Length = 14;
|
|
public const int Ascii_NullRand_Length = 11;
|
|
public const int Ascii_NullRand_LengthNoNull = 4;
|
|
|
|
public static readonly object[][] AsciiTestData =
|
|
{
|
|
new object[] { Ascii_Rand, Ascii_Rand_Length, Ascii_ValRand },
|
|
new object[] { Ascii_Rand, 4, Ascii_ValRandLength4 },
|
|
new object[] { Ascii_NullRand, Ascii_NullRand_LengthNoNull, Ascii_ValRandLength4 },
|
|
};
|
|
|
|
public static readonly object[][] AsciiWriteTestData =
|
|
{
|
|
new object[] { Ascii_Rand, Ascii_ValRand },
|
|
new object[] { Ascii_NullRand, Ascii_ValNullRand },
|
|
};
|
|
|
|
public static readonly object[][] AsciiPaddingTestData =
|
|
{
|
|
new object[] { Ascii_PaddedRand, Ascii_PaddedRand_Length, Ascii_ValRand, true },
|
|
new object[] { Ascii_RandLength4, 4, Ascii_ValRand, false },
|
|
};
|
|
|
|
#endregion
|
|
|
|
#region Unicode String
|
|
|
|
public const string Unicode_ValRand1 = ".6Abäñ$€β𐐷𤭢";
|
|
public const string Unicode_ValRand2 = ".6Abäñ";
|
|
public const string Unicode_ValRand3 = "$€β𐐷𤭢";
|
|
|
|
public static readonly byte[] Unicode_Rand1 =
|
|
{
|
|
0x00, 0x2e, // .
|
|
0x00, 0x36, // 6
|
|
0x00, 0x41, // A
|
|
0x00, 0x62, // b
|
|
0x00, 0xe4, // ä
|
|
0x00, 0xf1, // ñ
|
|
0x00, 0x24, // $
|
|
0x20, 0xAC, // €
|
|
0x03, 0xb2, // β
|
|
0xD8, 0x01, 0xDC, 0x37, // 𐐷
|
|
0xD8, 0x52, 0xDF, 0x62, // 𤭢
|
|
};
|
|
|
|
public static readonly byte[] Unicode_Rand2 =
|
|
{
|
|
0x00, 0x2e, // .
|
|
0x00, 0x36, // 6
|
|
0x00, 0x41, // A
|
|
0x00, 0x62, // b
|
|
0x00, 0xe4, // ä
|
|
0x00, 0xf1, // ñ
|
|
};
|
|
|
|
public static readonly byte[] Unicode_Rand3 =
|
|
{
|
|
0x00, 0x24, // $
|
|
0x20, 0xAC, // €
|
|
0x03, 0xb2, // β
|
|
0xD8, 0x01, 0xDC, 0x37, // 𐐷
|
|
0xD8, 0x52, 0xDF, 0x62, // 𤭢
|
|
};
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|