This commit is contained in:
homm 2014-10-15 12:40:26 +04:00
parent 53c8352f39
commit 0ff4b53a72

View File

@ -5,12 +5,12 @@ from PIL import Image, ImageOps
sample = Image.new("L", (7, 5)) sample = Image.new("L", (7, 5))
sample.putdata(sum([ sample.putdata(sum([
[210, 50, 20, 10, 220, 230, 80 ], [210, 50, 20, 10, 220, 230, 80],
[190, 210, 20, 180, 170, 40, 110], [190, 210, 20, 180, 170, 40, 110],
[120, 210, 250, 60, 220, 0, 220], [120, 210, 250, 60, 220, 0, 220],
[220, 40, 230, 80, 130, 250, 40 ], [220, 40, 230, 80, 130, 250, 40],
[250, 0, 80, 30, 60, 20, 110], [250, 0, 80, 30, 60, 20, 110],
], [])) ], []))
class TestBoxBlurApi(PillowTestCase): class TestBoxBlurApi(PillowTestCase):
@ -54,10 +54,10 @@ class TestBoxBlur(PillowTestCase):
self.assertImage( self.assertImage(
self.box_blur(sample, 0), self.box_blur(sample, 0),
[ [
[210, 50, 20, 10, 220, 230, 80 ], [210, 50, 20, 10, 220, 230, 80],
[190, 210, 20, 180, 170, 40, 110], [190, 210, 20, 180, 170, 40, 110],
[120, 210, 250, 60, 220, 0, 220], [120, 210, 250, 60, 220, 0, 220],
[220, 40, 230, 80, 130, 250, 40 ], [220, 40, 230, 80, 130, 250, 40],
[250, 0, 80, 30, 60, 20, 110], [250, 0, 80, 30, 60, 20, 110],
] ]
) )
@ -66,10 +66,10 @@ class TestBoxBlur(PillowTestCase):
self.assertImage( self.assertImage(
self.box_blur(sample, 0.02), self.box_blur(sample, 0.02),
[ [
[206, 55, 20, 17, 215, 223, 83 ], [206, 55, 20, 17, 215, 223, 83],
[189, 203, 31, 171, 169, 46, 110], [189, 203, 31, 171, 169, 46, 110],
[125, 206, 241, 69, 210, 13, 210], [125, 206, 241, 69, 210, 13, 210],
[215, 49, 221, 82, 131, 235, 48 ], [215, 49, 221, 82, 131, 235, 48],
[244, 7, 80, 32, 60, 27, 107], [244, 7, 80, 32, 60, 27, 107],
], ],
delta=2, delta=2,
@ -79,10 +79,10 @@ class TestBoxBlur(PillowTestCase):
self.assertImage( self.assertImage(
self.box_blur(sample, 0.05), self.box_blur(sample, 0.05),
[ [
[202, 62, 22, 27, 209, 215, 88 ], [202, 62, 22, 27, 209, 215, 88],
[188, 194, 44, 161, 168, 56, 111], [188, 194, 44, 161, 168, 56, 111],
[131, 201, 229, 81, 198, 31, 198], [131, 201, 229, 81, 198, 31, 198],
[209, 62, 209, 86, 133, 216, 59 ], [209, 62, 209, 86, 133, 216, 59],
[237, 17, 80, 36, 60, 35, 103], [237, 17, 80, 36, 60, 35, 103],
], ],
delta=2, delta=2,
@ -92,11 +92,11 @@ class TestBoxBlur(PillowTestCase):
self.assertImage( self.assertImage(
self.box_blur(sample, 0.1), self.box_blur(sample, 0.1),
[ [
[196, 72, 24, 40, 200, 203, 93 ], [196, 72, 24, 40, 200, 203, 93],
[187, 183, 62, 148, 166, 68, 111], [187, 183, 62, 148, 166, 68, 111],
[139, 193, 213, 96, 182, 54, 182], [139, 193, 213, 96, 182, 54, 182],
[201, 78, 193, 91, 133, 191, 73 ], [201, 78, 193, 91, 133, 191, 73],
[227, 31, 80, 42, 61, 47, 99 ], [227, 31, 80, 42, 61, 47, 99],
], ],
delta=1, delta=1,
) )
@ -109,7 +109,7 @@ class TestBoxBlur(PillowTestCase):
[176, 149, 108, 122, 144, 120, 117], [176, 149, 108, 122, 144, 120, 117],
[164, 171, 159, 141, 134, 119, 129], [164, 171, 159, 141, 134, 119, 129],
[170, 136, 133, 114, 116, 124, 109], [170, 136, 133, 114, 116, 124, 109],
[184, 95, 72, 70, 69, 81, 89 ], [184, 95, 72, 70, 69, 81, 89],
], ],
delta=1, delta=1,
) )
@ -122,7 +122,7 @@ class TestBoxBlur(PillowTestCase):
[168, 142, 112, 128, 126, 143, 121], [168, 142, 112, 128, 126, 143, 121],
[169, 166, 142, 149, 126, 131, 114], [169, 166, 142, 149, 126, 131, 114],
[159, 156, 109, 127, 94, 117, 112], [159, 156, 109, 127, 94, 117, 112],
[164, 128, 63, 87, 76, 89, 90 ], [164, 128, 63, 87, 76, 89, 90],
], ],
delta=1, delta=1,
) )
@ -135,7 +135,7 @@ class TestBoxBlur(PillowTestCase):
[160, 136, 124, 125, 127, 134, 130], [160, 136, 124, 125, 127, 134, 130],
[166, 147, 130, 125, 120, 121, 119], [166, 147, 130, 125, 120, 121, 119],
[168, 145, 119, 109, 103, 105, 110], [168, 145, 119, 109, 103, 105, 110],
[168, 134, 96, 85, 85, 89, 97 ], [168, 134, 96, 85, 85, 89, 97],
], ],
delta=1, delta=1,
) )
@ -148,7 +148,7 @@ class TestBoxBlur(PillowTestCase):
[148, 145, 137, 122, 109, 111, 112], [148, 145, 137, 122, 109, 111, 112],
[152, 145, 131, 117, 103, 107, 108], [152, 145, 131, 117, 103, 107, 108],
[156, 144, 126, 111, 97, 102, 103], [156, 144, 126, 111, 97, 102, 103],
[160, 144, 121, 106, 92, 98, 99 ], [160, 144, 121, 106, 92, 98, 99],
], ],
delta=1, delta=1,
) )