Extracts a new PlayerPanel widget (video + its own seek slider/marker strip + its own centered frame-step/play/mute transport row) into player_panel.py. Both Source and Preview tabs now use one, so switching tabs switches a complete, independent monitor -- its own scrubber, its own play state, its own frame-stepping -- not just the video frame with a single shared play button underneath. main.py's global keyboard shortcuts (,/./space/left/right) now dispatch to whichever panel is active via a small _active_panel() helper, so they follow the same 'whichever monitor you're looking at' rule as the on-screen controls. MarkerStrip (clap detection) and the Mark Audio/Video/offset/export row stay outside the tabs, at the MainWindow level -- marking and exporting are inherently about the source file, not the preview clip, so only the timeline+transport moved, not the whole marking workflow. Updated every existing smoke test for the new win.source_panel.* / win.preview_panel.* structure (previously flat win.player, win.seek_slider, etc.), and added a new check to smoke_test_preview.py confirming the Preview tab's slider is a genuinely separate, functional widget -- dragging it seeks the preview player without moving the source player, which is the actual thing this change was for. Verified the full suite on the virtual Xvfb display, plus a live click-through (mark both events, build preview, confirm the Preview tab shows its own populated timeline/transport, not the source's).
69 lines
2.5 KiB
Python
69 lines
2.5 KiB
Python
"""Verifies right-click-on-player toggles play/pause, and that Load File
|
|
moved from a button into a File menu action.
|
|
|
|
mpv owns its own native child window for the embedded video surface, so a
|
|
real mouse click there never reaches Qt's mousePressEvent at all -- the
|
|
right-click binding is registered through mpv's own input system instead
|
|
(see player_widget.py). To exercise that actual code path headlessly, this
|
|
drives mpv's own `keypress` command (which simulates input the same way a
|
|
real click would, through mpv's own dispatch) rather than posting a
|
|
QMouseEvent, since a QMouseEvent would only prove Qt-level dead code works,
|
|
not the real behavior -- that mistake produced a false pass earlier in this
|
|
session, worth not repeating.
|
|
"""
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
import main as app_main
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
CLIP = str(ROOT / "test_media" / "sync_test_INSYNC.mp4")
|
|
|
|
|
|
def main():
|
|
qapp = QApplication(sys.argv)
|
|
win = app_main.MainWindow()
|
|
win.show()
|
|
qapp.processEvents()
|
|
|
|
win._load(CLIP)
|
|
qapp.processEvents()
|
|
time.sleep(0.2)
|
|
qapp.processEvents()
|
|
|
|
# -- File menu has Load File, no more load_button in the layout
|
|
menu_titles = [a.text() for a in win.menuBar().actions()]
|
|
assert "&File" in menu_titles, f"expected a File menu, got {menu_titles}"
|
|
assert not hasattr(win, "load_button"), "old Load File button should be gone"
|
|
print("PASS: Load File lives in the File menu")
|
|
|
|
# -- Right-click on the player toggles play/pause
|
|
assert win.source_panel.player.mpv.pause is True, "should start paused"
|
|
win.source_panel.player.mpv.command("keypress", "MBTN_RIGHT")
|
|
qapp.processEvents()
|
|
time.sleep(0.2)
|
|
qapp.processEvents()
|
|
assert win.source_panel.player.mpv.pause is False, "right-click should have started playback"
|
|
assert win.source_panel.play_button.text() == "Pause"
|
|
print("PASS: right-click on player started playback")
|
|
|
|
win.source_panel.player.mpv.command("keypress", "MBTN_RIGHT")
|
|
qapp.processEvents()
|
|
time.sleep(0.2)
|
|
qapp.processEvents()
|
|
assert win.source_panel.player.mpv.pause is True, "second right-click should pause again"
|
|
assert win.source_panel.play_button.text() == "Play"
|
|
print("PASS: right-click on player paused again")
|
|
|
|
win.source_panel.shutdown()
|
|
win.preview_panel.shutdown()
|
|
print("\nRIGHT-CLICK / FILE MENU SMOKE TEST PASSED")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|