Browse Source

Add test for GetConverter with ycck color space which uses FeatureTestRunner to disable specific hw features

pull/2416/head
Brian Popow 3 years ago
parent
commit
f0530bf56a
  1. 29
      tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

29
tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

@ -166,6 +166,35 @@ public class JpegColorConverterTests
}
}
[Fact]
public void GetConverterReturnsCorrectConverterWithYcckColorSpace()
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{
// arrange
Type expectedType = typeof(JpegColorConverterBase.YccKScalar);
if (Avx.IsSupported)
{
expectedType = typeof(JpegColorConverterBase.YccKAvx);
}
else if (Sse2.IsSupported)
{
expectedType = typeof(JpegColorConverterBase.YccKVector);
}
// act
JpegColorConverterBase converter = JpegColorConverterBase.GetConverter(JpegColorSpace.Ycck, 8);
Type actualType = converter.GetType();
// assert
Assert.Equal(expectedType, actualType);
}
}
[Theory]
[InlineData(JpegColorSpace.Grayscale, 1)]
[InlineData(JpegColorSpace.Ycck, 4)]

Loading…
Cancel
Save