aboutsummaryrefslogtreecommitdiffstats
path: root/abcontroller_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'abcontroller_unittest.py')
-rw-r--r--abcontroller_unittest.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/abcontroller_unittest.py b/abcontroller_unittest.py
index ea377b7..8eb401a 100644
--- a/abcontroller_unittest.py
+++ b/abcontroller_unittest.py
@@ -19,14 +19,14 @@ def checkLimits(uut, aLimit, bLimit, fail=False):
nonlocal requestedPosition
requestedPosition = newPosition
- originalCallback = uut.setPositionCallback
- uut.setPositionCallback = callback
+ originalCallback = uut._setPositionCallback
+ uut._setPositionCallback = callback
for t in tests:
uut.positionChanged(t.currentPosition)
assert requestedPosition == t.requestedPosition
- uut.setPositionCallback = originalCallback
+ uut._setPositionCallback = originalCallback
def test_oneSetOfLimits():
song = "/path/to/song"
@@ -141,3 +141,22 @@ def test_getLimitsOfInexistentSong():
song = "/path/to/song"
uut = ABController()
assert uut.getLimits(song) == None
+
+def test_clearAbController():
+ songsWithLimits = [
+ ("/path/to/song", AB(0.2, 0.4)),
+ ("/path/to/another/song", AB(0.3, 0.5))
+ ]
+
+ uut = ABController()
+ for s in songsWithLimits:
+ uut.addLimits(s[1].a, s[1].b, s[0])
+
+ for i, s in enumerate(songsWithLimits):
+ assert uut.getLimits(s[0]) == [s[1]]
+
+ uut.clear()
+
+ for i, s in enumerate(songsWithLimits):
+ assert uut.getLimits(s[0]) == None
+