2014-06-10 13:10:47 +04:00
|
|
|
from helper import unittest, PillowTestCase, tearDownModule, lena
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageThumbnail(PillowTestCase):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_sanity(self):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena()
|
|
|
|
im.thumbnail((100, 100))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
self.assert_image(im, im.mode, (100, 100))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_aspect(self):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena()
|
|
|
|
im.thumbnail((100, 100))
|
|
|
|
self.assert_image(im, im.mode, (100, 100))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena().resize((128, 256))
|
|
|
|
im.thumbnail((100, 100))
|
|
|
|
self.assert_image(im, im.mode, (50, 100))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena().resize((128, 256))
|
|
|
|
im.thumbnail((50, 100))
|
|
|
|
self.assert_image(im, im.mode, (50, 100))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena().resize((256, 128))
|
|
|
|
im.thumbnail((100, 100))
|
|
|
|
self.assert_image(im, im.mode, (100, 50))
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena().resize((256, 128))
|
|
|
|
im.thumbnail((100, 50))
|
|
|
|
self.assert_image(im, im.mode, (100, 50))
|
|
|
|
|
|
|
|
im = lena().resize((128, 128))
|
|
|
|
im.thumbnail((100, 100))
|
|
|
|
self.assert_image(im, im.mode, (100, 100))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
|
|
|
|
# End of file
|