//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp.Tests.Processing.Transforms
{
using ImageSharp.PixelFormats;
using ImageSharp.Processing;
using Xunit;
public class RotateTests : 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]
[WithFileCollection(nameof(DefaultFiles), nameof(RotateFloatValues), DefaultPixelType)]
public void ImageShouldRotate(TestImageProvider provider, float value)
where TPixel : struct, IPixel
{
using (Image image = provider.GetImage())
{
image.Rotate(value)
.DebugSave(provider, value, Extensions.Bmp);
}
}
[Theory]
[WithFileCollection(nameof(DefaultFiles), nameof(RotateEnumValues), DefaultPixelType)]
public void ImageShouldRotateEnum(TestImageProvider provider, RotateType value)
where TPixel : struct, IPixel
{
using (Image image = provider.GetImage())
{
image.Rotate(value)
.DebugSave(provider, value, Extensions.Bmp);
}
}
}
}