diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-04 13:49:38 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-04 13:49:38 +0100 |
commit | edb2ffc66231702c931429ab44ad5009abb8c128 (patch) | |
tree | 6b1ad17f45aaf35a8cf0f3cedf03ac71c6611d6c /notifier_unittest.py | |
parent | 67f07cf01155b98321f590e3c18e378018c0a624 (diff) |
Added proper volume and playback rate feedback, changed volume steps in MIDI interface
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 |