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:
Sansan committed 2026-10-05 21:09:38 +02:00
1 parent 6fdd7a2b76
commit 05655cf81c
3 files changed
+32

No files matched your search

+12
View File
@@ -214,3 +214,15 @@ func test_closing_settings_with_full_cache_downloads_nothing() -> void:
_close_settings()
assert_int(_server.count("/music/rand")).is_equal(downloads_before)
func test_show_answer_before_first_song_does_not_reveal_next_song() -> void:
_press("ShowAnswerButton")
assert_bool(Playlist.song_object_array[0].is_answered).is_false()
assert_int(_server.count("/music/played?song=-1")).is_equal(0)
await _play_first_song()
assert_str((_window.get_node("VBoxContainer/SoundtrackLabel") as Label).text) \
.is_equal("????????")