aboutsummaryrefslogtreecommitdiffstats
path: root/playlist_unittest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-04 14:58:39 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-04 14:58:39 +0100
commit3eed7537f8cc0221a81951b24ef965f6b7f35d6e (patch)
tree11158ffd5c6d4d7403e6bde07308b0c3c4e65999 /playlist_unittest.py
parent3066dbcdd863342d3c9534886434d6e8aaa45367 (diff)
Added song and AB limits change notification
Diffstat (limited to 'playlist_unittest.py')
-rw-r--r--playlist_unittest.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/playlist_unittest.py b/playlist_unittest.py
index 24d3a59..815a05f 100644
--- a/playlist_unittest.py
+++ b/playlist_unittest.py
@@ -14,6 +14,7 @@ def test_addAndSelectOneSong():
assert songAddedByUser == songSetByCallback
assert uut.getCurrentSong() == songAddedByUser
+ assert uut.getCurrentSongIndex() == 0
assert uut.getSongs() == [songAddedByUser]
def test_addTwoSongsAndSelectBoth():
@@ -32,10 +33,12 @@ def test_addTwoSongsAndSelectBoth():
uut.setCurrentSong(0)
assert songAddedByUser[0] == songSetByCallback
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0
uut.setCurrentSong(1)
assert songAddedByUser[1] == songSetByCallback
assert uut.getCurrentSong() == songAddedByUser[1]
+ assert uut.getCurrentSongIndex() == 1
def test_firstAddedSongIsNotSelected():
songAddedByUser = "/path/to/song"
@@ -50,6 +53,7 @@ def test_firstAddedSongIsNotSelected():
assert songSetByCallback == None
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
assert uut.getSongs() == [songAddedByUser]
def test_invalidSongSelection():
@@ -63,15 +67,18 @@ def test_invalidSongSelection():
uut = Playlist(testCallback)
assert songSetByCallback == None
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
uut.setCurrentSong(10)
assert songSetByCallback == None
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
uut.addSong(songAddedByUser)
uut.setCurrentSong(10)
assert songSetByCallback == None
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
assert uut.getSongs() == [songAddedByUser]
def test_clearPlaylist():
@@ -87,11 +94,13 @@ def test_clearPlaylist():
assert uut.getSongs() == songAddedByUser
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0
uut.clear()
assert uut.getSongs() == []
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
def test_nextSong():
songAddedByUser = ["/path/to/song", "/path/to/second/song"]
@@ -100,15 +109,19 @@ def test_nextSong():
for s in songAddedByUser:
uut.addSong(s)
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
uut.nextSong()
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0
uut.nextSong()
assert uut.getCurrentSong() == songAddedByUser[1]
+ assert uut.getCurrentSongIndex() == 1
uut.nextSong()
assert uut.getCurrentSong() == songAddedByUser[1]
+ assert uut.getCurrentSongIndex() == 1
def test_previousSong():
songAddedByUser = ["/path/to/song", "/path/to/second/song"]
@@ -117,14 +130,19 @@ def test_previousSong():
for s in songAddedByUser:
uut.addSong(s)
assert uut.getCurrentSong() == None
+ assert uut.getCurrentSongIndex() == None
uut.previousSong()
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0
uut.previousSong()
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0
uut.setCurrentSong(1)
assert uut.getCurrentSong() == songAddedByUser[1]
+ assert uut.getCurrentSongIndex() == 1
uut.previousSong()
assert uut.getCurrentSong() == songAddedByUser[0]
+ assert uut.getCurrentSongIndex() == 0