示例#1
0
def test_generate_video_dont_enlarge(tmpdir):
    """video dimensions should not be enlarged"""

    base, ext = os.path.splitext(TEST_VIDEO)
    dstfile = str(tmpdir.join(base + '.webm'))
    generate_video(SRCFILE, dstfile, (1000, 1000))

    size_src = vid_size(SRCFILE)
    size_dst = vid_size(dstfile)

    assert size_src == size_dst
示例#2
0
def test_generate_video_dont_enlarge(tmpdir):
    """video dimensions should not be enlarged"""

    base, ext = os.path.splitext(TEST_VIDEO)
    dstfile = str(tmpdir.join(base + '.webm'))
    generate_video(SRCFILE, dstfile, (1000, 1000))

    size_src = vid_size(SRCFILE)
    size_dst = vid_size(dstfile)

    assert size_src == size_dst
示例#3
0
def test_generate_video_fit_width(tmpdir):
    """largest fitting dimension is width"""

    base, ext = os.path.splitext(TEST_VIDEO)
    dstfile = str(tmpdir.join(base + '.webm'))
    generate_video(SRCFILE, dstfile, (100, 50))

    size_src = vid_size(SRCFILE)
    size_dst = vid_size(dstfile)

    assert size_dst[1] == 50
    # less than 2% error on ratio
    assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2
示例#4
0
def test_generate_video_fit_width(tmpdir):
    """largest fitting dimension is width"""

    base, ext = os.path.splitext(TEST_VIDEO)
    dstfile = str(tmpdir.join(base + '.webm'))
    generate_video(SRCFILE, dstfile, (100, 50))

    size_src = vid_size(SRCFILE)
    size_dst = vid_size(dstfile)

    assert size_dst[1] == 50
    # less than 2% error on ratio
    assert abs(size_dst[0] / size_dst[1] - size_src[0] / size_src[1]) < 2e-2