This commit is contained in:
2026-08-27 23:46:19 +02:00
parent a8ed350aec
commit 8aed3b022b
16 changed files with 602 additions and 186 deletions

View File

@@ -125,6 +125,29 @@ async def test_play_from_start_starts_the_first_track(
assert only(seen, PlaybackChanged)[-1].playing is True
async def test_switching_albums_while_playing_announces_the_new_track(
bus: EventBus, player: FakePlayer, seen: list[Event]
) -> None:
"""Regression: starting a new playlist from track 0 while already playing track 0
of the previous one used to look like a no-op index change, so no ``TrackChanged``
went out and front-ends never learned the album had switched."""
player.set_playlist(playlist(name="fuchs"))
player.play_from_start()
await bus.drain()
player.set_playlist(playlist(name="eule"))
player.play_from_start()
await bus.drain()
assert player.is_playing
assert player.playlist is not None
assert player.playlist.name == "eule"
changes = only(seen, TrackChanged)
assert changes[-1].index == 0
assert changes[-1].track is not None
assert changes[-1].track.path.parent.name == "eule"
async def test_playing_an_empty_playlist_does_nothing(
bus: EventBus, player: FakePlayer, caplog: pytest.LogCaptureFixture
) -> None: