Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for GetConverter with ycck color space which uses FeatureTes…
…tRunner to disable specific hw features
  • Loading branch information
brianpopow committed Mar 27, 2023
commit f0530bf56a404bbe3be6a20b4748793b078d543c
29 changes: 29 additions & 0 deletions tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,35 @@ static void RunTest(string arg)
}
}

[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)]
Expand Down