From edb2ffc66231702c931429ab44ad5009abb8c128 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Tue, 4 Jan 2022 13:49:38 +0100 Subject: Added proper volume and playback rate feedback, changed volume steps in MIDI interface --- notifier_unittest.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'notifier_unittest.py') 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 -- cgit v1.2.3