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.py62
1 files changed, 47 insertions, 15 deletions
diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py
index 2ee4719..ee99303 100644
--- a/solo_tool_integrationtest.py
+++ b/solo_tool_integrationtest.py
@@ -25,6 +25,15 @@ def prepared_tmp_path(tmp_path):
return tmp_path
+def checkLimit(uut, mockPlayer, 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
+
def test_playerControls(uut, mockPlayer):
assert mockPlayer.state == MockPlayer.STOPPED
assert uut.isPlaying() == False
@@ -213,15 +222,6 @@ def test_nextAndPreviousAbLimit(uut, mockPlayer):
[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)
@@ -229,23 +229,55 @@ def test_nextAndPreviousAbLimit(uut, mockPlayer):
for ab in abLimits:
uut.storeAbLimits(ab[0], ab[1])
- checkLimit(0.0, 0.0) # default limits
+ checkLimit(uut, mockPlayer, 0.0, 0.0) # default limits
uut.nextStoredAbLimits()
- checkLimit(abLimits[0][0], abLimits[0][1])
+ checkLimit(uut, mockPlayer, abLimits[0][0], abLimits[0][1])
uut.nextStoredAbLimits()
- checkLimit(abLimits[1][0], abLimits[1][1])
+ checkLimit(uut, mockPlayer, abLimits[1][0], abLimits[1][1])
uut.nextStoredAbLimits()
- checkLimit(abLimits[1][0], abLimits[1][1])
+ checkLimit(uut, mockPlayer, abLimits[1][0], abLimits[1][1])
uut.previousStoredAbLimits()
- checkLimit(abLimits[0][0], abLimits[0][1])
+ checkLimit(uut, mockPlayer, abLimits[0][0], abLimits[0][1])
uut.previousStoredAbLimits()
- checkLimit(abLimits[0][0], abLimits[0][1])
+ checkLimit(uut, mockPlayer, abLimits[0][0], abLimits[0][1])
+
+def test_abLimitsWhenChangingSongs(uut, mockPlayer):
+ songs = [
+ "test.flac",
+ "test.mp3"
+ ]
+ abLimits = [
+ [0.2, 0.4],
+ [0.1, 0.3],
+ [0.7, 0.8]
+ ]
+ uut.setAbLimitEnable(True)
+ for s in songs:
+ uut.addSong(s)
+
+ uut.setSong(0)
+ for ab in abLimits:
+ uut.storeAbLimits(ab[0], ab[1])
+
+ uut.setSong(1)
+ uut.storeAbLimits(abLimits[0][0], abLimits[0][1])
+
+ uut.setSong(0)
+ uut.loadAbLimits(len(abLimits) - 1)
+ checkLimit(uut, mockPlayer, abLimits[-1][0], abLimits[-1][1])
+
+ uut.setSong(1)
+ checkLimit(uut, mockPlayer, abLimits[-1][0], abLimits[-1][1])
+
+ uut.previousStoredAbLimits()
+ checkLimit(uut, mockPlayer, abLimits[0][0], abLimits[0][1])
+
def test_loadAndSaveSession(prepared_tmp_path):
mockPlayer = MockPlayer()
uut = SoloTool(mockPlayer)