Skip to content

Commit

Permalink
Revert "Update WmlToHtmlConverterTests.cs"
Browse files Browse the repository at this point in the history
This reverts commit 62e89da.
  • Loading branch information
stesee committed Apr 8, 2023
1 parent e985873 commit 9a4c505
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ internal static async Task AssertImageIsEqual(string actualImagePath, string exp

Assert.True(File.Exists(expectFullPath), $"ExpectReferenceImagePath not found \n{expectFullPath}\n copy over \n{actualFullPath}\n if this is a new test case.");

var resizeOption = imageSizeMayDiffer ? ImageSharpCompare.ResizeOption.Resize : ImageSharpCompare.ResizeOption.DontResize;
if (ImageSharpCompare.ImageSharpCompare.ImagesAreEqual(actualFullPath, expectFullPath, resizeOption))
if (ImageSharpCompare.ImageSharpCompare.ImagesAreEqual(actualFullPath, expectFullPath, imageSizeMayDiffer ? ImageSharpCompare.ResizeOption.Resize : ImageSharpCompare.ResizeOption.DontResize))
{
return;
}
Expand All @@ -161,7 +160,7 @@ internal static async Task AssertImageIsEqual(string actualImagePath, string exp
Assert.Fail($"Actual Dimension differs from expected \nExpected {expectFullPath}\ndiffers to actual {actualFullPath} \nReplace {expectFullPath} with the new value.");
}

using (var maskImage = ImageSharpCompare.ImageSharpCompare.CalcDiffMaskImage(actualFullPath, expectFullPath, resizeOption))
using (var maskImage = ImageSharpCompare.ImageSharpCompare.CalcDiffMaskImage(actualFullPath, expectFullPath))
{
using var fs = new FileStream(newDiffImage, FileMode.OpenOrCreate, FileAccess.ReadWrite);
await maskImage.SaveAsync(fs, new SixLabors.ImageSharp.Formats.Png.PngEncoder());
Expand All @@ -172,7 +171,7 @@ internal static async Task AssertImageIsEqual(string actualImagePath, string exp

if (File.Exists(allowedDiffImage))
{
var resultWithAllowedDiff = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath, allowedDiffImage, resizeOption);
var resultWithAllowedDiff = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath, allowedDiffImage, imageSizeMayDiffer ? ImageSharpCompare.ResizeOption.Resize : ImageSharpCompare.ResizeOption.DontResize);

var pixelErrorCountAboveExpectedWithDiff = resultWithAllowedDiff.PixelErrorCount > allowedPixelErrorCount;
if (pixelErrorCountAboveExpectedWithDiff)
Expand All @@ -183,7 +182,7 @@ internal static async Task AssertImageIsEqual(string actualImagePath, string exp
return;
}

var result = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath, resizeOption);
var result = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath);

var pixelErrorCountAboveExpected = result.PixelErrorCount > allowedPixelErrorCount;
if (pixelErrorCountAboveExpected)
Expand Down

0 comments on commit 9a4c505

Please sign in to comment.