mirror of https://github.com/SixLabors/ImageSharp
3 changed files with 26 additions and 32 deletions
@ -0,0 +1,26 @@ |
|||
// <copyright file="CropTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests.Processing.Transforms |
|||
{ |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class CropTest : FileTestBase |
|||
{ |
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), StandardPixelType)] |
|||
public void ImageShouldCrop<TPixel>(TestImageProvider<TPixel> provider) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Crop(image.Width / 2, image.Height / 2) |
|||
.DebugSave(provider, null, Extensions.Bmp); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
// <copyright file="CropTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests |
|||
{ |
|||
using System.IO; |
|||
|
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class CropTest : FileTestBase |
|||
{ |
|||
[Fact] |
|||
public void ImageShouldApplyCropSampler() |
|||
{ |
|||
string path = this.CreateOutputDirectory("Crop"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) |
|||
{ |
|||
image.Crop(image.Width / 2, image.Height / 2).Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue