diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-01-01 19:09:01 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-01-01 19:09:01 +0100 |
commit | f7480bb96323b8466ad8e097475db2a7135c88e0 (patch) | |
tree | ce588932ed3afd93ecdb21941d357c7fe56c40df /midi_launchpad_mini_integrationtest.py | |
parent | d28a1b91afa86b6e39ac4df24d8bada7e795b20b (diff) |
Added next/previous AB limit functionality
Diffstat (limited to 'midi_launchpad_mini_integrationtest.py')
-rw-r--r-- | midi_launchpad_mini_integrationtest.py | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py index 4601c8d..8779503 100644 --- a/midi_launchpad_mini_integrationtest.py +++ b/midi_launchpad_mini_integrationtest.py @@ -82,6 +82,8 @@ def test_jumpToAButton(uut, midiWrapperMock, soloTool, playerMock): assert playerMock.position == ab[0] def test_previousAndNextSongButtons(uut, midiWrapperMock, soloTool, playerMock): + nextSongButton = 119 + previousSongButton = 118 songs = [ "test.flac", "test.mp3" @@ -91,21 +93,66 @@ def test_previousAndNextSongButtons(uut, midiWrapperMock, soloTool, playerMock): uut.connect() assert playerMock.currentSong == None - midiWrapperMock.simulateInput(119) + midiWrapperMock.simulateInput(nextSongButton) assert playerMock.currentSong == songs[0] - midiWrapperMock.simulateInput(119) + midiWrapperMock.simulateInput(nextSongButton) assert playerMock.currentSong == songs[1] - midiWrapperMock.simulateInput(118) + midiWrapperMock.simulateInput(previousSongButton) assert playerMock.currentSong == songs[0] - midiWrapperMock.simulateInput(118) + midiWrapperMock.simulateInput(previousSongButton) assert playerMock.currentSong == songs[0] -def test_unprogrammedButton(uut, midiWrapperMock): - unusedButton = 48 +def test_previousAndNextAbButtons(uut, midiWrapperMock, soloTool, playerMock): + nextLimitButton = 103 + previousLimitButton = 102 + song = "test.flac" + abLimits = [ + [0.2, 0.4], + [0.1, 0.3] + ] + + soloTool.addSong(song) + soloTool.setSong(0) + soloTool.setAbLimitEnable(True) + + for ab in abLimits: + soloTool.storeAbLimits(ab[0], ab[1]) + + uut.connect() + + def checkLimit(aLimit, bLimit): + playerMock.position = bLimit - 0.1 + soloTool.tick() + assert playerMock.position == bLimit - 0.1 + + playerMock.position = bLimit + 0.1 + soloTool.tick() + assert playerMock.position == aLimit + + checkLimit(0.0, 0.0) + + midiWrapperMock.simulateInput(nextLimitButton) + checkLimit(abLimits[0][0], abLimits[0][1]) + + midiWrapperMock.simulateInput(nextLimitButton) + checkLimit(abLimits[1][0], abLimits[1][1]) + + midiWrapperMock.simulateInput(nextLimitButton) + checkLimit(abLimits[1][0], abLimits[1][1]) + + midiWrapperMock.simulateInput(previousLimitButton) + checkLimit(abLimits[0][0], abLimits[0][1]) + + midiWrapperMock.simulateInput(previousLimitButton) + checkLimit(abLimits[0][0], abLimits[0][1]) + +def test_unassignedButton(uut, midiWrapperMock): + unassignedButton = 48 uut.connect() # expect no crash - midiWrapperMock.simulateInput(48) + midiWrapperMock.simulateInput(unassignedButton) + # XXX would be better to assert that nothing changed in the solo tool |