Pillow/Tests/test_image_thumbnail.py

38 lines
982 B
Python
Raw Normal View History

from .helper import PillowTestCase, hopper
2014-06-10 13:10:47 +04:00
class TestImageThumbnail(PillowTestCase):
2014-06-10 13:10:47 +04:00
def test_sanity(self):
im = hopper()
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 100))
2014-06-10 13:10:47 +04:00
self.assert_image(im, im.mode, (100, 100))
2014-06-10 13:10:47 +04:00
def test_aspect(self):
im = hopper()
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 100))
self.assert_image(im, im.mode, (100, 100))
im = hopper().resize((128, 256))
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 100))
self.assert_image(im, im.mode, (50, 100))
im = hopper().resize((128, 256))
2014-06-10 13:10:47 +04:00
im.thumbnail((50, 100))
self.assert_image(im, im.mode, (50, 100))
im = hopper().resize((256, 128))
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 100))
self.assert_image(im, im.mode, (100, 50))
im = hopper().resize((256, 128))
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 50))
self.assert_image(im, im.mode, (100, 50))
im = hopper().resize((128, 128))
2014-06-10 13:10:47 +04:00
im.thumbnail((100, 100))
self.assert_image(im, im.mode, (100, 100))