diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 16:47:48 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-03 16:47:48 +0100 |
commit | 1423f2922650a8ba9104e595f87d66a83a244fb1 (patch) | |
tree | d46fc7dacf8a4a4815bd6d07af1e950d2bcb53a6 /midi_launchpad_mini_integrationtest.py | |
parent | 794d645856da721e0bc7e97a788dcc60e4c87f0c (diff) |
Added LED feedback to playback rate and volume, same hacky implementation
Diffstat (limited to 'midi_launchpad_mini_integrationtest.py')
-rw-r--r-- | midi_launchpad_mini_integrationtest.py | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py index 5a28925..4400695 100644 --- a/midi_launchpad_mini_integrationtest.py +++ b/midi_launchpad_mini_integrationtest.py @@ -162,40 +162,54 @@ def test_previousAndNextAbButtons(uut, midiWrapperMock, soloTool, playerMock): checkLimit(abLimits[0][0], abLimits[0][1]) def test_playbackRateButtons(uut, midiWrapperMock, soloTool, playerMock): + ledYellow = 126 + ledOff = 0 playbackRateOptions = { - 16 : 0.5, - 17 : 0.6, - 18 : 0.7, - 19 : 0.8, - 20 : 0.9, - 21 : 1.0, - 22 : 1.1, - 23 : 1.2 + 16 : (0.5, [ledYellow] * 1 + [ledOff] * 7), + 17 : (0.6, [ledYellow] * 2 + [ledOff] * 6), + 18 : (0.7, [ledYellow] * 3 + [ledOff] * 5), + 19 : (0.8, [ledYellow] * 4 + [ledOff] * 4), + 20 : (0.9, [ledYellow] * 5 + [ledOff] * 3), + 21 : (1.0, [ledYellow] * 6 + [ledOff] * 2), + 22 : (1.1, [ledYellow] * 7 + [ledOff] * 1), + 23 : (1.2, [ledYellow] * 8) } uut.connect() assert playerMock.rate == 1.0 - for button in playbackRateOptions: + for t, button in enumerate(playbackRateOptions): + midiWrapperMock.sentMessages.clear() + midiWrapperMock.simulateInput(button) - assert playerMock.rate == playbackRateOptions[button] + assert playerMock.rate == playbackRateOptions[button][0] + + for i, colour in enumerate(playbackRateOptions[button][1]): + assert midiWrapperMock.sentMessages[i] == (16 + i, colour, 0) def test_playbackVolumeButtons(uut, midiWrapperMock, soloTool, playerMock): + ledGreen = 124 + ledOff = 0 playbackVolumeOptions = { - 0 : 0.125, - 1 : 0.250, - 2 : 0.375, - 3 : 0.500, - 4 : 0.625, - 5 : 0.750, - 6 : 0.875, - 7 : 1.000 + 0 : (0.125, [ledGreen] * 1 + [ledOff] * 7), + 1 : (0.250, [ledGreen] * 2 + [ledOff] * 6), + 2 : (0.375, [ledGreen] * 3 + [ledOff] * 5), + 3 : (0.500, [ledGreen] * 4 + [ledOff] * 4), + 4 : (0.625, [ledGreen] * 5 + [ledOff] * 3), + 5 : (0.750, [ledGreen] * 6 + [ledOff] * 2), + 6 : (0.875, [ledGreen] * 7 + [ledOff] * 1), + 7 : (1.000, [ledGreen] * 8) } uut.connect() assert playerMock.volume == 1.0 - for button in playbackVolumeOptions: + for t, button in enumerate(playbackVolumeOptions): + midiWrapperMock.sentMessages.clear() + midiWrapperMock.simulateInput(button) - assert playerMock.volume == playbackVolumeOptions[button] + assert playerMock.volume == playbackVolumeOptions[button][0] + + for i, colour in enumerate(playbackVolumeOptions[button][1]): + assert midiWrapperMock.sentMessages[i] == (i, colour, 0) def test_unassignedButton(uut, midiWrapperMock): unassignedButton = 48 |