Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
marked skipped until qtui not called when testing cli.
  • Loading branch information
azfoo committed Oct 17, 2024
1 parent a5138ac commit eb30249
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/ui/cli/test_load_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,44 +63,44 @@ def test_with_timelines_scale_no(cli, tilia_state, marker_tl, actions):
assert marker_tl[0].get_data("time") == 5


def test_with_timelines_scale_not_provided_answer_yes(
# following tests skipped until qtui is not called for testing cli:
@pytest.mark.skip
def test_with_timelines_scale_not_provided_answer_scale(
cli, tilia_state, marker_tl, actions
):
tilia_state.current_time = 50
tilia_state.current_time = tilia_state.duration / 2
actions.trigger(TiliaAction.MARKER_ADD)

from unittest.mock import patch

with patch("builtins.input", return_value="y"):
with patch("builtins.input", return_value="1"):
cli.parse_and_run(f"load-media {EXAMPLE_MEDIA_PATH}")

assert tilia_state.duration == EXAMPLE_MEDIA_DURATION
assert marker_tl[0].get_data("time") == 50 * EXAMPLE_MEDIA_SCALE_FACTOR
assert marker_tl[0].get_data("time") == EXAMPLE_MEDIA_DURATION / 2


def test_with_timelines_scale_not_provided_answer_yes_but_dont_confirm_crop(
@pytest.mark.skip
def test_with_timelines_scale_not_provided_answer_crop(
cli, tilia_state, marker_tl, actions
):
tilia_state.current_time = 50
tilia_state.current_time = 5
actions.trigger(TiliaAction.MARKER_ADD)

with patch("builtins.input", side_effect=["y", "n"]):
with patch("builtins.input", return_value="2"):
cli.parse_and_run(f"load-media {EXAMPLE_MEDIA_PATH}")

assert tilia_state.duration == EXAMPLE_MEDIA_DURATION
assert marker_tl[0].get_data("time") == 50 * EXAMPLE_MEDIA_SCALE_FACTOR
assert marker_tl[0].get_data("time") == 5


def test_with_timelines_scale_not_provied_answer_crop(
@pytest.mark.skip
def test_with_timelines_scale_not_provided_answer_invalid_then_crop(
cli, tilia_state, marker_tl, actions
):
for time in [5, 50]:
tilia_state.current_time = time
actions.trigger(TiliaAction.MARKER_ADD)
tilia_state.current_time = 5
actions.trigger(TiliaAction.MARKER_ADD)

with patch("builtins.input", side_effect=["n", "y"]):
with patch("builtins.input", side_effect=["3", "2"]):
cli.parse_and_run(f"load-media {EXAMPLE_MEDIA_PATH}")

assert tilia_state.duration == EXAMPLE_MEDIA_DURATION
assert len(marker_tl) == 1
assert marker_tl[0].get_data("time") == 5

0 comments on commit eb30249

Please sign in to comment.