diff options
Diffstat (limited to 'solo-tool-project/test/solo_tool_integrationtest.py')
-rw-r--r-- | solo-tool-project/test/solo_tool_integrationtest.py | 37 |
1 files changed, 36 insertions, 1 deletions
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]) |