aboutsummaryrefslogtreecommitdiffstats
path: root/midi_launchpad_mini_integrationtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'midi_launchpad_mini_integrationtest.py')
-rw-r--r--midi_launchpad_mini_integrationtest.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py
index 275bd33..13b18e7 100644
--- a/midi_launchpad_mini_integrationtest.py
+++ b/midi_launchpad_mini_integrationtest.py
@@ -6,9 +6,10 @@ from player_mock import Player as PlayerMock
class MidiWrapperMock:
def __init__(self):
+ from queue import SimpleQueue
self.callback = None
self.connectedDevice = None
- self.lastMessageSent = None
+ self.sentMessages = SimpleQueue()
def setCallback(self, callback):
self.callback = callback
@@ -16,8 +17,8 @@ class MidiWrapperMock:
def connect(self, deviceName):
self.connectedDevice = deviceName
- def sendMessage(self, note, velocity=127, channel=0):
- pass
+ def sendMessage(self, note, velocity, channel):
+ self.sentMessages.put((note, velocity, channel))
def simulateInput(self, note, velocity=127, channel=0):
if self.callback is not None:
@@ -193,3 +194,32 @@ def test_unassignedButton(uut, midiWrapperMock):
midiWrapperMock.simulateInput(unassignedButton)
# XXX would be better to assert that nothing changed in the solo tool
+def test_initializationMessages(uut, midiWrapperMock):
+ green = 124
+ yellow = 126
+ red = 3
+ off = 0
+
+ expectedMessages = set(
+ [(int(i / 8) * 16 + (i % 8), off, 0) for i in range(0, 64)] + # clear all
+ [(i, green, 0) for i in range(0, 8)] + # volume row
+ [(i, yellow, 0) for i in range(16, 22)] + # playback rate row
+ [
+ (96, red, 0),
+ (101, yellow, 0),
+ (102, red, 0),
+ (103, green, 0),
+ (112, green, 0),
+ (118, red, 0),
+ (119, green, 0)
+ ]
+ )
+
+ uut.connect()
+
+ sentMessages = set()
+ while (not midiWrapperMock.sentMessages.empty()):
+ sentMessages.add(midiWrapperMock.sentMessages.get())
+
+ assert sentMessages == expectedMessages
+