diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLchuvConversionTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLchuvConversionTests.cs index d7f2df95b..7bf7b4231 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLchuvConversionTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLchuvConversionTests.cs @@ -19,7 +19,7 @@ public class CieLabAndCieLchuvConversionTests [Theory] [InlineData(0, 0, 0, 0, 0, 0)] [InlineData(30.66194, 200, 352.7564, 31.95653, 116.8745, 2.388602)] - public void Convert_Lchuv_to_Lab(float l, float c, float h, float l2, float a, float b) + public void Convert_Lchuv_To_Lab(float l, float c, float h, float l2, float a, float b) { // Arrange CieLchuv input = new(l, c, h); @@ -48,7 +48,7 @@ public class CieLabAndCieLchuvConversionTests [Theory] [InlineData(0, 0, 0, 0, 0, 0)] [InlineData(36.0555, 303.6901, 10.01514, 29.4713573, 200, 352.6346)] - public void Convert_Lab_to_Lchuv(float l, float a, float b, float l2, float c, float h) + public void Convert_Lab_To_Lchuv(float l, float a, float b, float l2, float c, float h) { // Arrange CieLab input = new(l, a, b); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLuvConversionTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLuvConversionTests.cs index 17df78bdf..fb9f25bd8 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLuvConversionTests.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLuvConversionTests.cs @@ -19,7 +19,7 @@ public class CieLabAndCieLuvConversionTests [Theory] [InlineData(0, 0, 0, 0, 0, 0)] [InlineData(10, 36.0555, 303.6901, 10.6006718, -17.24077, 82.8835)] - public void Convert_CieLuv_to_CieLab(float l, float u, float v, float l2, float a, float b) + public void Convert_CieLuv_To_CieLab(float l, float u, float v, float l2, float a, float b) { // Arrange CieLuv input = new(l, u, v); @@ -48,7 +48,7 @@ public class CieLabAndCieLuvConversionTests [Theory] [InlineData(0, 0, 0, 0, 0, 0)] [InlineData(10.0151367, -23.9644356, 17.0226, 10.0000038, -12.830183, 15.1829338)] - public void Convert_CieLab_to_CieLuv(float l, float a, float b, float l2, float u, float v) + public void Convert_CieLab_To_CieLuv(float l, float a, float b, float l2, float u, float v) { // Arrange CieLab input = new(l, a, b); diff --git a/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieXyyConversionTests.cs b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieXyyConversionTests.cs new file mode 100644 index 000000000..074173da5 --- /dev/null +++ b/tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieXyyConversionTests.cs @@ -0,0 +1,70 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.ImageSharp.ColorProfiles; + +namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion; + +/// +/// Tests - conversions. +/// +public class CieLabAndCieXyyConversionTests +{ + private static readonly ApproximateColorProfileComparer Comparer = new(.0002F); + + [Theory] + [InlineData(0, 0, 0, 0, 0, 0)] + [InlineData(0.8644734, 0.06098868, 0.06509002, 30.6619, 291.5721, -11.2526)] + public void Convert_CieXyy_To_CieLab(float x, float y, float yl, float l, float a, float b) + { + // Arrange + CieXyy input = new(x, y, yl); + CieLab expected = new(l, a, b); + ColorProfileConverter converter = new(); + + Span inputSpan = new CieXyy[5]; + inputSpan.Fill(input); + + Span actualSpan = new CieLab[5]; + + // Act + CieLab actual = converter.Convert(input); + converter.Convert(inputSpan, actualSpan); + + // Assert + Assert.Equal(expected, actual, Comparer); + + for (int i = 0; i < actualSpan.Length; i++) + { + Assert.Equal(expected, actualSpan[i], Comparer); + } + } + + [Theory] + [InlineData(0, 0, 0, 0, 0, 0)] + [InlineData(30.6619, 291.5721, -11.2526, 0.8644734, 0.06098868, 0.06509002)] + public void Convert_CieLab_To_CieXyy(float l, float a, float b, float x, float y, float yl) + { + // Arrange + CieLab input = new(l, a, b); + CieXyy expected = new(x, y, yl); + ColorProfileConverter converter = new(); + + Span inputSpan = new CieLab[5]; + inputSpan.Fill(input); + + Span actualSpan = new CieXyy[5]; + + // Act + CieXyy actual = converter.Convert(input); + converter.Convert(inputSpan, actualSpan); + + // Assert + Assert.Equal(expected, actual, Comparer); + + for (int i = 0; i < actualSpan.Length; i++) + { + Assert.Equal(expected, actualSpan[i], Comparer); + } + } +}