From 28c4e2c93e9099f66831be0bc168cd2c9dc9f39c Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 19 Feb 2018 01:00:44 +0100 Subject: [PATCH] use ImageComparer.Tolerant() when testing Palette PNG encoding --- tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index ef261aac9..7e24f41df 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -19,6 +19,8 @@ namespace SixLabors.ImageSharp.Tests public class PngEncoderTests : FileTestBase { + private const float ToleranceThresholdForPaletteEncoder = 0.01f / 100; + /// /// All types except Palette /// @@ -123,7 +125,7 @@ namespace SixLabors.ImageSharp.Tests using (var encodedImage = Image.Load(referenceOutputFile, referenceDecoder)) { - ImageComparer comparer = null ?? ImageComparer.Exact; + ImageComparer comparer = pngColorType== PngColorType.Palette ? ImageComparer.Tolerant(ToleranceThresholdForPaletteEncoder) : ImageComparer.Exact; comparer.CompareImagesOrFrames(image, encodedImage); } }