aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_integrationtest.py
diff options
context:
space:
mode:
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)