From 531c110505079db64f81df267ffe214f331b9657 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Sat, 25 Feb 2023 21:19:33 +0100 Subject: [PATCH] Fix hashcode test --- .../Primitives/ColorMatrixTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs index 94309d2008..0a7121ff35 100644 --- a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Globalization; +using System.Numerics; using SixLabors.ImageSharp.Processing; namespace SixLabors.ImageSharp.Tests.Primitives; @@ -115,7 +116,23 @@ public class ColorMatrixTests public void ColorMatrixHashCode() { ColorMatrix m = KnownFilterMatrices.CreateBrightnessFilter(.5F); + HashCode hash = default; + +#if NET7_0_OR_GREATER + Vector4 x = new(m.M11, m.M12, m.M13, m.M14); + Vector4 y = new(m.M21, m.M22, m.M23, m.M24); + Vector4 z = new(m.M31, m.M32, m.M33, m.M34); + Vector4 w = new(m.M41, m.M42, m.M43, m.M44); + Vector4 v = new(m.M51, m.M52, m.M53, m.M54); + + hash.Add(x); + hash.Add(y); + hash.Add(z); + hash.Add(w); + hash.Add(v); +#endif +#if NET6_0 hash.Add(m.M11); hash.Add(m.M12); hash.Add(m.M13); @@ -136,6 +153,8 @@ public class ColorMatrixTests hash.Add(m.M52); hash.Add(m.M53); hash.Add(m.M54); +#endif + Assert.Equal(hash.ToHashCode(), m.GetHashCode()); }