diff options
Diffstat (limited to 'midi_launchpad_mini_unittest.py')
-rw-r--r-- | midi_launchpad_mini_unittest.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/midi_launchpad_mini_unittest.py b/midi_launchpad_mini_unittest.py index 09f12df..55ca6c8 100644 --- a/midi_launchpad_mini_unittest.py +++ b/midi_launchpad_mini_unittest.py @@ -30,6 +30,8 @@ class SoloToolMock: self.state = SoloToolMock.STOPPED self.position = 0.0 self.currentAbLimit = (0.0, 0.0) + self.currentLoadedAbLimitIndex = None + self.currentSong = None def play(self): self.state = SoloToolMock.PLAYING @@ -46,6 +48,24 @@ class SoloToolMock: def jumpToA(self): self.position = self.currentAbLimit[0] + def loadAbLimits(self, index): + self.currentLoadedAbLimitIndex = index + + def setSong(self, index): + self.currentSong = index + + def nextSong(self): + if self.currentSong is None: + self.currentSong = 0 + else: + self.currentSong += 1 + + def previousSong(self): + if self.currentSong is None: + self.currentSong = 0 + else: + self.currentSong = max(self.currentSong - 1, 0) + def test_connect(): expectedDevice = "Launchpad Mini MIDI 1" @@ -97,6 +117,26 @@ def test_jumpToAButton(): midiWrapperMock.simulateInput(101) assert soloToolMock.position == ab[0] +def test_previousAndNextSongButtons(): + soloToolMock = SoloToolMock() + midiWrapperMock = MidiWrapperMock() + uut = MidiController(soloToolMock, midiWrapperMock) + uut.connect() + + assert soloToolMock.currentSong == None + midiWrapperMock.simulateInput(119) + assert soloToolMock.currentSong == 0 + + midiWrapperMock.simulateInput(119) + assert soloToolMock.currentSong == 1 + + midiWrapperMock.simulateInput(118) + assert soloToolMock.currentSong == 0 + + midiWrapperMock.simulateInput(118) + assert soloToolMock.currentSong == 0 + +""" def test_unprogrammedButton(): unusedButton = 48 midiWrapperMock = MidiWrapperMock() @@ -105,3 +145,4 @@ def test_unprogrammedButton(): # expect no crash midiWrapperMock.simulateInput(48) +""" |