Skip to content

Commit 531c110

Browse files
committed
Fix hashcode test
1 parent 908bae3 commit 531c110

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Six Labors Split License.
33

44
using System.Globalization;
5+
using System.Numerics;
56
using SixLabors.ImageSharp.Processing;
67

78
namespace SixLabors.ImageSharp.Tests.Primitives;
@@ -115,7 +116,23 @@ public void ColorMatrixAdd()
115116
public void ColorMatrixHashCode()
116117
{
117118
ColorMatrix m = KnownFilterMatrices.CreateBrightnessFilter(.5F);
119+
118120
HashCode hash = default;
121+
122+
#if NET7_0_OR_GREATER
123+
Vector4 x = new(m.M11, m.M12, m.M13, m.M14);
124+
Vector4 y = new(m.M21, m.M22, m.M23, m.M24);
125+
Vector4 z = new(m.M31, m.M32, m.M33, m.M34);
126+
Vector4 w = new(m.M41, m.M42, m.M43, m.M44);
127+
Vector4 v = new(m.M51, m.M52, m.M53, m.M54);
128+
129+
hash.Add(x);
130+
hash.Add(y);
131+
hash.Add(z);
132+
hash.Add(w);
133+
hash.Add(v);
134+
#endif
135+
#if NET6_0
119136
hash.Add(m.M11);
120137
hash.Add(m.M12);
121138
hash.Add(m.M13);
@@ -136,6 +153,8 @@ public void ColorMatrixHashCode()
136153
hash.Add(m.M52);
137154
hash.Add(m.M53);
138155
hash.Add(m.M54);
156+
#endif
157+
139158

140159
Assert.Equal(hash.ToHashCode(), m.GetHashCode());
141160
}

0 commit comments

Comments
 (0)