From 748f056faf16b08ac41de991b1aeb664f2b86d8e Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 17 Jul 2025 23:24:15 +0200 Subject: Per-song volume --- .../test/solo_tool_integrationtest.py | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'solo-tool-project/test/solo_tool_integrationtest.py') diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index b92cd85..e5745bb 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -1,6 +1,6 @@ from fixtures import soloTool as uut, mockPlayer, testSongs -def test_playerControls(uut, mockPlayer): +def test_playerControls(uut, mockPlayer, testSongs): assert not mockPlayer.playing assert not uut.playing uut.play() @@ -130,6 +130,41 @@ def test_playbackVolumeNotification(uut, mockPlayer, testSongs): uut.volume = 0.3 assert not called + # Volume can also change when the song changes + uut.addSong(testSongs[1]) + uut.song = 1 + assert called + assert receivedValue == 1.0 + called = False + + uut.volume = 0.3 + assert called + assert receivedValue == 0.3 + called = False + + uut.song = 0 + assert not called + +def test_playbackVolumeNotificationBeforeFirstSong(uut, mockPlayer, testSongs): + called = False + receivedValue = None + def callback(value): + nonlocal called, receivedValue + called = True + receivedValue = value + + uut.registerVolumeCallback(callback) + assert not called + + uut.volume = 0.3 + assert called + assert receivedValue == 0.3 + called = False + + uut.addSong(testSongs[0]) + assert called + assert receivedValue == 1.0 + def test_playbackRateNotification(uut, mockPlayer, testSongs): uut.addSong(testSongs[0]) -- cgit v1.2.3