@@ -183,22 +183,30 @@ func TestImageFromBytesMonochrome(t *testing.T) {
183
183
// contain the same data afterwards.
184
184
func TestImageNoise (t * testing.T ) {
185
185
t .Run ("RGB888" , func (t * testing.T ) {
186
- testImageNoise [pixel.RGB888 ](t )
186
+ testImageNoiseN [pixel.RGB888 ](t )
187
187
})
188
188
t .Run ("RGB565BE" , func (t * testing.T ) {
189
- testImageNoise [pixel.RGB565BE ](t )
189
+ testImageNoiseN [pixel.RGB565BE ](t )
190
190
})
191
191
t .Run ("RGB555" , func (t * testing.T ) {
192
- testImageNoise [pixel.RGB555 ](t )
192
+ testImageNoiseN [pixel.RGB555 ](t )
193
193
})
194
194
t .Run ("RGB444BE" , func (t * testing.T ) {
195
- testImageNoise [pixel.RGB444BE ](t )
195
+ testImageNoiseN [pixel.RGB444BE ](t )
196
196
})
197
197
t .Run ("Monochrome" , func (t * testing.T ) {
198
- testImageNoise [pixel.Monochrome ](t )
198
+ testImageNoiseN [pixel.Monochrome ](t )
199
199
})
200
200
}
201
201
202
+ // Run the testImageNoise multiple times, because a single test might not catch
203
+ // all bugs (since the test uses random data).
204
+ func testImageNoiseN [T pixel.Color ](t * testing.T ) {
205
+ for i := 0 ; i < 10 ; i ++ {
206
+ testImageNoise [T ](t )
207
+ }
208
+ }
209
+
202
210
func testImageNoise [T pixel.Color ](t * testing.T ) {
203
211
// Create an image of a random width/height for extra testing.
204
212
width := rand .Int ()% 500 + 10
0 commit comments