feat: Audio tab drives timeline audio-mode; drag the band to set the extract region

This commit is contained in:
2026-07-03 02:23:30 +02:00
parent a993de615c
commit 7f414d80b8
2 changed files with 34 additions and 0 deletions
+21
View File
@@ -284,6 +284,9 @@ def test_timeline_audio_mode_flag(win):
def test_timeline_audio_band_drag_move(win):
tl = win._timeline
# The band is now wired to the window; fake a loaded file so the window's
# _update_audio_region keeps the region instead of clearing it on release.
win._file_path = "/x/v.mp4"
tl._duration = 20.0
tl._view_start = 0.0; tl._view_span = 20.0 # full view
tl.resize(400, tl.height() or 80)
@@ -304,6 +307,8 @@ def test_timeline_audio_band_drag_move(win):
def test_timeline_audio_band_resize_right(win):
tl = win._timeline
# Fake a loaded file so the window keeps the region on release (see above).
win._file_path = "/x/v.mp4"
tl._duration = 20.0; tl._view_start = 0.0; tl._view_span = 20.0
tl.resize(400, tl.height() or 80)
tl.set_audio_mode(True)
@@ -316,6 +321,22 @@ def test_timeline_audio_band_resize_right(win):
tl.set_audio_mode(False)
def test_timeline_audio_mode_follows_deck(win):
win._control_deck.setCurrentWidget(win._tab_audio)
assert win._timeline._audio_mode is True
win._control_deck.setCurrentWidget(win._tab_export)
assert win._timeline._audio_mode is False
def test_timeline_audio_region_edit_syncs_cursor_length(win):
win._file_path = "/x/v.mp4"
win._cursor = 2.0
win._spn_audio_len.setValue(3.0)
win._timeline.audio_region_changed.emit(5.0, 9.0) # user dragged the band to [5,9]
assert win._cursor == 5.0
assert abs(win._spn_audio_len.value() - 4.0) < 1e-6
def test_audio_deck_tab_exists(win):
# The old "Scan" deck tab is now "Audio".
assert hasattr(win, "_tab_audio")