aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_integrationtest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-01 19:09:01 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-01 19:09:01 +0100
commitf7480bb96323b8466ad8e097475db2a7135c88e0 (patch)
treece588932ed3afd93ecdb21941d357c7fe56c40df /solo_tool_integrationtest.py
parentd28a1b91afa86b6e39ac4df24d8bada7e795b20b (diff)
Added next/previous AB limit functionality
Diffstat (limited to 'solo_tool_integrationtest.py')
-rw-r--r--solo_tool_integrationtest.py44
1 files changed, 42 insertions, 2 deletions
diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py
index d0123d5..6022454 100644
--- a/solo_tool_integrationtest.py
+++ b/solo_tool_integrationtest.py
@@ -96,8 +96,8 @@ def test_addAndSetAbLimits(uut, mockPlayer):
uut.addSong(song)
uut.setSong(0)
- uut.storeAbLimits(abLimits[0][0], abLimits[0][1])
- uut.storeAbLimits(abLimits[1][0], abLimits[1][1])
+ for ab in abLimits:
+ uut.storeAbLimits(ab[0], ab[1])
mockPlayer.position = 0.0
uut.tick()
@@ -206,6 +206,46 @@ def test_storeAbLimitsWithoutSong(uut, mockPlayer):
uut.tick()
assert mockPlayer.position == abLimit[0]
+def test_nextAndPreviousAbLimit(uut, mockPlayer):
+ song = "test.flac"
+ abLimits = [
+ [0.2, 0.4],
+ [0.1, 0.3]
+ ]
+
+ def checkLimit(aLimit, bLimit):
+ mockPlayer.position = bLimit - 0.1
+ uut.tick()
+ assert mockPlayer.position == bLimit - 0.1
+
+ mockPlayer.position = bLimit + 0.1
+ uut.tick()
+ assert mockPlayer.position == aLimit
+
+ uut.addSong(song)
+ uut.setSong(0)
+ uut.setAbLimitEnable(True)
+
+ for ab in abLimits:
+ uut.storeAbLimits(ab[0], ab[1])
+
+ checkLimit(0.0, 0.0) # default limits
+
+ uut.nextStoredAbLimits()
+ checkLimit(abLimits[0][0], abLimits[0][1])
+
+ uut.nextStoredAbLimits()
+ checkLimit(abLimits[1][0], abLimits[1][1])
+
+ uut.nextStoredAbLimits()
+ checkLimit(abLimits[1][0], abLimits[1][1])
+
+ uut.previousStoredAbLimits()
+ checkLimit(abLimits[0][0], abLimits[0][1])
+
+ uut.previousStoredAbLimits()
+ checkLimit(abLimits[0][0], abLimits[0][1])
+
def test_loadAndSaveSession(prepared_tmp_path):
mockPlayer = MockPlayer()
uut = SoloTool(mockPlayer)