示例#1
0
def test_generate_thumbnail(tmpdir, image, path, wide_size, high_size):
    "Test the generate_thumbnail function."

    dstfile = str(tmpdir.join(image))
    for size in [(200, 150), (150, 200)]:
        generate_thumbnail(path, dstfile, size)
        im = PILImage.open(dstfile)
        assert im.size == size

    for size, thumb_size in [((200, 150), wide_size), ((150, 200), high_size)]:
        generate_thumbnail(path, dstfile, size, fit=False)
        im = PILImage.open(dstfile)
        assert im.size == thumb_size
示例#2
0
文件: test_image.py 项目: kuyan/sigal
def test_generate_thumbnail(tmpdir):
    "Test the generate_thumbnail function."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    for size in [(200, 150), (150, 200)]:
        generate_thumbnail(SRCFILE, dstfile, size)
        im = Image.open(dstfile)
        assert im.size == size

    for size, thumb_size in [((200, 150), (185, 150)), ((150, 200), (150, 122))]:
        generate_thumbnail(SRCFILE, dstfile, size, fit=False)
        im = Image.open(dstfile)
        assert im.size == thumb_size
示例#3
0
文件: test_image.py 项目: saimn/sigal
def test_generate_thumbnail(tmpdir, image, path, wide_size, high_size):
    "Test the generate_thumbnail function."

    dstfile = str(tmpdir.join(image))
    for size in [(200, 150), (150, 200)]:
        generate_thumbnail(path, dstfile, size)
        im = Image.open(dstfile)
        assert im.size == size

    for size, thumb_size in [((200, 150), wide_size),
                             ((150, 200), high_size)]:
        generate_thumbnail(path, dstfile, size, fit=False)
        im = Image.open(dstfile)
        assert im.size == thumb_size
示例#4
0
def test_generate_thumbnail(tmpdir):
    "Test the generate_thumbnail function."

    dstfile = str(tmpdir.join(TEST_IMAGE))
    for size in [(200, 150), (150, 200)]:
        generate_thumbnail(SRCFILE, dstfile, size)
        im = Image.open(dstfile)
        assert im.size == size

    for size, thumb_size in [((200, 150), (185, 150)),
                             ((150, 200), (150, 122))]:
        generate_thumbnail(SRCFILE, dstfile, size, fit=False)
        im = Image.open(dstfile)
        assert im.size == thumb_size