From 328d9ae201cabe8e4189736cd806ecea7b675200 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 15:49:06 +0100 Subject: Added previous/next song buttons to MIDI interface, updated known issues --- playlist_unittest.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'playlist_unittest.py') 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] -- cgit v1.2.3