File size: 1,717 Bytes
fd8a21a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from viq.cli import build_parser


def test_top_level_help_formats_percent_pattern() -> None:
    help_text = build_parser().format_help()
    assert "%06d.png" in help_text
    assert "extract" in help_text
    assert "render" in help_text
    assert "install-matanyone2" in help_text


def test_safe_default_only_renders_preview() -> None:
    args = build_parser().parse_args(["render", "clip.mp4", "--masks", "m", "--output", "o"])
    assert args.formats == ("preview",)


def test_projection_defaults_to_metadata_driven_auto() -> None:
    args = build_parser().parse_args(["extract", "clip.mp4", "--output", "o"])
    assert args.projection == "auto"
    assert args.cube_face_size is None
    assert args.matting == "auto"
    assert args.matting_max_size == -1
    assert args.subject_output == "combined"


def test_subject_output_modes() -> None:
    parser = build_parser()

    for mode in ("combined", "split", "both"):
        args = parser.parse_args(["extract", "clip.mp4", "--output", "o", "--subject-output", mode])
        assert args.subject_output == mode


def test_people_output_is_a_subject_output_alias() -> None:
    args = build_parser().parse_args(
        ["extract", "clip.mp4", "--output", "o", "--people-output", "split"]
    )

    assert args.subject_output == "split"


def test_equirectangular_projection_arguments() -> None:
    args = build_parser().parse_args(
        [
            "extract",
            "panorama.mp4",
            "--output",
            "o",
            "--projection",
            "equirectangular",
            "--cube-face-size",
            "1024",
        ]
    )
    assert args.projection == "equirectangular"
    assert args.cube_face_size == 1024