feat: global crossfade curve combo + per-join render/guard plumbing
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -532,18 +532,48 @@ def test_merge_save_builds_command(win, tmp_path, monkeypatch):
|
||||
win._spn_crossfade.setValue(0.75)
|
||||
seen = {}
|
||||
class _Stop(Exception): pass
|
||||
def fake(clips, xf, out):
|
||||
seen.update(clips=clips, xf=xf, out=out); raise _Stop
|
||||
def fake(clips, xf, out, curves=None):
|
||||
seen.update(clips=clips, xf=xf, out=out, curves=curves); raise _Stop
|
||||
monkeypatch.setattr(m, "build_crossfade_merge_command", fake)
|
||||
monkeypatch.setattr(m.QFileDialog, "getSaveFileName",
|
||||
staticmethod(lambda *a, **k: (str(tmp_path / "m.wav"), "")))
|
||||
with pytest.raises(_Stop):
|
||||
win._on_merge_save()
|
||||
assert seen["clips"] == [str(a), str(b)]
|
||||
assert seen["xf"] == 0.75
|
||||
assert seen["xf"] == [0.75] # 1 join for 2 clips
|
||||
assert seen["curves"] == ["tri"]
|
||||
assert seen["out"].endswith(".wav")
|
||||
|
||||
|
||||
def test_merge_curve_combo_present(win):
|
||||
from PyQt6.QtWidgets import QComboBox
|
||||
assert isinstance(win._cmb_curve, QComboBox)
|
||||
assert win._cmb_curve.currentData() == "tri" # default
|
||||
|
||||
|
||||
def test_merge_render_builds_per_join_lists(win, tmp_path, monkeypatch):
|
||||
import main as m, pytest
|
||||
from PyQt6.QtCore import Qt
|
||||
a = tmp_path / "a.wav"; b = tmp_path / "b.wav"; c = tmp_path / "c.wav"
|
||||
for f in (a, b, c): f.write_bytes(b"")
|
||||
win._merge_list.clear()
|
||||
win._merge_add_paths([str(a), str(b), str(c)])
|
||||
for i in range(3):
|
||||
win._merge_list.item(i).setData(Qt.ItemDataRole.UserRole + 1, 5.0) # long enough
|
||||
win._spn_crossfade.setValue(0.5)
|
||||
seen = {}
|
||||
class _Stop(Exception): pass
|
||||
def fake(clips, xf, out, curves=None):
|
||||
seen.update(clips=clips, xf=xf, out=out, curves=curves); raise _Stop
|
||||
monkeypatch.setattr(m, "build_crossfade_merge_command", fake)
|
||||
monkeypatch.setattr(m.QFileDialog, "getSaveFileName",
|
||||
staticmethod(lambda *a, **k: (str(tmp_path / "m.wav"), "")))
|
||||
with pytest.raises(_Stop):
|
||||
win._on_merge_save()
|
||||
assert seen["xf"] == [0.5, 0.5] # 2 joins for 3 clips, effective = global
|
||||
assert seen["curves"] == ["tri", "tri"]
|
||||
|
||||
|
||||
def test_merge_save_blocks_short_clip(win, tmp_path, monkeypatch):
|
||||
import main as m
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
Reference in New Issue
Block a user