mirror of https://github.com/SixLabors/ImageSharp
2 changed files with 37 additions and 42 deletions
@ -0,0 +1,37 @@ |
|||
// <copyright file="FlipTest.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 ImageSharp.Processing; |
|||
|
|||
using Xunit; |
|||
|
|||
public class FlipTests : FileTestBase |
|||
{ |
|||
public static readonly string[] FlipFiles = { TestImages.Bmp.F }; |
|||
|
|||
public static readonly TheoryData<FlipType> FlipValues |
|||
= new TheoryData<FlipType> |
|||
{ |
|||
{ FlipType.None }, |
|||
{ FlipType.Vertical }, |
|||
{ FlipType.Horizontal }, |
|||
}; |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(FlipFiles), nameof(FlipValues), StandardPixelType)] |
|||
public void ImageShouldFlip<TPixel>(TestImageProvider<TPixel> provider, FlipType flipType) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.Flip(flipType) |
|||
.DebugSave(provider, flipType, Extensions.Bmp); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,42 +0,0 @@ |
|||
// <copyright file="RotateFlipTest.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 ImageSharp.Processing; |
|||
using Xunit; |
|||
|
|||
public class FlipTests : FileTestBase |
|||
{ |
|||
public static readonly TheoryData<FlipType> FlipValues |
|||
= new TheoryData<FlipType> |
|||
{ |
|||
{ FlipType.None }, |
|||
{ FlipType.Vertical }, |
|||
{ FlipType.Horizontal }, |
|||
}; |
|||
|
|||
[Theory] |
|||
[MemberData(nameof(FlipValues))] |
|||
public void ImageShouldFlip(FlipType flipType) |
|||
{ |
|||
string path = this.CreateOutputDirectory("Flip"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName(flipType); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Flip(flipType).Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue