feat: scaffold tuimble TUI mumble client
Core modules: TUI app (textual), mumble protocol client, audio pipeline (sounddevice + opus), push-to-talk with kitty protocol / evdev / toggle backends. Config via TOML.
This commit is contained in:
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
23
tests/test_config.py
Normal file
23
tests/test_config.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Tests for configuration module."""
|
||||
|
||||
from tuimble.config import Config, PttConfig, ServerConfig
|
||||
|
||||
|
||||
def test_default_config():
|
||||
cfg = Config()
|
||||
assert cfg.server.host == "localhost"
|
||||
assert cfg.server.port == 64738
|
||||
assert cfg.audio.sample_rate == 48000
|
||||
assert cfg.ptt.mode == "hold"
|
||||
|
||||
|
||||
def test_server_config():
|
||||
srv = ServerConfig(host="mumble.example.com", port=12345)
|
||||
assert srv.host == "mumble.example.com"
|
||||
assert srv.port == 12345
|
||||
|
||||
|
||||
def test_ptt_config_defaults():
|
||||
ptt = PttConfig()
|
||||
assert ptt.key == "space"
|
||||
assert ptt.backend == "auto"
|
||||
37
tests/test_ptt.py
Normal file
37
tests/test_ptt.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""Tests for push-to-talk backends."""
|
||||
|
||||
from tuimble.ptt import KittyPtt, PttState, TogglePtt
|
||||
|
||||
|
||||
def test_kitty_ptt_press_release():
|
||||
states = []
|
||||
ptt = KittyPtt(lambda tx: states.append(tx))
|
||||
assert ptt.state is PttState.IDLE
|
||||
|
||||
ptt.key_down()
|
||||
assert ptt.state is PttState.TRANSMITTING
|
||||
assert states == [True]
|
||||
|
||||
ptt.key_up()
|
||||
assert ptt.state is PttState.IDLE
|
||||
assert states == [True, False]
|
||||
|
||||
|
||||
def test_kitty_ptt_no_duplicate_events():
|
||||
states = []
|
||||
ptt = KittyPtt(lambda tx: states.append(tx))
|
||||
|
||||
ptt.key_down()
|
||||
ptt.key_down() # repeat, no state change
|
||||
assert states == [True]
|
||||
|
||||
|
||||
def test_toggle_ptt():
|
||||
states = []
|
||||
ptt = TogglePtt(lambda tx: states.append(tx))
|
||||
|
||||
ptt.toggle()
|
||||
assert ptt.transmitting is True
|
||||
ptt.toggle()
|
||||
assert ptt.transmitting is False
|
||||
assert states == [True, False]
|
||||
Reference in New Issue
Block a user