Skip to content

Commit 4f41288

Browse files
committed
skip DitherTests on old 32 bit runtimes
1 parent 3468f0a commit 4f41288

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,23 @@ public class DitherTests
4646

4747
private static IErrorDiffuser DefaultErrorDiffuser => KnownDiffusers.Atkinson;
4848

49+
/// <summary>
50+
/// The output is visually correct old 32bit runtime,
51+
/// but it is very different because of floating point inaccuracies.
52+
/// </summary>
53+
private static readonly bool SkipAllDitherTests =
54+
!TestEnvironment.Is64BitProcess && string.IsNullOrEmpty(TestEnvironment.NetCoreVersion);
55+
4956
[Theory]
5057
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32)]
5158
public void ApplyDiffusionFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
5259
where TPixel : struct, IPixel<TPixel>
5360
{
61+
if (SkipAllDitherTests)
62+
{
63+
return;
64+
}
65+
5466
provider.RunRectangleConstrainedValidatingProcessorTest(
5567
(x, rect) => x.Diffuse(DefaultErrorDiffuser, .5F, rect),
5668
comparer: ValidatorComparer);
@@ -61,6 +73,11 @@ public void ApplyDiffusionFilterInBox<TPixel>(TestImageProvider<TPixel> provider
6173
public void ApplyDitherFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
6274
where TPixel : struct, IPixel<TPixel>
6375
{
76+
if (SkipAllDitherTests)
77+
{
78+
return;
79+
}
80+
6481
provider.RunRectangleConstrainedValidatingProcessorTest(
6582
(x, rect) => x.Dither(DefaultDitherer, rect),
6683
comparer: ValidatorComparer);
@@ -71,6 +88,11 @@ public void ApplyDitherFilterInBox<TPixel>(TestImageProvider<TPixel> provider)
7188
public void DiffusionFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
7289
where TPixel : struct, IPixel<TPixel>
7390
{
91+
if (SkipAllDitherTests)
92+
{
93+
return;
94+
}
95+
7496
// Increased tolerance because of compatibility issues on .NET 4.6.2:
7597
var comparer = ImageComparer.TolerantPercentage(1f);
7698
provider.RunValidatingProcessorTest(x => x.Diffuse(DefaultErrorDiffuser, 0.5f), comparer: comparer);
@@ -83,6 +105,11 @@ public void DiffusionFilter_WorksWithAllErrorDiffusers<TPixel>(
83105
IErrorDiffuser diffuser)
84106
where TPixel : struct, IPixel<TPixel>
85107
{
108+
if (SkipAllDitherTests)
109+
{
110+
return;
111+
}
112+
86113
provider.RunValidatingProcessorTest(
87114
x => x.Diffuse(diffuser, 0.5f),
88115
testOutputDetails: diffuser.GetType().Name,
@@ -95,6 +122,11 @@ public void DiffusionFilter_WorksWithAllErrorDiffusers<TPixel>(
95122
public void DitherFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
96123
where TPixel : struct, IPixel<TPixel>
97124
{
125+
if (SkipAllDitherTests)
126+
{
127+
return;
128+
}
129+
98130
provider.RunValidatingProcessorTest(
99131
x => x.Dither(DefaultDitherer),
100132
comparer: ValidatorComparer);
@@ -107,6 +139,11 @@ public void DitherFilter_WorksWithAllDitherers<TPixel>(
107139
IOrderedDither ditherer)
108140
where TPixel : struct, IPixel<TPixel>
109141
{
142+
if (SkipAllDitherTests)
143+
{
144+
return;
145+
}
146+
110147
provider.RunValidatingProcessorTest(
111148
x => x.Dither(ditherer),
112149
testOutputDetails: ditherer.GetType().Name,

tests/Images/External

Submodule External updated 26 files

0 commit comments

Comments
 (0)