mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
ad784eb808
This is Christoph Gohlke's test suite from his personal PIL package found at http://www.lfd.uci.edu/~gohlke/pythonlibs/. This is just to bring it in as a separate commit. Future commits will align it with Pillow.
37 lines
867 B
Python
37 lines
867 B
Python
from tester import *
|
|
|
|
from PIL import Image
|
|
|
|
def test_sanity():
|
|
|
|
bbox = lena().getbbox()
|
|
assert_true(isinstance(bbox, tuple))
|
|
|
|
def test_bbox():
|
|
|
|
# 8-bit mode
|
|
im = Image.new("L", (100, 100), 0)
|
|
assert_equal(im.getbbox(), None)
|
|
|
|
im.paste(255, (10, 25, 90, 75))
|
|
assert_equal(im.getbbox(), (10, 25, 90, 75))
|
|
|
|
im.paste(255, (25, 10, 75, 90))
|
|
assert_equal(im.getbbox(), (10, 10, 90, 90))
|
|
|
|
im.paste(255, (-10, -10, 110, 110))
|
|
assert_equal(im.getbbox(), (0, 0, 100, 100))
|
|
|
|
# 32-bit mode
|
|
im = Image.new("RGB", (100, 100), 0)
|
|
assert_equal(im.getbbox(), None)
|
|
|
|
im.paste(255, (10, 25, 90, 75))
|
|
assert_equal(im.getbbox(), (10, 25, 90, 75))
|
|
|
|
im.paste(255, (25, 10, 75, 90))
|
|
assert_equal(im.getbbox(), (10, 10, 90, 90))
|
|
|
|
im.paste(255, (-10, -10, 110, 110))
|
|
assert_equal(im.getbbox(), (0, 0, 100, 100))
|