diff options
Diffstat (limited to 'playlist_unittest.py')
-rw-r--r-- | playlist_unittest.py | 18 |
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 |