Volume: quieter/louder buttons that take the remote's own step
Next to the five volume bars, a − and a + button move the volume by
`volume_increment` device units, the same step as the IR remote's volume keys and
the rotary encoder, via a new `{steps}` form of POST /api/volume. The bars still
jump to a percentage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -292,13 +292,29 @@ async def test_volume_steps_clamp_at_the_ends(client: Client, sim: Simulation) -
|
||||
assert (await client.get("/api/state")).json()["volume"] == 100
|
||||
|
||||
|
||||
async def test_remote_steps_move_by_the_volume_increment(client: Client, sim: Simulation) -> None:
|
||||
"""The +/- buttons take the IR remote's step, in device units, not a percentage."""
|
||||
await client.post("/api/volume", json={"percent": 50})
|
||||
await sim.bus.drain()
|
||||
before = sim.player.volume
|
||||
step = sim.app.config.general.volume_increment
|
||||
|
||||
assert (await client.post("/api/volume", json={"steps": 1})).status_code == 204
|
||||
await sim.bus.drain()
|
||||
assert sim.player.volume == before + step
|
||||
|
||||
await client.post("/api/volume", json={"steps": -2})
|
||||
await sim.bus.drain()
|
||||
assert sim.player.volume == before - step
|
||||
|
||||
|
||||
async def test_the_device_volume_range_is_never_exposed(client: Client) -> None:
|
||||
state = (await client.get("/api/state")).json()
|
||||
assert "volume_min" not in state
|
||||
assert "volume_max" not in state
|
||||
|
||||
|
||||
async def test_volume_needs_one_of_the_two_fields(client: Client) -> None:
|
||||
async def test_volume_needs_one_of_the_fields(client: Client) -> None:
|
||||
assert (await client.post("/api/volume", json={})).status_code == 422
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user