aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-11-09 23:22:55 +0100
committerEddy Pedroni <epedroni@pm.me>2024-11-09 23:22:55 +0100
commitf676c50ba91ca6d4d0da9f77aeadc8b3fb16dc26 (patch)
treedd7cf29dff80610ec3e6179b444954a5bca3e125 /solo-tool-project/test/midi_launchpad_mini_integrationtest.py
parentcda8197669409689be291660f93cb288ab2d31b3 (diff)
CLI improvements
Diffstat (limited to 'solo-tool-project/test/midi_launchpad_mini_integrationtest.py')
-rw-r--r--solo-tool-project/test/midi_launchpad_mini_integrationtest.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
index 8542aae..17649d4 100644
--- a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
+++ b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
@@ -24,11 +24,12 @@ class MidiWrapperMock:
self.connectedDevice = None
self.sentMessages = list()
- def setCallback(self, callback):
+ def connect(self, deviceName, callback):
+ self.connectedDevice = deviceName
self.callback = callback
- def connect(self, deviceName):
- self.connectedDevice = deviceName
+ def disconnect(self):
+ self.connectedDevice = None
def sendMessage(self, note, velocity, channel):
self.sentMessages.append((note, velocity, channel))
@@ -58,12 +59,6 @@ def midiWrapperMock():
def uut(soloTool, midiWrapperMock):
return MidiController(soloTool, midiWrapperMock)
-def test_connect(uut, midiWrapperMock):
- expectedDevice = "Launchpad Mini MIDI 1"
- uut.connect()
-
- assert midiWrapperMock.connectedDevice == expectedDevice
-
def test_startStopAndPauseButtons(uut, midiWrapperMock, playerMock):
uut.connect()
@@ -345,8 +340,8 @@ 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):
- expectedMessages = set(
+def test_connectDisconnect(uut, midiWrapperMock):
+ startupMessages = list(
[(int(i / 8) * 16 + (i % 8), LED_OFF, 0) for i in range(0, 64)] + # clear all
[(i, LED_GREEN, 0) for i in range(0, 6)] + # volume row
[(i, LED_YELLOW, 0) for i in range(16, 22)] + # playback rate row
@@ -359,13 +354,21 @@ def test_initializationMessages(uut, midiWrapperMock):
(nextLimitButton, LED_GREEN, 0),
(previousSongButton, LED_RED, 0),
(nextSongButton, LED_GREEN, 0)
- ]
- )
+ ])
+
+ teardownMessages = [(int(i / 8) * 16 + (i % 8), LED_OFF, 0) for i in range(0, 64)] # clear all
+ expectedDevice = "Launchpad Mini MIDI 1"
uut.connect()
- sentMessagesSet = set(midiWrapperMock.sentMessages)
- assert sentMessagesSet == expectedMessages
+ assert midiWrapperMock.connectedDevice == expectedDevice
+ assert set(midiWrapperMock.sentMessages) == set(startupMessages)
+
+ midiWrapperMock.sentMessages.clear()
+
+ uut.disconnect()
+
+ assert set(midiWrapperMock.sentMessages) == set(teardownMessages)
def test_playingFeedbackWhenChangingSong(uut, midiWrapperMock, soloTool, playerMock):
songs = [