diff options
Diffstat (limited to 'playlist_unittest.py')
-rw-r--r-- | playlist_unittest.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/playlist_unittest.py b/playlist_unittest.py index 9dd3700..24d3a59 100644 --- a/playlist_unittest.py +++ b/playlist_unittest.py @@ -93,3 +93,38 @@ def test_clearPlaylist(): assert uut.getSongs() == [] assert uut.getCurrentSong() == None +def test_nextSong(): + songAddedByUser = ["/path/to/song", "/path/to/second/song"] + + uut = Playlist(lambda index: None) + for s in songAddedByUser: + uut.addSong(s) + assert uut.getCurrentSong() == None + + uut.nextSong() + assert uut.getCurrentSong() == songAddedByUser[0] + + uut.nextSong() + assert uut.getCurrentSong() == songAddedByUser[1] + + uut.nextSong() + assert uut.getCurrentSong() == songAddedByUser[1] + +def test_previousSong(): + songAddedByUser = ["/path/to/song", "/path/to/second/song"] + + uut = Playlist(lambda index: None) + for s in songAddedByUser: + uut.addSong(s) + assert uut.getCurrentSong() == None + + uut.previousSong() + assert uut.getCurrentSong() == songAddedByUser[0] + + uut.previousSong() + assert uut.getCurrentSong() == songAddedByUser[0] + + uut.setCurrentSong(1) + assert uut.getCurrentSong() == songAddedByUser[1] + uut.previousSong() + assert uut.getCurrentSong() == songAddedByUser[0] |