Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants committed Jan 25, 2022
1 parent f2f7199 commit 05e8d16
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,36 @@ public void Issue1911()
Assert.Equal(100, image.Height);
}

[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32)]
public void Identity<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage();

Matrix3x2 m = Matrix3x2.Identity;
Rectangle r = new(25, 25, 50, 50);
image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic));
image.DebugSave(provider);
image.CompareToReferenceOutput(ValidatorComparer, provider);
}

[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0.0001F)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 57F)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0F)]
public void Transform_With_Custom_Dimensions<TPixel>(TestImageProvider<TPixel> provider, float radians)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage();

var m = Matrix3x2.CreateRotation(radians, new Vector2(50, 50));
Rectangle r = new(25, 25, 50, 50);
image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic));
image.DebugSave(provider, testOutputDetails: radians);
image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: radians);
}

private static IResampler GetResampler(string name)
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,36 @@ public void Issue1911()
Assert.Equal(100, image.Height);
}

[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32)]
public void Identity<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage();

Matrix4x4 m = Matrix4x4.Identity;
Rectangle r = new(25, 25, 50, 50);
image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic));
image.DebugSave(provider);
image.CompareToReferenceOutput(ValidatorComparer, provider);
}

[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0.0001F)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 57F)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0F)]
public void Transform_With_Custom_Dimensions<TPixel>(TestImageProvider<TPixel> provider, float radians)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage();

Matrix4x4 m = Matrix4x4.CreateRotationX(radians, new Vector3(50, 50, 1F)) * Matrix4x4.CreateRotationY(radians, new Vector3(50, 50, 1F));
Rectangle r = new(25, 25, 50, 50);
image.Mutate(x => x.Transform(r, m, new Size(100, 100), KnownResamplers.Bicubic));
image.DebugSave(provider, testOutputDetails: radians);
image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: radians);
}

private static IResampler GetResampler(string name)
{
PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 05e8d16

Please sign in to comment.