📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.4 KiB

// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
[GroupOutput("Transforms")]
public class EntropyCropTest
{
public static readonly TheoryData<float> EntropyCropValues = new TheoryData<float> { .25F, .75F };
public static readonly string[] InputImages =
{
TestImages.Png.Ducky,
TestImages.Jpeg.Baseline.Jpeg400,
TestImages.Jpeg.Baseline.MultiScanBaselineCMYK
};
[Theory]
[WithFileCollection(nameof(InputImages), nameof(EntropyCropValues), PixelTypes.Rgba32)]
public void EntropyCrop<TPixel>(TestImageProvider<TPixel> provider, float value)
where TPixel : unmanaged, IPixel<TPixel>
{
// The result dimensions of EntropyCrop may differ on .NET Core 3.1 because of unstable edge detection results.
// TODO: Re-enable this test case if we manage to improve stability.
#if SUPPORTS_RUNTIME_INTRINSICS
if (provider.SourceFileOrDescription.Contains(TestImages.Png.Ducky))
{
return;
}
#endif
provider.RunValidatingProcessorTest(x => x.EntropyCrop(value), value, appendPixelTypeToFileName: false);
}
}
}