Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.pdf binary
*.png binary
*.tiff binary
*.webp binary

*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649;NU1608;NU1109</NoWarn>
<Version>3.7.7</Version>
<Version>3.8.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
Expand Down
Binary file added src/Tests/Tests.VerifyWebp.verified.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public Task CompareDifferent()
public Task VerifyPdf() =>
VerifyFile("sample.pdf");

[Test]
public Task VerifyWebp() =>
VerifyFile("sample.webp");

[Test]
public Task VerifyPdfWithName() =>
Verify(targets: [new("pdf", File.OpenRead("sample.pdf"), "name")]);
Expand Down
Binary file added src/Tests/sample.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/Verify.ImageMagick/VerifyImageMagick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public static void Initialize()
VerifierSettings.RegisterStreamConverter(
"png",
(name, stream, context) => ConvertImage(name, stream, context, "png", MagickFormat.Png));
VerifierSettings.RegisterStreamConverter(
"webp",
(name, stream, context) => ConvertImage(name, stream, context, "webp", MagickFormat.WebP));
VerifierSettings.RegisterStreamConverter(
"tiff",
(name, stream, context) => ConvertImage(name, stream, context, "tiff", MagickFormat.Tiff));
Expand Down Expand Up @@ -61,6 +64,7 @@ public static void RegisterComparers(double threshold = .005, ErrorMetric metric
RegisterComparer(threshold, metric, "jpg");
RegisterComparer(threshold, metric, "bmp");
RegisterComparer(threshold, metric, "tiff");
RegisterComparer(threshold, metric, "webp");
VerifierSettings.RegisterStringComparer(
"svg",
(received, verified, _) => CompareSvg(threshold, metric, received, verified));
Expand Down Expand Up @@ -97,7 +101,7 @@ internal static Task<CompareResult> Compare(double threshold, ErrorMetric metric
public static void ImageMagickComparer(this VerifySettings settings, double threshold = .005, ErrorMetric metric = ErrorMetric.Fuzz) =>
settings.UseStreamComparer(
(received, verified, _) => Compare(threshold, metric, received, verified),
extensions: ["png", "jpg", "bmp", "tiff"]);
extensions: ["png", "jpg", "bmp", "tiff", "webp"]);

/// <summary>
/// Helper method that calls <see cref="RegisterPdfToPngConverter"/> and
Expand Down