diff options
Diffstat (limited to 'solo_tool_integrationtest.py')
-rw-r--r-- | solo_tool_integrationtest.py | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index 386cb26..2ee4719 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -335,9 +335,11 @@ def test_playingStateNotification(uut, mockPlayer): uut.setSong(0) called = False - def callback(): - nonlocal called + receivedValue = None + def callback(value): + nonlocal called, receivedValue called = True + receivedValue = value uut.registerPlayingStateCallback(callback) @@ -346,22 +348,26 @@ def test_playingStateNotification(uut, mockPlayer): uut.play() assert called + assert receivedValue == True called = False uut.play() assert not called uut.pause() assert called + assert receivedValue == False called = False uut.pause() assert not called uut.play() assert called + assert receivedValue == True called = False uut.stop() assert called + assert receivedValue == False called = False uut.stop() assert not called @@ -372,19 +378,22 @@ def test_playbackVolumeNotification(uut, mockPlayer): uut.setSong(0) called = False - def callback(): - nonlocal called + receivedValue = None + def callback(value): + nonlocal called, receivedValue called = True + receivedValue = value uut.registerPlaybackVolumeCallback(callback) assert not called - uut.setPlaybackVolume(0.0) + uut.setPlaybackVolume(0.3) assert called + assert receivedValue == 0.3 called = False - uut.setPlaybackVolume(0.0) + uut.setPlaybackVolume(0.3) assert not called def test_playbackRateNotification(uut, mockPlayer): @@ -393,9 +402,11 @@ def test_playbackRateNotification(uut, mockPlayer): uut.setSong(0) called = False - def callback(): - nonlocal called + receivedValue = None + def callback(value): + nonlocal called, receivedValue called = True + receivedValue = value uut.registerPlaybackRateCallback(callback) @@ -403,6 +414,7 @@ def test_playbackRateNotification(uut, mockPlayer): uut.setPlaybackRate(0.5) assert called + assert receivedValue == 0.5 called = False uut.setPlaybackRate(0.5) @@ -410,9 +422,11 @@ def test_playbackRateNotification(uut, mockPlayer): def test_currentSongNotification(uut): called = False - def callback(): - nonlocal called + receivedValue = None + def callback(value): + nonlocal called, receivedValue called = True + receivedValue = value uut.registerCurrentSongCallback(callback) assert not called @@ -426,6 +440,7 @@ def test_currentSongNotification(uut): uut.setSong(0) assert called + assert receivedValue == 0 called = False uut.addSong(songs[1]) @@ -436,10 +451,12 @@ def test_currentSongNotification(uut): uut.setSong(1) assert called + assert receivedValue == 1 called = False uut.previousSong() assert called + assert receivedValue == 0 called = False uut.previousSong() @@ -447,6 +464,7 @@ def test_currentSongNotification(uut): uut.nextSong() assert called + assert receivedValue == 1 called = False uut.nextSong() @@ -454,9 +472,11 @@ def test_currentSongNotification(uut): def test_currentAbNotification(uut): called = False - def callback(): - nonlocal called + receivedValue = None + def callback(value): + nonlocal called, receivedValue called = True + receivedValue = value uut.registerCurrentAbLimitsCallback(callback) assert not called @@ -476,6 +496,7 @@ def test_currentAbNotification(uut): uut.loadAbLimits(0) assert called + assert receivedValue == 0 called = False uut.loadAbLimits(0) @@ -483,10 +504,12 @@ def test_currentAbNotification(uut): uut.loadAbLimits(1) assert called + assert receivedValue == 1 called = False uut.previousStoredAbLimits() assert called + assert receivedValue == 0 called = False uut.previousStoredAbLimits() @@ -494,6 +517,7 @@ def test_currentAbNotification(uut): uut.nextStoredAbLimits() assert called + assert receivedValue == 1 called = False uut.nextStoredAbLimits() |