feat: timeline audio-mode — hide clip span, draggable/resizable audio band
This commit is contained in:
@@ -274,6 +274,48 @@ def test_audio_region_tracks_cursor_and_length(win):
|
||||
assert win._timeline._audio_region is None
|
||||
|
||||
|
||||
def test_timeline_audio_mode_flag(win):
|
||||
tl = win._timeline
|
||||
tl.set_audio_mode(True)
|
||||
assert tl._audio_mode is True
|
||||
tl.set_audio_mode(False)
|
||||
assert tl._audio_mode is False
|
||||
|
||||
|
||||
def test_timeline_audio_band_drag_move(win):
|
||||
tl = win._timeline
|
||||
tl._duration = 20.0
|
||||
tl._view_start = 0.0; tl._view_span = 20.0 # full view
|
||||
tl.resize(400, tl.height() or 80)
|
||||
tl.set_audio_mode(True)
|
||||
tl.set_audio_region(4.0, 8.0) # [4,8]
|
||||
got = []
|
||||
tl.audio_region_changed.connect(lambda s, e: got.append((s, e)))
|
||||
# grab the middle of the band and drag it +2s
|
||||
mid_t = 6.0
|
||||
tl._audio_begin_drag_at_x(tl._time_to_x(mid_t))
|
||||
tl._audio_drag_to_x(tl._time_to_x(mid_t + 2.0))
|
||||
tl._audio_end_drag()
|
||||
assert got, "audio_region_changed should fire on release"
|
||||
s, e = tl._audio_region
|
||||
assert abs((e - s) - 4.0) < 0.1 and s > 4.0 # same width, moved right
|
||||
tl.set_audio_mode(False)
|
||||
|
||||
|
||||
def test_timeline_audio_band_resize_right(win):
|
||||
tl = win._timeline
|
||||
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)
|
||||
tl.set_audio_region(4.0, 8.0)
|
||||
tl._audio_begin_drag_at_x(tl._time_to_x(8.0)) # grab right edge
|
||||
tl._audio_drag_to_x(tl._time_to_x(10.0)) # drag to 10
|
||||
tl._audio_end_drag()
|
||||
s, e = tl._audio_region
|
||||
assert abs(s - 4.0) < 0.1 and abs(e - 10.0) < 0.2
|
||||
tl.set_audio_mode(False)
|
||||
|
||||
|
||||
def test_audio_deck_tab_exists(win):
|
||||
# The old "Scan" deck tab is now "Audio".
|
||||
assert hasattr(win, "_tab_audio")
|
||||
|
||||
Reference in New Issue
Block a user