aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-27 09:15:17 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-27 09:19:33 +0100
commitf52e40f899567d5d67a4cb2dcd75872ee038aaf8 (patch)
treeb2fe7847b9932837f9753771a7fe268dce2471c5
parentc90623ebcd16070aafc5f8ad4cf76b5aa2b1e49f (diff)
Minor refactoring to AB controller unit tests
-rw-r--r--abcontroller_unittest.py36
-rw-r--r--known-issues2
2 files changed, 14 insertions, 24 deletions
diff --git a/abcontroller_unittest.py b/abcontroller_unittest.py
index 6e6e779..fbe7ae1 100644
--- a/abcontroller_unittest.py
+++ b/abcontroller_unittest.py
@@ -5,15 +5,7 @@ TCase = namedtuple("TCase", ["currentPosition", "requestedPosition"])
AB = namedtuple("AB", ["a", "b"])
abLimits = AB(0.2, 0.4)
-def checkLimits(uut, aLimit, bLimit, fail=False):
- tests = [
- TCase(aLimit - 0.1, None),
- TCase(aLimit, None),
- TCase(bLimit - 0.1, None),
- TCase(bLimit, None),
- TCase(bLimit + 0.1, aLimit if not fail else None)
- ]
-
+def _checkLimits(uut, tests):
requestedPosition = None
def callback(newPosition):
nonlocal requestedPosition
@@ -28,26 +20,23 @@ def checkLimits(uut, aLimit, bLimit, fail=False):
uut._setPositionCallback = originalCallback
+def checkLimits(uut, aLimit, bLimit, fail=False):
+ tests = [
+ TCase(aLimit - 0.1, None),
+ TCase(aLimit, None),
+ TCase(bLimit - 0.1, None),
+ TCase(bLimit, None),
+ TCase(bLimit + 0.1, aLimit if not fail else None)
+ ]
+ _checkLimits(uut, tests)
+
def checkDefaultLimits(uut):
tests = [
TCase(0.0, None),
TCase(0.1, 0.0),
TCase(0.5, 0.0)
]
-
- requestedPosition = None
- def callback(newPosition):
- nonlocal requestedPosition
- requestedPosition = newPosition
-
- originalCallback = uut._setPositionCallback
- uut._setPositionCallback = callback
-
- for t in tests:
- uut.positionChanged(t.currentPosition)
- assert requestedPosition == t.requestedPosition
-
- uut._setPositionCallback = originalCallback
+ _checkLimits(uut, tests)
def test_oneSetOfLimits():
song = "/path/to/song"
@@ -210,7 +199,6 @@ def test_setTemporaryLimitsWithCurrentSong():
uut.setLimits(l.a, l.b)
checkLimits(uut, l.a, l.b)
-
def test_defaultBehaviour():
uut = ABController()
checkDefaultLimits(uut)
diff --git a/known-issues b/known-issues
index 305a1a7..11edbdb 100644
--- a/known-issues
+++ b/known-issues
@@ -1,5 +1,7 @@
* (done) Moving AB sliders does not set AB limit. Instead need to save AB limit and then select it to apply
* (done) Loading session is additive, should clear the state first
* AB limits are displayed as p.u., should be timestamps
+ * Named limits would also be acceptable e.g. first solo, second solo, etc
* (done) Songs are displayed as full path, should be file name or ideally title from metadata
* (done) When switching between songs, AB limit selection is not reset, this means that if the song has only one limit, it is not possible to load it anymore
+* No GUI to control playback speed