Skip to content

Commit ba066f9

Browse files
Fix namespace add first LCH test
1 parent 3ac5f70 commit ba066f9

15 files changed

+84
-14
lines changed

tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLchuvConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="CieLchuv"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieLuvConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="CieLuv"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLabAndCieXyyConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="CieXyy"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLabAndCmykConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="Cmyk"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLabAndRgbConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="Rgb"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLabAndYCbCrConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLab"/>-<see cref="YCbCr"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLchuvAndCieLchConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLchuv"/>-<see cref="CieLch"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieLchuvAndCieLuvConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieLuv"/>-<see cref="CieLchuv"/> conversions.

tests/ImageSharp.Tests/ColorProfiles/CieXyyAndLmsConversionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using SixLabors.ImageSharp.ColorProfiles;
55

6-
namespace SixLabors.ImageSharp.Tests.ColorProfiles.Conversion;
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
77

88
/// <summary>
99
/// Tests <see cref="CieXyy"/>-<see cref="Lms"/> conversions.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright (c) Six Labors.
2+
// Licensed under the Six Labors Split License.
3+
4+
using SixLabors.ImageSharp.ColorProfiles;
5+
6+
namespace SixLabors.ImageSharp.Tests.ColorProfiles;
7+
8+
/// <summary>
9+
/// Tests <see cref="CieXyz"/>-<see cref="CieLch"/> conversions.
10+
/// </summary>
11+
public class CieXyzAndCieLchConversionTests
12+
{
13+
private static readonly ApproximateColorProfileComparer Comparer = new(.0002f);
14+
15+
[Theory]
16+
[InlineData(0, 0, 0, 0, 0, 0)]
17+
[InlineData(0.360555, 0.936901, 0.1001514, 97.50697, 161.235321, 143.157)]
18+
public void Convert_CieXyz_to_CieLch(float x, float y, float yl, float l, float c, float h)
19+
{
20+
// Arrange
21+
CieXyz input = new(x, y, yl);
22+
CieLch expected = new(l, c, h);
23+
ColorProfileConverter converter = new();
24+
25+
Span<CieXyz> inputSpan = new CieXyz[5];
26+
inputSpan.Fill(input);
27+
28+
Span<CieLch> actualSpan = new CieLch[5];
29+
30+
// Act
31+
CieLch actual = converter.Convert<CieXyz, CieLch>(input);
32+
converter.Convert<CieXyz, CieLch>(inputSpan, actualSpan);
33+
34+
// Assert
35+
Assert.Equal(expected, actual, Comparer);
36+
37+
for (int i = 0; i < actualSpan.Length; i++)
38+
{
39+
Assert.Equal(expected, actualSpan[i], Comparer);
40+
}
41+
}
42+
43+
[Theory]
44+
[InlineData(0, 0, 0, 0, 0, 0)]
45+
[InlineData(97.50697, 161.235321, 143.157, 0.3605551, 0.936901, 0.1001514)]
46+
public void Convert_CieLch_to_CieXyz(float l, float c, float h, float x, float y, float yl)
47+
{
48+
// Arrange
49+
CieLch input = new(l, c, h);
50+
CieXyz expected = new(x, y, yl);
51+
ColorProfileConverter converter = new();
52+
53+
Span<CieLch> inputSpan = new CieLch[5];
54+
inputSpan.Fill(input);
55+
56+
Span<CieXyz> actualSpan = new CieXyz[5];
57+
58+
// Act
59+
CieXyz actual = converter.Convert<CieLch, CieXyz>(input);
60+
converter.Convert<CieLch, CieXyz>(inputSpan, actualSpan);
61+
62+
// Assert
63+
Assert.Equal(expected, actual, Comparer);
64+
65+
for (int i = 0; i < actualSpan.Length; i++)
66+
{
67+
Assert.Equal(expected, actualSpan[i], Comparer);
68+
}
69+
}
70+
}

0 commit comments

Comments
 (0)