|
|
@ -1,7 +1,6 @@ |
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
using SixLabors.ImageSharp.Processing; |
|
|
using SixLabors.ImageSharp.Processing; |
|
|
using Xunit; |
|
|
using Xunit; |
|
|
@ -27,5 +26,24 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
{ |
|
|
{ |
|
|
provider.RunValidatingProcessorTest(x => x.EntropyCrop(value), value, appendPixelTypeToFileName: false); |
|
|
provider.RunValidatingProcessorTest(x => x.EntropyCrop(value), value, appendPixelTypeToFileName: false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Theory] |
|
|
|
|
|
[WithBlankImages(40, 30, PixelTypes.Rgba32)] |
|
|
|
|
|
[WithBlankImages(30, 40, PixelTypes.Rgba32)] |
|
|
|
|
|
public void Entropy_WillNotCropWhiteImage<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
|
|
{ |
|
|
|
|
|
// arrange
|
|
|
|
|
|
using Image<TPixel> image = provider.GetImage(); |
|
|
|
|
|
var expectedHeight = image.Height; |
|
|
|
|
|
var expectedWidth = image.Width; |
|
|
|
|
|
|
|
|
|
|
|
// act
|
|
|
|
|
|
image.Mutate(img => img.EntropyCrop()); |
|
|
|
|
|
|
|
|
|
|
|
// assert
|
|
|
|
|
|
Assert.Equal(image.Width, expectedWidth); |
|
|
|
|
|
Assert.Equal(image.Height, expectedHeight); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|