Ignore Show answer when no song is playing
Before the first song played, currently_playing_song is -1, so pressing Show answer marked the last song in the list as answered. That is the preloaded song, so its title was shown as soon as it started playing, and played?song=-1 was sent to the server. With an empty playlist it crashed.
This commit is contained in:
1 parent
5a979fca48
commit
ed292877ef
3 files changed
+32
No files matched your search
@@ -182,3 +182,20 @@ func test_current_titles_are_hidden_until_answered() -> void:
|
||||
|
||||
assert_str(Playlist.get_current_soundtrack_title()).is_equal("Soundtrack 0")
|
||||
assert_str(Playlist.get_current_song_title()).is_equal("Song 0")
|
||||
|
||||
|
||||
func test_answering_when_nothing_is_playing_does_nothing() -> void:
|
||||
Settings.add_to_stats = true
|
||||
var songs: Array[SongObject] = _add_songs(2)
|
||||
|
||||
Playlist.song_is_answered()
|
||||
|
||||
assert_bool(songs[0].is_answered).is_false()
|
||||
assert_bool(songs[1].is_answered).is_false()
|
||||
assert_array(_server.requested_paths).is_empty()
|
||||
|
||||
|
||||
func test_answering_with_empty_playlist_does_nothing() -> void:
|
||||
Playlist.song_is_answered()
|
||||
|
||||
assert_array(_server.requested_paths).is_empty()
|
||||
Reference in new issue
Block a user