Skip to content

Commit e55915e

Browse files
committed
Updated expectation
1 parent 368efa0 commit e55915e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Codeuctivity.HtmlRendererTests/Infrastructure/DocumentAsserter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static class DocumentAsserter
88
{
99
private const string TestOutputFirectory = "../../../../TestResult";
1010

11-
internal static void AssertImageIsEqual(string actualImagePath, string expectImageFilePath, int allowedPixelErrorCount)
11+
internal static void AssertImageIsEqual(string actualImagePath, string expectImageFilePath, int allowedPixelErrorCount, int pixelColorShiftTolerance = 0)
1212
{
1313
var actualFullPath = Path.GetFullPath(actualImagePath);
1414
var expectFullPath = Path.GetFullPath(expectImageFilePath);
@@ -60,7 +60,7 @@ internal static void AssertImageIsEqual(string actualImagePath, string expectIma
6060
SixLabors.ImageSharp.ImageExtensions.SaveAsPng(maskImage, fileStreamDifferenceMask);
6161
}
6262

63-
var result = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath);
63+
var result = ImageSharpCompare.ImageSharpCompare.CalcDiff(actualFullPath, expectFullPath, pixelColorShiftTolerance: pixelColorShiftTolerance);
6464

6565
if (allowedPixelErrorCount < result.PixelErrorCount)
6666
{

Codeuctivity.HtmlRendererTests/RendererTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task ShouldConvertHtmlToPdf(string testFileName)
3737
if (!IsRunningOnAzureOrMacos())
3838
{
3939
PDFtoImage.Conversion.SavePng(actualImagePathDirectory, await File.ReadAllBytesAsync(actualFilePath), 0);
40-
DocumentAsserter.AssertImageIsEqual(actualImagePathDirectory, expectReferenceFilePath, 8080);
40+
DocumentAsserter.AssertImageIsEqual(actualImagePathDirectory, expectReferenceFilePath, 8080, 400);
4141
}
4242
File.Delete(actualFilePath);
4343
}
@@ -66,8 +66,8 @@ public async Task ShouldConvertHtmlToPdfWithOptions(string testFileName, bool pr
6666

6767
if (!IsRunningOnAzureOrMacos())
6868
{
69-
PDFtoImage.Conversion.SavePng(actualImagePathDirectory, await File.ReadAllBytesAsync(actualFilePath));
70-
DocumentAsserter.AssertImageIsEqual(actualImagePathDirectory, expectReferenceFilePath, allowedPixelDiff);
69+
PDFtoImage.Conversion.SavePng(actualImagePathDirectory, await File.ReadAllBytesAsync(actualFilePath), 0);
70+
DocumentAsserter.AssertImageIsEqual(actualImagePathDirectory, expectReferenceFilePath, allowedPixelDiff, 400);
7171
}
7272
File.Delete(actualFilePath);
7373
}

0 commit comments

Comments
 (0)