тест 3

This commit is contained in:
2026-08-24 16:39:58 +03:00
parent f9df04bd00
commit 1e46f1cb9f
6 changed files with 57 additions and 18 deletions

View File

@@ -22,11 +22,11 @@ def test_timer_start_stop_protocol_is_minimal():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
assert 'if (action === "stop" || action === "pause")' in helper
stop_branch = helper.split('if (action === "stop" || action === "pause")', 1)[1].split('return [', 1)[1].split('];', 1)[0]
assert 'Function: "StopCountdown"' in stop_branch
assert 'Function: "SuspendCountdown"' in stop_branch
assert 'Function: "StopCountdown"' not in stop_branch
assert 'Function: "SetCountdown"' not in stop_branch
start_branch = helper.rsplit('return [', 1)[1]
assert start_branch.index('Function: "SetCountdown"') < start_branch.index('Function: "StartCountdown"')
assert 'SuspendCountdown' not in helper
assert 'PauseCountdown' not in helper

View File

@@ -9,10 +9,11 @@ def _block(start: str, end: str) -> str:
return APP_JS.split(start, 1)[1].split(end, 1)[0]
def test_pause_stop_sends_only_stopcountdown():
def test_pause_stop_sends_only_pause_only_command():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
branch = helper.split('if (action === "stop" || action === "pause")', 1)[1].split('if (action === "set")', 1)[0]
assert 'Function: "StopCountdown"' in branch
assert 'Function: "SuspendCountdown"' in branch
assert 'Function: "StopCountdown"' not in branch
assert 'Function: "SetCountdown"' not in branch

View File

@@ -0,0 +1,34 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
APP_JS = (ROOT / "ui_builder/static/app.js").read_text(encoding="utf-8")
APP = (ROOT / "app.py").read_text(encoding="utf-8")
def _block(start: str, end: str) -> str:
return APP_JS.split(start, 1)[1].split(end, 1)[0]
def test_space_pause_uses_suspend_not_stop_reset():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
branch = helper.split('if (action === "stop" || action === "pause")', 1)[1].split('if (action === "set")', 1)[0]
assert 'Function: "SuspendCountdown"' in branch
assert 'Function: "StopCountdown"' not in branch
assert 'Function: "SetCountdown"' not in branch
def test_explicit_reset_set_path_keeps_stop_then_set():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
set_branch = helper.split('if (action === "set")', 1)[1].split('return [', 2)[1]
assert 'Function: "StopCountdown"' in set_branch
assert 'Function: "SetCountdown"' in set_branch
def test_penalty_normal_pause_uses_suspend():
block = _block("async function rebalanceVmixPenaltyTargets", "function finishActionMatchesSource")
assert 'if (preservePausedCountdown && !assignmentChanged)' in block
assert 'stopCommands.push({ Function: "SuspendCountdown"' in block
def test_build105_runtime_version():
assert 'BUILD_VERSION = "2026.08.24.8"' in APP

View File

@@ -33,9 +33,9 @@ def test_countdown_start_is_simple_set_start():
def test_pause_and_stop_freeze_without_reseed():
helper = _block("function vmixCountdownSyncCommands", "function buildShortcutRuntimeContext")
branch = helper.split('if (action === "stop" || action === "pause")', 1)[1].split('return [', 1)[1].split('];', 1)[0]
assert 'Function: "StopCountdown"' in branch
assert 'Function: "SuspendCountdown"' in branch
assert 'Function: "StopCountdown"' not in branch
assert 'Function: "SetCountdown"' not in branch
assert 'Function: "SuspendCountdown"' not in branch
assert 'Function: "PauseCountdown"' not in branch
@@ -45,7 +45,6 @@ def test_penalty_rebalance_hard_syncs_running_countdown_and_pauses_stably():
assert 'Value: () => vmixCountdownValue(entry.event.remainingMs)' in block
assert 'runCommands.push({ Function: "StartCountdown"' in block
assert 'sendRuntimeVmixTimerSequence(commands)' in block
assert 'Function: "SuspendCountdown"' not in block
assert 'Function: "PauseCountdown"' not in block