Skip to content

zivni/ImageMagickApprovalReporter

Repository files navigation

ImageMagickApprovalReporter

A image reporter to be used with ApprovalTests.Net

ApprovalTest has several built-in bindings to reporters you can use. One of them which is very nice is Perforce P4Merge. But for me it has several limitations, the foremost is that there is no way to approve an image.

This library uses Magick.NET (a .net wrapper for ImageMagick) for showing the diffrences between the images.

Usage

Just add [UseReporter(typeof(IMImageReporter)] attribute on the test class or test method. See the AprrovalTests documentation

NuGet Availabilty

Install-Package ImageMagickApprovalReporter

Example

    [TestClass, UseReporter(typeof(IMImageReporter))]
    public class ImageReporterTests
    {
        [TestMethod]
        public void TestImage()
        {
            string filePath=@"c:\myFile.png";

            SUT.DoSomthingToFile(filePath);

            Approvals.VerifyFile(filePath);
        }
    }

ScreenShots

At first, there is nothing to compare to, so just approve it if it is the right file

Compare using the outline method

Compare using the absolute method

When the image attributes are different, the differences are highlighted

Contributions

If you are good at ImageMagick and can make the Comparsions better, please help.

License

MIT License

About

A image reporter to be used with ApprovalTests.net

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages