|
|
|
@ -2,6 +2,8 @@ |
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Numerics; |
|
|
|
using SixLabors.ImageSharp.ColorSpaces; |
|
|
|
using Xunit; |
|
|
|
@ -14,24 +16,26 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces |
|
|
|
/// </summary>
|
|
|
|
public class ColorSpaceEqualityTests |
|
|
|
{ |
|
|
|
public static readonly TheoryData<IColorVector> EmptyData = |
|
|
|
new TheoryData<IColorVector> |
|
|
|
internal static readonly Dictionary<string, IColorVector> EmptyDataLookup = |
|
|
|
new Dictionary<string, IColorVector> |
|
|
|
{ |
|
|
|
CieLab.Empty, |
|
|
|
CieLch.Empty, |
|
|
|
CieLchuv.Empty, |
|
|
|
CieLuv.Empty, |
|
|
|
CieXyz.Empty, |
|
|
|
CieXyy.Empty, |
|
|
|
Hsl.Empty, |
|
|
|
Hsl.Empty, |
|
|
|
HunterLab.Empty, |
|
|
|
Lms.Empty, |
|
|
|
LinearRgb.Empty, |
|
|
|
Rgb.Empty, |
|
|
|
YCbCr.Empty |
|
|
|
{nameof( CieLab), CieLab.Empty }, |
|
|
|
{nameof( CieLch), CieLch.Empty }, |
|
|
|
{nameof( CieLchuv), CieLchuv.Empty }, |
|
|
|
{nameof( CieLuv), CieLuv.Empty }, |
|
|
|
{nameof( CieXyz), CieXyz.Empty }, |
|
|
|
{nameof( CieXyy), CieXyy.Empty }, |
|
|
|
{nameof( Hsl), Hsl.Empty }, |
|
|
|
{nameof( Hsl), Hsl.Empty }, |
|
|
|
{nameof( HunterLab), HunterLab.Empty }, |
|
|
|
{nameof( Lms), Lms.Empty }, |
|
|
|
{nameof( LinearRgb), LinearRgb.Empty }, |
|
|
|
{nameof( Rgb), Rgb.Empty }, |
|
|
|
{nameof( YCbCr), YCbCr.Empty } |
|
|
|
}; |
|
|
|
|
|
|
|
public static readonly IEnumerable<object[]> EmptyData = EmptyDataLookup.Select(x => new [] { x.Key }); |
|
|
|
|
|
|
|
public static readonly TheoryData<object, object, Type> EqualityData = |
|
|
|
new TheoryData<object, object, Type> |
|
|
|
{ |
|
|
|
@ -139,10 +143,11 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(EmptyData))] |
|
|
|
public void Vector_Equals_WhenTrue(IColorVector color) |
|
|
|
public void Vector_Equals_WhenTrue(string color) |
|
|
|
{ |
|
|
|
IColorVector colorVector = EmptyDataLookup[color]; |
|
|
|
// Act
|
|
|
|
bool equal = color.Vector.Equals(Vector3.Zero); |
|
|
|
bool equal = colorVector.Vector.Equals(Vector3.Zero); |
|
|
|
|
|
|
|
// Assert
|
|
|
|
Assert.True(equal); |
|
|
|
|