|
|
|
@ -11,21 +11,21 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public abstract partial class PixelConverterTests |
|
|
|
{ |
|
|
|
public static readonly TheoryData<byte, byte, byte, byte> RgbaData = |
|
|
|
new TheoryData<byte, byte, byte, byte> |
|
|
|
{ |
|
|
|
{ 0, 0, 0, 0 }, |
|
|
|
{ 0, 0, 0, 255 }, |
|
|
|
{ 0, 0, 255, 0 }, |
|
|
|
{ 0, 255, 0, 0 }, |
|
|
|
{ 255, 0, 0, 0 }, |
|
|
|
{ 255, 255, 255, 255 }, |
|
|
|
{ 0, 0, 0, 1 }, |
|
|
|
{ 0, 0, 1, 0 }, |
|
|
|
{ 0, 1, 0, 0 }, |
|
|
|
{ 1, 0, 0, 0 }, |
|
|
|
{ 3, 5, 7, 11 }, |
|
|
|
{ 67, 71, 101, 109 } |
|
|
|
}; |
|
|
|
new() |
|
|
|
{ |
|
|
|
{ 0, 0, 0, 0 }, |
|
|
|
{ 0, 0, 0, 255 }, |
|
|
|
{ 0, 0, 255, 0 }, |
|
|
|
{ 0, 255, 0, 0 }, |
|
|
|
{ 255, 0, 0, 0 }, |
|
|
|
{ 255, 255, 255, 255 }, |
|
|
|
{ 0, 0, 0, 1 }, |
|
|
|
{ 0, 0, 1, 0 }, |
|
|
|
{ 0, 1, 0, 0 }, |
|
|
|
{ 1, 0, 0, 0 }, |
|
|
|
{ 3, 5, 7, 11 }, |
|
|
|
{ 67, 71, 101, 109 } |
|
|
|
}; |
|
|
|
|
|
|
|
public class FromRgba32 : PixelConverterTests |
|
|
|
{ |
|
|
|
@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToArgb32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeRgba32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromRgba32.ToArgb32(source, actual); |
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToBgra32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeRgba32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromRgba32.ToBgra32(source, actual); |
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToRgba32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeArgb32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromArgb32.ToRgba32(source, actual); |
|
|
|
|
|
|
|
@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToBgra32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeArgb32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromArgb32.ToBgra32(source, actual); |
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToArgb32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeBgra32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromBgra32.ToArgb32(source, actual); |
|
|
|
|
|
|
|
@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats |
|
|
|
public void ToRgba32(byte r, byte g, byte b, byte a) |
|
|
|
{ |
|
|
|
byte[] source = ReferenceImplementations.MakeBgra32ByteArray(r, g, b, a); |
|
|
|
var actual = new byte[source.Length]; |
|
|
|
byte[] actual = new byte[source.Length]; |
|
|
|
|
|
|
|
PixelConverter.FromBgra32.ToRgba32(source, actual); |
|
|
|
|
|
|
|
|