public void PixelType_PropertyValueIsCorrect <TPixel>(TestImageProvider <TPixel> provider, PixelTypes expected) where TPixel : struct, IPixel <TPixel> { Assert.Equal(expected, provider.PixelType); }
public void GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Assert.NotNull(provider.Utility.SourceFileOrDescription); TestDecoderWithParameters.DoTestThreadSafe(() => { string testName = nameof(this.GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual); var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 42 }; decoder1.InitCaller(testName); var decoder2 = new TestDecoderWithParameters() { Param1 = "LoL", Param2 = 42 }; decoder2.InitCaller(testName); provider.GetImage(decoder1); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); provider.GetImage(decoder2); Assert.Equal(2, TestDecoderWithParameters.GetInvocationCount(testName)); }); }
public void NoOutputSubfolderIsPresentByDefault <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Assert.Empty(provider.Utility.OutputSubfolderName); }
public void WorksWithAllCompressionLevels <TPixel>(TestImageProvider <TPixel> provider, int compressionLevel) where TPixel : struct, IPixel <TPixel> { TestPngEncoderCore(provider, PngColorType.RgbWithAlpha, PngFilterMethod.Adaptive, compressionLevel, appendCompressionLevel: true); }
public void GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { if (!TestEnvironment.Is64BitProcess) { // We don't cache with the 32 bit build. return; } Assert.NotNull(provider.Utility.SourceFileOrDescription); TestDecoderWithParameters.DoTestThreadSafe(() => { string testName = nameof(this.GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual); var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 }; decoder1.InitCaller(testName); var decoder2 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 }; decoder2.InitCaller(testName); provider.GetImage(decoder1); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); provider.GetImage(decoder2); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); }); }
public void IsNotBoundToSinglePixelType <TPixel>(TestImageProvider <TPixel> provider, PngColorType pngColorType) where TPixel : struct, IPixel <TPixel> { TestPngEncoderCore(provider, pngColorType, PngFilterMethod.Adaptive, appendPixelType: true, appendPngColorType: true); }
public void WorksWithAllFilterMethods <TPixel>(TestImageProvider <TPixel> provider, PngFilterMethod pngFilterMethod) where TPixel : struct, IPixel <TPixel> { TestPngEncoderCore(provider, PngColorType.RgbWithAlpha, pngFilterMethod, appendPngFilterMethod: true); }
public void PaletteColorType_WuQuantizer <TPixel>(TestImageProvider <TPixel> provider, int paletteSize) where TPixel : struct, IPixel <TPixel> { TestPngEncoderCore(provider, PngColorType.Palette, PngFilterMethod.Adaptive, paletteSize: paletteSize, appendPaletteSize: true); }
public void WorksWithDifferentSizes <TPixel>(TestImageProvider <TPixel> provider, PngColorType pngColorType) where TPixel : struct, IPixel <TPixel> { TestPngEncoderCore(provider, pngColorType, PngFilterMethod.Adaptive, appendPngColorType: true); }
public void TolerantImageComparer_DoesNotApproveSimilarityAboveTolerance <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { using (Image <TPixel> image = provider.GetImage()) { using (Image <TPixel> clone = image.Clone()) { byte perChannelChange = 2; ImagingTestCaseUtility.ModifyPixel(clone, 3, 1, perChannelChange); var comparer = ImageComparer.Tolerant(); ImageDifferenceIsOverThresholdException ex = Assert.ThrowsAny <ImageDifferenceIsOverThresholdException>( () => { comparer.VerifySimilarity(image, clone); }); PixelDifference diff = ex.Reports.Single().Differences.Single(); Assert.Equal(new Point(3, 1), diff.Position); } } }
public void CreateAndResize(TestImageProvider <Rgba32> provider) { using Image <Rgba32> image = provider.GetImage(); image.Mutate(c => c.Resize(1000, 1000)); image.DebugSave(provider); }
public void OutputSubfolderName_ValueIsTakeFromGroupOutputAttribute <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Assert.Equal("Foo", provider.Utility.OutputSubfolderName); }
public void GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Assert.NotNull(provider.Utility.SourceFileOrDescription); TestDecoder.DoTestThreadSafe( () => { string testName = nameof(this.GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache); var decoder = new TestDecoder(); decoder.InitCaller(testName); provider.GetImage(decoder); Assert.Equal(1, TestDecoder.GetInvocationCount(testName)); provider.GetImage(decoder); Assert.Equal(1, TestDecoder.GetInvocationCount(testName)); }); }
public void Encode_WorksWithDifferentSizes <TPixel>(TestImageProvider <TPixel> provider, BmpBitsPerPixel bitsPerPixel) where TPixel : struct, IPixel <TPixel> { TestBmpEncoderCore(provider, bitsPerPixel); }
public void Encode_IsNotBoundToSinglePixelType <TPixel>(TestImageProvider <TPixel> provider, BmpBitsPerPixel bitsPerPixel) where TPixel : struct, IPixel <TPixel> { TestBmpEncoderCore(provider, bitsPerPixel); }
public void CompareToReferenceOutput_WhenReferenceFileMissing_Throws <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { using (Image <TPixel> image = provider.GetImage()) { Assert.ThrowsAny <Exception>(() => image.CompareToReferenceOutput(provider)); } }