File size: 1,107 Bytes
fe0873a 4b1abd9 fe0873a 4b1abd9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | from PIL import Image
from app import estimate_gpu_duration, prepare_frame, seconds_to_frames
def test_prepare_frame_uses_multiple_of_sixteen():
image = Image.new("RGB", (701, 509), "red")
result, size = prepare_frame(image, 480 * 832)
assert result.size == size
assert size[0] % 16 == 0
assert size[1] % 16 == 0
def test_end_frame_matches_start_geometry():
start = Image.new("RGB", (900, 500), "red")
end = Image.new("RGB", (500, 900), "blue")
_, target_size = prepare_frame(start, 480 * 832)
prepared_end, _ = prepare_frame(end, 480 * 832, target_size)
assert prepared_end.size == target_size
def test_duration_seconds_map_to_wan_frame_counts():
assert seconds_to_frames(1) == 17
assert seconds_to_frames(2) == 33
assert seconds_to_frames(3) == 49
def test_gpu_reservation_scales_with_duration():
one_second = estimate_gpu_duration(None, None, "", "", "480p (faster)", 1, 8, 1.0, -1)
three_seconds = estimate_gpu_duration(None, None, "", "", "480p (faster)", 3, 8, 1.0, -1)
assert one_second == 15
assert three_seconds == 29
|