mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: e9adf42e34c17e9518c927a32384b56b915dc43d Former-commit-id: 27a5087388b5222b321a13e5bf4931c6b59d56df Former-commit-id: 93f08ba739fd4d68d921817cddfae19d59cece59af/merge-core
2 changed files with 87 additions and 3 deletions
@ -0,0 +1,48 @@ |
|||
// <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 ImageProcessorCore.Tests |
|||
{ |
|||
using System.IO; |
|||
|
|||
using Xunit; |
|||
|
|||
public class FlipTest : FileTestBase |
|||
{ |
|||
public static readonly TheoryData<FlipType> FlipValues |
|||
= new TheoryData<FlipType> |
|||
{ |
|||
{ FlipType.None }, |
|||
{ FlipType.Vertical }, |
|||
{ FlipType.Horizontal }, |
|||
}; |
|||
|
|||
[Theory] |
|||
[MemberData("FlipValues")] |
|||
public void ImageShouldFlip(FlipType flipType) |
|||
{ |
|||
const string path = "TestOutput/Flip"; |
|||
if (!Directory.Exists(path)) |
|||
{ |
|||
Directory.CreateDirectory(path); |
|||
} |
|||
|
|||
foreach (string file in Files) |
|||
{ |
|||
using (FileStream stream = File.OpenRead(file)) |
|||
{ |
|||
string filename = Path.GetFileNameWithoutExtension(file) + "-" + flipType + Path.GetExtension(file); |
|||
|
|||
Image image = new Image(stream); |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.Flip(flipType, this.ProgressUpdate) |
|||
.Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue