@@ -12,74 +12,66 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Quantization;
12
12
[ Trait ( "Category" , "Processors" ) ]
13
13
public class QuantizerTests
14
14
{
15
- /// <summary>
16
- /// Something is causing tests to fail on NETFX in CI.
17
- /// Could be a JIT error as everything runs well and is identical to .NET Core output.
18
- /// Not worth investigating for now.
19
- /// <see href="https://github.com/SixLabors/ImageSharp/pull/1114/checks?check_run_id=448891164#step:11:631"/>
20
- /// </summary>
21
- private static readonly bool SkipAllQuantizerTests = TestEnvironment . IsFramework ;
22
-
23
15
public static readonly string [ ] CommonTestImages =
24
16
{
25
17
TestImages . Png . CalliphoraPartial ,
26
18
TestImages . Png . Bike
27
19
} ;
28
20
29
- private static readonly QuantizerOptions NoDitherOptions = new QuantizerOptions { Dither = null } ;
30
- private static readonly QuantizerOptions DiffuserDitherOptions = new QuantizerOptions { Dither = KnownDitherings . FloydSteinberg } ;
31
- private static readonly QuantizerOptions OrderedDitherOptions = new QuantizerOptions { Dither = KnownDitherings . Bayer8x8 } ;
21
+ private static readonly QuantizerOptions NoDitherOptions = new ( ) { Dither = null } ;
22
+ private static readonly QuantizerOptions DiffuserDitherOptions = new ( ) { Dither = KnownDitherings . FloydSteinberg } ;
23
+ private static readonly QuantizerOptions OrderedDitherOptions = new ( ) { Dither = KnownDitherings . Bayer8x8 } ;
32
24
33
- private static readonly QuantizerOptions Diffuser0_ScaleDitherOptions = new QuantizerOptions
25
+ private static readonly QuantizerOptions Diffuser0_ScaleDitherOptions = new ( )
34
26
{
35
27
Dither = KnownDitherings . FloydSteinberg ,
36
28
DitherScale = 0F
37
29
} ;
38
30
39
- private static readonly QuantizerOptions Diffuser0_25_ScaleDitherOptions = new QuantizerOptions
31
+ private static readonly QuantizerOptions Diffuser0_25_ScaleDitherOptions = new ( )
40
32
{
41
33
Dither = KnownDitherings . FloydSteinberg ,
42
34
DitherScale = .25F
43
35
} ;
44
36
45
- private static readonly QuantizerOptions Diffuser0_5_ScaleDitherOptions = new QuantizerOptions
37
+ private static readonly QuantizerOptions Diffuser0_5_ScaleDitherOptions = new ( )
46
38
{
47
39
Dither = KnownDitherings . FloydSteinberg ,
48
40
DitherScale = .5F
49
41
} ;
50
42
51
- private static readonly QuantizerOptions Diffuser0_75_ScaleDitherOptions = new QuantizerOptions
43
+ private static readonly QuantizerOptions Diffuser0_75_ScaleDitherOptions = new ( )
52
44
{
53
45
Dither = KnownDitherings . FloydSteinberg ,
54
46
DitherScale = .75F
55
47
} ;
56
48
57
- private static readonly QuantizerOptions Ordered0_ScaleDitherOptions = new QuantizerOptions
49
+ private static readonly QuantizerOptions Ordered0_ScaleDitherOptions = new ( )
58
50
{
59
51
Dither = KnownDitherings . Bayer8x8 ,
60
52
DitherScale = 0F
61
53
} ;
62
54
63
- private static readonly QuantizerOptions Ordered0_25_ScaleDitherOptions = new QuantizerOptions
55
+ private static readonly QuantizerOptions Ordered0_25_ScaleDitherOptions = new ( )
64
56
{
65
57
Dither = KnownDitherings . Bayer8x8 ,
66
58
DitherScale = .25F
67
59
} ;
68
60
69
- private static readonly QuantizerOptions Ordered0_5_ScaleDitherOptions = new QuantizerOptions
61
+ private static readonly QuantizerOptions Ordered0_5_ScaleDitherOptions = new ( )
70
62
{
71
63
Dither = KnownDitherings . Bayer8x8 ,
72
64
DitherScale = .5F
73
65
} ;
74
66
75
- private static readonly QuantizerOptions Ordered0_75_ScaleDitherOptions = new QuantizerOptions
67
+ private static readonly QuantizerOptions Ordered0_75_ScaleDitherOptions = new ( )
76
68
{
77
69
Dither = KnownDitherings . Bayer8x8 ,
78
70
DitherScale = .75F
79
71
} ;
80
72
81
73
public static readonly TheoryData < IQuantizer > Quantizers
82
- = new TheoryData < IQuantizer >
74
+ = new ( )
83
75
{
84
76
// Known uses error diffusion by default.
85
77
KnownQuantizers . Octree ,
@@ -97,7 +89,7 @@ public static readonly TheoryData<IQuantizer> Quantizers
97
89
} ;
98
90
99
91
public static readonly TheoryData < IQuantizer > DitherScaleQuantizers
100
- = new TheoryData < IQuantizer >
92
+ = new ( )
101
93
{
102
94
new OctreeQuantizer ( Diffuser0_ScaleDitherOptions ) ,
103
95
new WebSafePaletteQuantizer ( Diffuser0_ScaleDitherOptions ) ,
@@ -151,7 +143,7 @@ public static readonly TheoryData<IQuantizer> DitherScaleQuantizers
151
143
} ;
152
144
153
145
public static readonly TheoryData < IDither > DefaultInstanceDitherers
154
- = new TheoryData < IDither >
146
+ = new ( )
155
147
{
156
148
default ( ErrorDither ) ,
157
149
default ( OrderedDither )
@@ -164,11 +156,6 @@ public static readonly TheoryData<IDither> DefaultInstanceDitherers
164
156
public void ApplyQuantizationInBox < TPixel > ( TestImageProvider < TPixel > provider , IQuantizer quantizer )
165
157
where TPixel : unmanaged, IPixel < TPixel >
166
158
{
167
- if ( SkipAllQuantizerTests )
168
- {
169
- return ;
170
- }
171
-
172
159
string quantizerName = quantizer . GetType ( ) . Name ;
173
160
string ditherName = quantizer . Options . Dither ? . GetType ( ) ? . Name ?? "NoDither" ;
174
161
string testOutputDetails = $ "{ quantizerName } _{ ditherName } ";
@@ -185,11 +172,6 @@ public void ApplyQuantizationInBox<TPixel>(TestImageProvider<TPixel> provider, I
185
172
public void ApplyQuantization < TPixel > ( TestImageProvider < TPixel > provider , IQuantizer quantizer )
186
173
where TPixel : unmanaged, IPixel < TPixel >
187
174
{
188
- if ( SkipAllQuantizerTests )
189
- {
190
- return ;
191
- }
192
-
193
175
string quantizerName = quantizer . GetType ( ) . Name ;
194
176
string ditherName = quantizer . Options . Dither ? . GetType ( ) ? . Name ?? "NoDither" ;
195
177
string testOutputDetails = $ "{ quantizerName } _{ ditherName } ";
@@ -206,11 +188,6 @@ public void ApplyQuantization<TPixel>(TestImageProvider<TPixel> provider, IQuant
206
188
public void ApplyQuantizationWithDitheringScale < TPixel > ( TestImageProvider < TPixel > provider , IQuantizer quantizer )
207
189
where TPixel : unmanaged, IPixel < TPixel >
208
190
{
209
- if ( SkipAllQuantizerTests )
210
- {
211
- return ;
212
- }
213
-
214
191
string quantizerName = quantizer . GetType ( ) . Name ;
215
192
string ditherName = quantizer . Options . Dither . GetType ( ) . Name ;
216
193
float ditherScale = quantizer . Options . DitherScale ;
@@ -229,8 +206,8 @@ public void ShouldThrowForDefaultDitherInstance(IDither dither)
229
206
{
230
207
void Command ( )
231
208
{
232
- using var image = new Image < Rgba32 > ( 10 , 10 ) ;
233
- var quantizer = new WebSafePaletteQuantizer ( ) ;
209
+ using Image < Rgba32 > image = new ( 10 , 10 ) ;
210
+ WebSafePaletteQuantizer quantizer = new ( ) ;
234
211
quantizer . Options . Dither = dither ;
235
212
image . Mutate ( x => x . Quantize ( quantizer ) ) ;
236
213
}
0 commit comments