From d3be030dd3bc1e737870c676f9179e6fdd106a5d Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 16:37:14 +0100 Subject: Added current index getter to AB controller --- abcontroller_unittest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'abcontroller_unittest.py') diff --git a/abcontroller_unittest.py b/abcontroller_unittest.py index b2b2a67..4f79fd9 100644 --- a/abcontroller_unittest.py +++ b/abcontroller_unittest.py @@ -48,6 +48,7 @@ def test_oneSetOfLimits(): uut.setCurrentSong(song) uut.storeLimits(abLimits.a, abLimits.b) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 checkLimits(uut, abLimits.a, abLimits.b) assert uut.getStoredLimits(song) == [abLimits] @@ -67,6 +68,7 @@ def test_multipleSetsOfLimits(): for i, l in enumerate(abLimits): uut.loadLimits(i) + assert uut.getLoadedIndex() == i checkLimits(uut, l.a, l.b) assert uut.getStoredLimits(song) == abLimits @@ -87,6 +89,7 @@ def test_multipleSongs(): for i, s in enumerate(songs): uut.setCurrentSong(s) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 checkLimits(uut, abLimits[i].a, abLimits[i].b) assert uut.getStoredLimits(s) == [abLimits[i]] @@ -98,6 +101,7 @@ def test_disableAbRepeat(): uut.setCurrentSong(song) uut.storeLimits(abLimits.a, abLimits.b) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 uut.setEnable(False) checkLimits(uut, abLimits.a, abLimits.b, fail=True) @@ -112,6 +116,7 @@ def test_storeLimitsToSpecificSong(): uut.storeLimits(abLimits.a, abLimits.b, song) uut.setCurrentSong(song) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 checkLimits(uut, abLimits.a, abLimits.b) @@ -119,6 +124,7 @@ def test_storeLimitsWithoutCurrentSong(): uut = ABController() uut.storeLimits(abLimits.a, abLimits.b) uut.loadLimits(0) + assert uut.getLoadedIndex() == None checkDefaultLimits(uut) @@ -127,6 +133,7 @@ def test_storeLimitsToSongWithoutCurrentSong(): uut = ABController() uut.storeLimits(abLimits.a, abLimits.b, song) uut.loadLimits(0) + assert uut.getLoadedIndex() == None checkDefaultLimits(uut) @@ -135,6 +142,7 @@ def test_storeLimitsToSongWithoutCurrentSong(): checkDefaultLimits(uut) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 checkLimits(uut, abLimits.a, abLimits.b) @@ -143,10 +151,12 @@ def test_storeLimitsToCurrentSongButDoNotSetCurrentLimits(): uut = ABController() uut.setCurrentSong(song) uut.storeLimits(abLimits.a, abLimits.b) + assert uut.getLoadedIndex() == None checkDefaultLimits(uut) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 checkLimits(uut, abLimits.a, abLimits.b) @@ -183,6 +193,7 @@ def test_setTemporaryLimits(): for l in abLimits: uut.setLimits(l.a, l.b) + assert uut.getLoadedIndex() == None checkLimits(uut, l.a, l.b) def test_setTemporaryLimitsWithCurrentSong(): @@ -197,6 +208,7 @@ def test_setTemporaryLimitsWithCurrentSong(): uut.setCurrentSong(song) uut.storeLimits(songLimits.a, songLimits.b) uut.loadLimits(0) + assert uut.getLoadedIndex() == 0 for l in abLimits: uut.setLimits(l.a, l.b) -- cgit v1.2.3