예제 #1
0
def test_rotate(angle_offset):
    # Run several times to ensure that adding 360 to rotation angles has no effect
    clip = BitmapClip([["AAAA", "BBBB", "CCCC"], ["ABCD", "BCDE", "CDEA"]], fps=1)

    clip1 = rotate(clip, 0 + angle_offset)
    target1 = BitmapClip([["AAAA", "BBBB", "CCCC"], ["ABCD", "BCDE", "CDEA"]], fps=1)
    assert clip1 == target1

    clip2 = rotate(clip, 90 + angle_offset)
    target2 = BitmapClip(
        [["ABC", "ABC", "ABC", "ABC"], ["DEA", "CDE", "BCD", "ABC"]], fps=1
    )
    assert clip2 == target2, clip2.to_bitmap()

    clip3 = rotate(clip, 180 + angle_offset)
    target3 = BitmapClip([["CCCC", "BBBB", "AAAA"], ["AEDC", "EDCB", "DCBA"]], fps=1)
    assert clip3 == target3

    clip4 = rotate(clip, 270 + angle_offset)
    target4 = BitmapClip(
        [["CBA", "CBA", "CBA", "CBA"], ["CBA", "DCB", "EDC", "AED"]], fps=1
    )
    assert clip4 == target4
예제 #2
0
def test_rotate_nonstandard_angles(util):
    # Test rotate with color clip
    clip = ColorClip([600, 400], [150, 250, 100]).with_duration(1).with_fps(5)
    clip = rotate(clip, 20)
    clip.write_videofile(os.path.join(util.TMP_DIR, "color_rotate.webm"))