aboutsummaryrefslogtreecommitdiffstats
path: root/midi_launchpad_mini_unittest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-01 15:49:06 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-01 15:49:06 +0100
commit328d9ae201cabe8e4189736cd806ecea7b675200 (patch)
tree97f198c5f4b3f3ceff0b39690f703b73d2f69de1 /midi_launchpad_mini_unittest.py
parent71f6a49110b6696ca6ac7956baa4edaa1aaa9527 (diff)
Added previous/next song buttons to MIDI interface, updated known issues
Diffstat (limited to 'midi_launchpad_mini_unittest.py')
-rw-r--r--midi_launchpad_mini_unittest.py41
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)
+"""