//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Tests
{
using System.IO;
using Xunit;
public class RotateTest : FileTestBase
{
public static readonly TheoryData RotateFloatValues
= new TheoryData
{
170 ,
-170 ,
};
public static readonly TheoryData RotateEnumValues
= new TheoryData
{
RotateType.None,
RotateType.Rotate90,
RotateType.Rotate180,
RotateType.Rotate270
};
[Theory]
[MemberData("RotateFloatValues")]
public void ImageShouldApplyRotateSampler(float value)
{
string path = CreateOutputDirectory("Rotate");
foreach (TestFile file in Files)
{
string filename = file.GetFileName(value);
Image image = file.CreateImage();
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
{
image.Rotate(value)
.Save(output);
}
}
}
[Theory]
[MemberData("RotateEnumValues")]
public void ImageShouldApplyRotateSampler(RotateType value)
{
string path = CreateOutputDirectory("Rotate");
foreach (TestFile file in Files)
{
string filename = file.GetFileName(value);
Image image = file.CreateImage();
using (FileStream output = File.OpenWrite($"{path}/{filename}"))
{
image.Rotate(value)
.Save(output);
}
}
}
}
}