feat: initial project scaffold — server, client, Android APK
- FastAPI server with audio mixer (Windows + Voicemeeter), media tracking, notifications (progress + alerts), telemetry, and system tray .exe build - Test suite covering notifications, audio mixer, media, telemetry, and API - E-Ink web client (vanilla JS, DOM API, block meters, swipe gestures) - Android WebView APK for BOOX Go 7 Color Gen II (Android 13, Kotlin) - Design decision records in .pi/docs/design/ - PyInstaller build script for server .exe
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""Tests for the media tracking module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ..media import MediaManager, MediaState
|
||||
|
||||
|
||||
class TestMediaState:
|
||||
def test_defaults(self) -> None:
|
||||
state = MediaState()
|
||||
assert state.title == ""
|
||||
assert state.artist == ""
|
||||
assert not state.is_playing
|
||||
assert state.is_stopped
|
||||
assert state.playback_percentage == 0.0
|
||||
|
||||
def test_playing_state(self) -> None:
|
||||
state = MediaState(
|
||||
title="Test Song",
|
||||
artist="Test Artist",
|
||||
is_playing=True,
|
||||
is_paused=False,
|
||||
is_stopped=False,
|
||||
playback_percentage=45.5,
|
||||
)
|
||||
assert state.title == "Test Song"
|
||||
assert state.is_playing
|
||||
assert state.playback_percentage == 45.5
|
||||
|
||||
|
||||
class TestMediaManager:
|
||||
def test_init(self) -> None:
|
||||
manager = MediaManager()
|
||||
assert manager._state is not None
|
||||
|
||||
def test_get_state_returns_dict(self) -> None:
|
||||
manager = MediaManager()
|
||||
state = manager.get_state()
|
||||
assert isinstance(state, dict)
|
||||
assert "title" in state
|
||||
assert "artist" in state
|
||||
assert "is_playing" in state
|
||||
assert "playback_percentage" in state
|
||||
|
||||
def test_get_state_empty_when_nothing_playing(self) -> None:
|
||||
manager = MediaManager()
|
||||
state = manager.get_state()
|
||||
assert state["title"] == ""
|
||||
assert not state["is_playing"]
|
||||
assert state["is_stopped"]
|
||||
Reference in New Issue
Block a user