aboutsummaryrefslogtreecommitdiffstats
path: root/playlist_unittest.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-01 15:49:06 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-01 15:49:06 +0100
commit328d9ae201cabe8e4189736cd806ecea7b675200 (patch)
tree97f198c5f4b3f3ceff0b39690f703b73d2f69de1 /playlist_unittest.py
parent71f6a49110b6696ca6ac7956baa4edaa1aaa9527 (diff)
Added previous/next song buttons to MIDI interface, updated known issues
Diffstat (limited to 'playlist_unittest.py')
-rw-r--r--playlist_unittest.py35
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]