Browse Source

test code cleanup

pull/781/head
Anton Firszov 8 years ago
parent
commit
77e72c8000
  1. 12
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs
  2. 4
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs
  3. 23
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

12
tests/ImageSharp.Tests/Processing/Processors/Transforms/KernelMapTests.ReferenceKernelMap.cs → tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.ReferenceKernelMap.cs

@ -1,13 +1,14 @@
using System;
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
public partial class KernelMapTests
public partial class ResizeKernelMapTests
{
/// <summary>
/// Simplified reference implementation for <see cref="ResizeKernelMap"/> functionality.
@ -43,11 +44,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
for (int i = 0; i < destinationSize; i++)
{
//if (i == 21 || i == 64)
//{
// Debug.Print("lol");
//}
double center = ((i + .5) * ratio) - .5;
// Keep inside bounds.

4
tests/ImageSharp.Tests/Processing/Processors/Transforms/KernelMapTests.cs → tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs

@ -15,11 +15,11 @@ using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{
public partial class KernelMapTests
public partial class ResizeKernelMapTests
{
private ITestOutputHelper Output { get; }
public KernelMapTests(ITestOutputHelper output)
public ResizeKernelMapTests(ITestOutputHelper output)
{
this.Output = output;
}

23
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

@ -58,29 +58,6 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
}
}
// TODO: Merge with the previous theory + add test images
[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, nameof(KnownResamplers.Bicubic), 1)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, nameof(KnownResamplers.Bicubic), 10)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, nameof(KnownResamplers.Lanczos3), 10)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, nameof(KnownResamplers.Lanczos8), 10)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, nameof(KnownResamplers.NearestNeighbor), 10)]
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, nameof(KnownResamplers.NearestNeighbor), 1)]
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, nameof(KnownResamplers.NearestNeighbor), 5)]
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, nameof(KnownResamplers.Bicubic), 5)]
public void ScaleUp<TPixel>(TestImageProvider<TPixel> provider, string samplerName, float ratio)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
{
SizeF newSize = image.Size() * ratio;
image.Mutate(x => x.Resize((Size)newSize, TestUtils.GetResampler(samplerName), false));
FormattableString details = $"{samplerName}_{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}";
image.DebugSave(provider, details);
}
}
[Theory]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType, 1)]
[WithFileCollection(nameof(CommonTestImages), DefaultPixelType, 4)]

Loading…
Cancel
Save