From 71593d438dff1a54986c94b469faa31c4581f6c7 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 22 Dec 2021 22:14:43 +0100 Subject: Fixed additive loading issue --- abcontroller_unittest.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'abcontroller_unittest.py') 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 + -- cgit v1.2.3