11// Copyright (c) Six Labors.
22// Licensed under the Apache License, Version 2.0.
33
4+ using System . Globalization ;
45using SixLabors . ImageSharp . PixelFormats ;
56using SixLabors . ImageSharp . Processing ;
67using SixLabors . ImageSharp . Processing . Processors . Binarization ;
@@ -64,7 +65,7 @@ public void ImageShouldApplyBinarySaturationThresholdFilter<TPixel>(TestImagePro
6465 {
6566 image . Mutate ( x => x . BinaryThreshold ( value , BinaryThresholdColorComponent . Saturation ) ) ;
6667 image . DebugSave ( provider , value ) ;
67- image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , System . Globalization . NumberFormatInfo . InvariantInfo ) ) ;
68+ image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
6869 }
6970 }
7071
@@ -80,7 +81,7 @@ public void ImageShouldApplyBinarySaturationThresholdInBox<TPixel>(TestImageProv
8081
8182 image . Mutate ( x => x . BinaryThreshold ( value , BinaryThresholdColorComponent . Saturation , bounds ) ) ;
8283 image . DebugSave ( provider , value ) ;
83- image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , System . Globalization . NumberFormatInfo . InvariantInfo ) ) ;
84+ image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
8485 }
8586 }
8687
@@ -93,7 +94,16 @@ public void ImageShouldApplyBinaryMaxChromaThresholdFilter<TPixel>(TestImageProv
9394 {
9495 image . Mutate ( x => x . BinaryThreshold ( value , BinaryThresholdColorComponent . MaxChroma ) ) ;
9596 image . DebugSave ( provider , value ) ;
96- image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , System . Globalization . NumberFormatInfo . InvariantInfo ) ) ;
97+
98+ if ( ! TestEnvironment . Is64BitProcess && TestEnvironment . IsFramework )
99+ {
100+ var comparer = ImageComparer . TolerantPercentage ( 0.0004F ) ;
101+ image . CompareToReferenceOutput ( comparer , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
102+ }
103+ else
104+ {
105+ image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
106+ }
97107 }
98108 }
99109
@@ -109,7 +119,16 @@ public void ImageShouldApplyBinaryMaxChromaThresholdInBox<TPixel>(TestImageProvi
109119
110120 image . Mutate ( x => x . BinaryThreshold ( value , BinaryThresholdColorComponent . MaxChroma , bounds ) ) ;
111121 image . DebugSave ( provider , value ) ;
112- image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , System . Globalization . NumberFormatInfo . InvariantInfo ) ) ;
122+
123+ if ( ! TestEnvironment . Is64BitProcess && TestEnvironment . IsFramework )
124+ {
125+ var comparer = ImageComparer . TolerantPercentage ( 0.0004F ) ;
126+ image . CompareToReferenceOutput ( comparer , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
127+ }
128+ else
129+ {
130+ image . CompareToReferenceOutput ( ImageComparer . Exact , provider , value . ToString ( "0.00" , NumberFormatInfo . InvariantInfo ) ) ;
131+ }
113132 }
114133 }
115134 }
0 commit comments