Browse Source

Fix quantizer test (sneak in this PR)

Completely unrelated to the rest of the work I just don't want to have to go through the full PR, test process for this.
af/merge-core
James Jackson-South 8 years ago
parent
commit
384dfb1fb4
  1. 10
      tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs

10
tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs

@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests
[WithFile(TestImages.Png.CalliphoraPartial, nameof(QuantizerNames), PixelTypes.Rgba32)] [WithFile(TestImages.Png.CalliphoraPartial, nameof(QuantizerNames), PixelTypes.Rgba32)]
[WithFile(TestImages.Png.Bike, nameof(QuantizerNames), PixelTypes.Rgba32)] [WithFile(TestImages.Png.Bike, nameof(QuantizerNames), PixelTypes.Rgba32)]
public void QuantizeImageShouldPreserveMaximumColorPrecision<TPixel>(TestImageProvider<TPixel> provider, string quantizerName) public void QuantizeImageShouldPreserveMaximumColorPrecision<TPixel>(TestImageProvider<TPixel> provider, string quantizerName)
where TPixel:struct,IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
provider.Configuration.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling(); provider.Configuration.MemoryManager = ArrayPoolMemoryManager.CreateWithModeratePooling();
@ -84,7 +84,7 @@ namespace SixLabors.ImageSharp.Tests
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
{ {
image.Mutate(c => c.Quantize(quantizer)); image.Mutate(c => c.Quantize(quantizer));
image.DebugSave(provider); image.DebugSave(provider, new PngEncoder() { PngColorType = PngColorType.Palette }, testOutputDetails: quantizerName);
} }
provider.Configuration.MemoryManager.ReleaseRetainedResources(); provider.Configuration.MemoryManager.ReleaseRetainedResources();
@ -128,7 +128,7 @@ namespace SixLabors.ImageSharp.Tests
private static IQuantizer GetQuantizer(string name) private static IQuantizer GetQuantizer(string name)
{ {
PropertyInfo property = typeof(KnownQuantizers).GetTypeInfo().GetProperty(name); PropertyInfo property = typeof(KnownQuantizers).GetTypeInfo().GetProperty(name);
return (IQuantizer) property.GetMethod.Invoke(null, new object[0]); return (IQuantizer)property.GetMethod.Invoke(null, new object[0]);
} }
[Fact] [Fact]
@ -185,7 +185,7 @@ namespace SixLabors.ImageSharp.Tests
} }
} }
} }
[Theory] [Theory]
[InlineData(10, 10, "png")] [InlineData(10, 10, "png")]
[InlineData(100, 100, "png")] [InlineData(100, 100, "png")]
@ -213,7 +213,7 @@ namespace SixLabors.ImageSharp.Tests
memoryStream.Position = 0; memoryStream.Position = 0;
var imageInfo = Image.Identify(memoryStream); var imageInfo = Image.Identify(memoryStream);
Assert.Equal(imageInfo.Width, width); Assert.Equal(imageInfo.Width, width);
Assert.Equal(imageInfo.Height, height); Assert.Equal(imageInfo.Height, height);
} }

Loading…
Cancel
Save