diff options
Diffstat (limited to 'solo-tool-project/test')
-rw-r--r-- | solo-tool-project/test/midi_launchpad_mini_integrationtest.py | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py index e7c1315..8fd09bb 100644 --- a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py +++ b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py @@ -1,4 +1,5 @@ import pytest +from mido import Message from solo_tool.midi_controller_launchpad_mini import MidiController from solo_tool.solo_tool import SoloTool @@ -10,12 +11,12 @@ LED_GREEN = 124 LED_OFF = 0 nextSongButton = 55 -plus1MinuteButton = 54 -plus30SecondsButton = 53 -plus5SecondsButton = 52 -minus5SecondsButton = 51 -minus30SecondsButton = 50 -minus1MinuteButton = 49 +fwd25PcButton = 54 +fwd5PcButton = 53 +fwd1PcButton = 52 +rwd1PcButton = 51 +rwd5PcButton = 50 +rwd25PcButton = 49 previousSongButton = 48 playPauseButton = 112 @@ -46,7 +47,6 @@ class MidiWrapperMock: def simulateInput(self, note, velocity=127, channel=0): if self.callback is not None: - from mido import Message msg = Message("note_on", note=note, velocity=velocity, channel=channel) self.callback(msg) @@ -365,7 +365,13 @@ def test_connectDisconnect(uut, midiWrapperMock): (setAButton, LED_YELLOW, 0), (setBButton, LED_YELLOW, 0), (previousSongButton, LED_RED, 0), - (nextSongButton, LED_GREEN, 0) + (rwd1PcButton, LED_RED, 0), + (rwd5PcButton, LED_RED, 0), + (rwd25PcButton, LED_RED, 0), + (nextSongButton, LED_GREEN, 0), + (fwd1PcButton, LED_GREEN, 0), + (fwd5PcButton, LED_GREEN, 0), + (fwd25PcButton, LED_GREEN, 0), ]) teardownMessages = [(int(i / 8) * 16 + (i % 8), LED_OFF, 0) for i in range(0, 64)] # clear all @@ -436,3 +442,39 @@ def test_setAbButtons(uut, midiWrapperMock, soloTool, playerMock): midiWrapperMock.simulateInput(nextLimitButton) checkLimit(abLimits[0], abLimits[1]) +def test_seekButtons(uut, midiWrapperMock, soloTool, playerMock): + song = "test.flac" + soloTool.addSong(song) + soloTool.setSong(0) + + uut.connect() + + assert playerMock.position == 0.0 + + midiWrapperMock.simulateInput(fwd25PcButton) + assert playerMock.position == 0.25 + + midiWrapperMock.simulateInput(fwd5PcButton) + assert playerMock.position == 0.30 + + midiWrapperMock.simulateInput(fwd1PcButton) + assert playerMock.position == 0.31 + + midiWrapperMock.simulateInput(fwd25PcButton) + midiWrapperMock.simulateInput(fwd25PcButton) + midiWrapperMock.simulateInput(fwd25PcButton) + assert playerMock.position == 1.0 + + midiWrapperMock.simulateInput(rwd25PcButton) + assert playerMock.position == 0.75 + + midiWrapperMock.simulateInput(rwd5PcButton) + assert playerMock.position == 0.70 + + midiWrapperMock.simulateInput(rwd1PcButton) + assert playerMock.position == 0.69 + + midiWrapperMock.simulateInput(rwd25PcButton) + midiWrapperMock.simulateInput(rwd25PcButton) + midiWrapperMock.simulateInput(rwd25PcButton) + assert playerMock.position == 0.0 |