aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/test
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-11-10 09:39:29 +0100
committerEddy Pedroni <epedroni@pm.me>2024-11-10 09:39:29 +0100
commit85b0116f80515c71e0250e4910c721b9e4fabca1 (patch)
treef046e140c13c3be744b041193e9100ea748c582b /solo-tool-project/test
parent7c00f418caf8f1e9fcb235563127a9c8cea22bb4 (diff)
Set A and B limits via MIDI controller
Diffstat (limited to 'solo-tool-project/test')
-rw-r--r--solo-tool-project/test/midi_launchpad_mini_integrationtest.py60
1 files changed, 54 insertions, 6 deletions
diff --git a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
index 17649d4..e7c1315 100644
--- a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
+++ b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py
@@ -9,14 +9,24 @@ LED_YELLOW = 126
LED_GREEN = 124
LED_OFF = 0
-nextSongButton = 119
-previousSongButton = 118
+nextSongButton = 55
+plus1MinuteButton = 54
+plus30SecondsButton = 53
+plus5SecondsButton = 52
+minus5SecondsButton = 51
+minus30SecondsButton = 50
+minus1MinuteButton = 49
+previousSongButton = 48
+
playPauseButton = 112
stopButton = 96
-nextLimitButton = 103
-previousLimitButton = 102
-abToggleButton = 101
-jumpToAButton = 99
+
+nextLimitButton = 119
+previousLimitButton = 118
+abToggleButton = 98
+jumpToAButton = 114
+setAButton = 116
+setBButton = 117
class MidiWrapperMock:
def __init__(self):
@@ -352,6 +362,8 @@ def test_connectDisconnect(uut, midiWrapperMock):
(jumpToAButton, LED_YELLOW, 0),
(previousLimitButton, LED_RED, 0),
(nextLimitButton, LED_GREEN, 0),
+ (setAButton, LED_YELLOW, 0),
+ (setBButton, LED_YELLOW, 0),
(previousSongButton, LED_RED, 0),
(nextSongButton, LED_GREEN, 0)
])
@@ -388,3 +400,39 @@ def test_playingFeedbackWhenChangingSong(uut, midiWrapperMock, soloTool, playerM
assert playerMock.state == PlayerMock.STOPPED
assert midiWrapperMock.getLatestMessage() == (playPauseButton, LED_YELLOW, 0)
+def test_setAbButtons(uut, midiWrapperMock, soloTool, playerMock):
+ song = "test.flac"
+ soloTool.addSong(song)
+ soloTool.setSong(0)
+ soloTool.setAbLimitEnable(True)
+ abLimits = (0.6, 0.8)
+ soloTool.storeAbLimits(abLimits[0], abLimits[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
+
+ # Set A limit
+ playerMock.position = 0.3
+ midiWrapperMock.simulateInput(setAButton)
+ playerMock.position = 0.5
+ midiWrapperMock.simulateInput(jumpToAButton)
+
+ assert playerMock.position == 0.3
+
+ # Set B limit
+ playerMock.position = 0.4
+ midiWrapperMock.simulateInput(setBButton)
+ checkLimit(0.3, 0.4)
+
+ # Selecting preset overrides manually set limits
+ midiWrapperMock.simulateInput(nextLimitButton)
+ checkLimit(abLimits[0], abLimits[1])
+