поправлены способ передачи таймеров в vMix

This commit is contained in:
2026-08-20 15:33:03 +03:00
parent 8790a1e113
commit cd9476d167
6 changed files with 420 additions and 117 deletions

View File

@@ -104,9 +104,10 @@ def test_shortcut_editor_layout_fixes_add_step_buttons_and_fullscreen_modal() ->
assert "height: calc(100vh - 20px);" in css
def test_hockey_timer_shortcut_supports_space_toggle_pause_and_text_mirror() -> None:
def test_hockey_timer_shortcut_supports_native_countdown_and_legacy_text_mirror() -> None:
app_js = Path("ui_builder/static/app.js").read_text(encoding="utf-8")
assert 'Function: "SuspendCountdown"' in app_js
assert 'Function: "PauseCountdown"' in app_js
assert 'Function: "StopCountdown"' in app_js
assert 'hockey_timer_command' in app_js
assert 'game_vmix_mode' in app_js
assert 'game_vmix_selected_name' in app_js
@@ -196,3 +197,61 @@ def test_overlay_group_repeat_uses_transition_out_not_all_off():
assert 'Function: "OverlayInputAllOff"' not in js
for layer in range(1, 5):
assert f'Function: "OverlayInput{layer}Out"' in js
def test_build90_migrates_old_text_timer_transport_to_native_countdown(tmp_path: Path) -> None:
manager = UIBuilderManager(tmp_path, filename="ui.json")
saved = manager.save({
"version": 21,
"project_name": "Hockey",
"data_source": "hockey",
"canvas": {"width": 1440, "height": 900},
"tabs": [{"id": "main", "label": "Main"}],
"components": [],
"triggers": [],
"shortcut_sequences": [{
"id": "timers", "name": "Timers", "combo": "Space",
"steps": [{
"id": "sync", "type": "hockey_vmix_timers_start",
"game_vmix_mode": "text", "penalty_vmix_mode": "text",
}],
}],
})
step = saved["shortcut_sequences"][0]["steps"][0]
assert saved["version"] == 22
assert step["game_vmix_mode"] == "countdown"
assert step["penalty_vmix_mode"] == "countdown"
def test_build90_keeps_explicit_legacy_text_mode_after_v22(tmp_path: Path) -> None:
manager = UIBuilderManager(tmp_path, filename="ui.json")
saved = manager.save({
"version": 22,
"project_name": "Hockey",
"data_source": "hockey",
"canvas": {"width": 1440, "height": 900},
"tabs": [{"id": "main", "label": "Main"}],
"components": [], "triggers": [],
"shortcut_sequences": [{
"id": "timers", "name": "Timers", "combo": "Space",
"steps": [{
"id": "sync", "type": "hockey_vmix_timers_start",
"game_vmix_mode": "text", "penalty_vmix_mode": "text",
}],
}],
})
step = saved["shortcut_sequences"][0]["steps"][0]
assert step["game_vmix_mode"] == "text"
assert step["penalty_vmix_mode"] == "text"
def test_build90_native_countdown_avoids_per_second_transport() -> None:
app_js = Path("ui_builder/static/app.js").read_text(encoding="utf-8")
assert 'game_vmix_mode !== "countdown"' in app_js
assert 'const countdownMode = step.penalty_vmix_mode === "countdown"' in app_js
assert 'Function: "PauseCountdown"' in app_js
assert 'Function: "StopCountdown"' in app_js
assert 'signal: controller.signal' in app_js
assert 'vmixCommandQueue: Promise.resolve()' in app_js
# Per-second pushes are restricted to the legacy Text mirror map.
assert 'eventName === "timer_tick" && state.vmixTimerMirrors.has(component.action_id)' in app_js