diff options
Diffstat (limited to 'notifier_unittest.py')
-rw-r--r-- | notifier_unittest.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/notifier_unittest.py b/notifier_unittest.py index b840c16..52be51e 100644 --- a/notifier_unittest.py +++ b/notifier_unittest.py @@ -30,6 +30,8 @@ def checkEvent(uut, event): def test_allEvents(uut): checkEvent(uut, Notifier.PLAYING_STATE_EVENT) + checkEvent(uut, Notifier.PLAYBACK_VOLUME_EVENT) + checkEvent(uut, Notifier.PLAYBACK_RATE_EVENT) def test_eventWithoutRegisteredCallbacks(uut): uut.notify(Notifier.PLAYING_STATE_EVENT) @@ -46,3 +48,36 @@ def test_playingStateEventWithMockPlayer(uut, mockPlayer): assert not called mockPlayer.simulatePlayingStateChanged() assert called + +def test_singleEventNotification(uut): + playingStateCalled = False + def playingStateCallback(): + nonlocal playingStateCalled + playingStateCalled = True + + volumeCalled = False + def volumeCallback(): + nonlocal volumeCalled + volumeCalled = True + + uut.registerCallback(Notifier.PLAYING_STATE_EVENT, playingStateCallback) + uut.registerCallback(Notifier.PLAYBACK_VOLUME_EVENT, volumeCallback) + + assert not playingStateCalled + assert not volumeCalled + + uut.notify(Notifier.PLAYING_STATE_EVENT) + assert playingStateCalled + assert not volumeCalled + + playingStateCalled = False + + uut.notify(Notifier.PLAYBACK_VOLUME_EVENT) + assert not playingStateCalled + assert volumeCalled + + volumeCalled = False + + uut.notify(Notifier.PLAYBACK_RATE_EVENT) + assert not playingStateCalled + assert not volumeCalled |