Skip to content

Commit d8e0910

Browse files
Use tolerance comparer
1 parent 73e4347 commit d8e0910

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

tests/ImageSharp.Drawing.Tests/Processing/Backends/WebGPUDrawingBackendTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,28 +864,36 @@ private static void DebugSaveBackendTriplet<TPixel>(
864864
$"{testName}_Default",
865865
appendPixelTypeToFileName: false,
866866
appendSourceFileOrDescription: false);
867+
867868
cpuRegionImage.DebugSave(
868869
provider,
869870
$"{testName}_WebGPU_CPURegion",
870871
appendPixelTypeToFileName: false,
871872
appendSourceFileOrDescription: false);
873+
872874
nativeSurfaceImage.DebugSave(
873875
provider,
874876
$"{testName}_WebGPU_NativeSurface",
875877
appendPixelTypeToFileName: false,
876878
appendSourceFileOrDescription: false);
877879

880+
ImageComparer tolerantComparer = ImageComparer.TolerantPercentage(0.0003F);
878881
defaultImage.CompareToReferenceOutput(
882+
tolerantComparer,
879883
provider,
880884
$"{testName}_Default",
881885
appendPixelTypeToFileName: false,
882886
appendSourceFileOrDescription: false);
887+
883888
cpuRegionImage.CompareToReferenceOutput(
889+
tolerantComparer,
884890
provider,
885891
$"{testName}_WebGPU_CPURegion",
886892
appendPixelTypeToFileName: false,
887893
appendSourceFileOrDescription: false);
894+
888895
nativeSurfaceImage.CompareToReferenceOutput(
896+
tolerantComparer,
889897
provider,
890898
$"{testName}_WebGPU_NativeSurface",
891899
appendPixelTypeToFileName: false,

tests/ImageSharp.Drawing.Tests/Processing/DrawingCanvasTests.RegionAndState.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Numerics;
55
using SixLabors.ImageSharp.Drawing.Processing;
6+
using SixLabors.ImageSharp.Drawing.Tests.TestUtilities.ImageComparison;
67
using SixLabors.ImageSharp.PixelFormats;
78

89
namespace SixLabors.ImageSharp.Drawing.Tests.Processing;
@@ -59,7 +60,9 @@ public void SaveRestore_ClipPath_MatchesReference<TPixel>(TestImageProvider<TPix
5960
canvas.Flush();
6061

6162
target.DebugSave(provider, appendSourceFileOrDescription: false);
62-
target.CompareToReferenceOutput(provider, appendSourceFileOrDescription: false);
63+
64+
ImageComparer tolerantComparer = ImageComparer.TolerantPercentage(0.0003F);
65+
target.CompareToReferenceOutput(provider, tolerantComparer, appendSourceFileOrDescription: false);
6366
}
6467

6568
[Theory]

0 commit comments

Comments
 (0)