aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_integrationtest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-21 22:56:14 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-21 22:56:14 +0100
commit6bdde28f33b3e27349731291ee94c043ec238e4d (patch)
tree1f165897eba916bf9293f2ecf23ec1767ffadb5c /solo_tool_integrationtest.py
parent663970d0165e226147d95fb92c617714dfbd7553 (diff)
AB controller integration test added
Diffstat (limited to 'solo_tool_integrationtest.py')
-rw-r--r--solo_tool_integrationtest.py48
1 files changed, 39 insertions, 9 deletions
diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py
index 561778b..b3a0978 100644
--- a/solo_tool_integrationtest.py
+++ b/solo_tool_integrationtest.py
@@ -43,15 +43,6 @@ class MockPlayer():
def setCurrentSong(self, path):
self.currentSong = path
-def test_addAndSetSong():
- song = "/path/to/song"
- mockPlayer = MockPlayer()
-
- uut = SoloTool(mockPlayer)
-
- uut.addSong(song)
- uut.setSong(0)
-
def test_playerControls():
mockPlayer = MockPlayer()
uut = SoloTool(mockPlayer)
@@ -75,3 +66,42 @@ def test_playerControls():
assert mockPlayer.volume == 1.0
uut.setPlaybackVolume(0.5)
assert mockPlayer.volume == 0.5
+
+def test_addAndSetSong():
+ song = "test.flac"
+ mockPlayer = MockPlayer()
+ uut = SoloTool(mockPlayer)
+
+ uut.addSong(song)
+ assert mockPlayer.currentSong == ""
+
+ uut.setSong(0)
+ assert mockPlayer.currentSong == song
+
+def test_addAndSetAbLimit():
+ song = "test.flac"
+ abLimit = [0.2, 0.4]
+ mockPlayer = MockPlayer()
+ uut = SoloTool(mockPlayer)
+
+ uut.addSong(song)
+ uut.setSong(0)
+
+ uut.addAbLimit(abLimit[0], abLimit[1])
+
+ mockPlayer.position = 0.0
+ uut.tick()
+ assert mockPlayer.position == 0.0
+
+ mockPlayer.position = 0.5
+ uut.tick()
+ assert mockPlayer.position == 0.5
+
+ uut.setAbLimit(0)
+
+ uut.tick()
+ assert mockPlayer.position == 0.2
+
+ uut.tick()
+ assert mockPlayer.position == 0.2
+