aboutsummaryrefslogtreecommitdiffstats
path: root/notifier_unittest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-04 13:49:38 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-04 13:49:38 +0100
commitedb2ffc66231702c931429ab44ad5009abb8c128 (patch)
tree6b1ad17f45aaf35a8cf0f3cedf03ac71c6611d6c /notifier_unittest.py
parent67f07cf01155b98321f590e3c18e378018c0a624 (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.py35
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