Browse Source
Merge pull request #1156 from SixLabors/unitTestWhiteCrop
Add unit test for #1154: entropy crop on white image should not crop
pull/1574/head
James Jackson-South
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
19 additions and
1 deletions
-
tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs
|
|
|
@ -1,7 +1,6 @@ |
|
|
|
// 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; |
|
|
|
@ -27,5 +26,24 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
|
{ |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|