mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
commit
4566a4dcbe
|
@ -168,8 +168,6 @@ class TestImage(PillowTestCase):
|
||||||
ValueError,
|
ValueError,
|
||||||
lambda: Image.effect_mandelbrot(size, extent, quality))
|
lambda: Image.effect_mandelbrot(size, extent, quality))
|
||||||
|
|
||||||
@unittest.skipUnless(sys.platform.startswith('win32'),
|
|
||||||
"Stalls on Travis CI, passes on Windows")
|
|
||||||
def test_effect_noise(self):
|
def test_effect_noise(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
size = (100, 100)
|
size = (100, 100)
|
||||||
|
@ -180,8 +178,8 @@ class TestImage(PillowTestCase):
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
self.assertEqual(im.size, (100, 100))
|
self.assertEqual(im.size, (100, 100))
|
||||||
self.assertEqual(im.getpixel((0, 0)), 60)
|
self.assertEqual(im.mode, "L")
|
||||||
self.assertEqual(im.getpixel((0, 1)), 28)
|
self.assertNotEqual(im.getpixel((0, 0)), im.getpixel((0, 1)))
|
||||||
|
|
||||||
def test_effect_spread(self):
|
def test_effect_spread(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -98,8 +98,8 @@ ImagingEffectNoise(int xsize, int ysize, float sigma)
|
||||||
/* after numerical recipes */
|
/* after numerical recipes */
|
||||||
double v1, v2, radius, factor;
|
double v1, v2, radius, factor;
|
||||||
do {
|
do {
|
||||||
v1 = rand()*(2.0/32767.0) - 1.0;
|
v1 = rand()*(2.0/RAND_MAX) - 1.0;
|
||||||
v2 = rand()*(2.0/32767.0) - 1.0;
|
v2 = rand()*(2.0/RAND_MAX) - 1.0;
|
||||||
radius= v1*v1 + v2*v2;
|
radius= v1*v1 + v2*v2;
|
||||||
} while (radius >= 1.0);
|
} while (radius >= 1.0);
|
||||||
factor = sqrt(-2.0*log(radius)/radius);
|
factor = sqrt(-2.0*log(radius)/radius);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user