mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.9 KiB
68 lines
1.9 KiB
// <copyright file="RotateTest.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 Xunit;
|
|
|
|
public class RotateTest : FileTestBase
|
|
{
|
|
public static readonly TheoryData<float> RotateFloatValues
|
|
= new TheoryData<float>
|
|
{
|
|
170 ,
|
|
-170 ,
|
|
};
|
|
|
|
public static readonly TheoryData<RotateType> RotateEnumValues
|
|
= new TheoryData<RotateType>
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|