Add Short songs and a choice of how random songs are picked (#30, #51)
Build / test (push) Successful in 1m40s
Build / build (push) Successful in 1m28s

Short songs (#30): a quiz settings switch and a Seconds per song row (30 by
default, 10-120 in steps of 5), saved with the quiz settings. Only part of
each quiz song plays, from a random point 10-60% into it, picked once per song
so restart and repeat play the same part. The progress bar, time and seeking
stay within the part, a hidden beginning counts inside it, and its end counts
as the song ending (repeat, stop or go to the next song as set).

Random songs (#51): the low-played switch in Settings is now a Normal / Low
played / Classic choice, stored as Settings.random_mode and not saved.
fetch_random_song(mode) picks /music/rand, /music/rand/low or
/music/rand/classic.

Closes #30
Closes #51

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Opus 5.5 committed 2026-10-13 21:21:20 +02:00
1 parent 0fc3be79e1
commit a735c515bf
20 files changed
+1325 -327

No files matched your search

@@ -177,3 +177,33 @@ func test_changes_are_saved_at_once() -> void:
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
assert_bool(saved.get_value("quiz", "hide_next_track")).is_false()
assert_int(saved.get_value("quiz", "winning_score")).is_equal(19)
func test_short_songs_shows_its_seconds_and_is_saved() -> void:
Settings.short_songs = false
await _open()
assert_bool(_card.short_song_seconds_row.visible).is_false()
_card.short_songs_button.button_pressed = true
assert_bool(Settings.short_songs).is_true()
assert_bool(_card.short_song_seconds_row.visible).is_true()
var saved: ConfigFile = ConfigFile.new()
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
assert_bool(saved.get_value("quiz", "short_songs")).is_true()
func test_seconds_per_song_go_in_fives_between_ten_and_two_minutes() -> void:
Settings.short_song_seconds = 30
Settings.short_songs = true
await _open()
_card.increase_short_song_seconds_button.pressed.emit()
assert_int(Settings.short_song_seconds).is_equal(35)
assert_str(_card.short_song_seconds_label.text).is_equal("35")
for i: int in 10:
_card.lower_short_song_seconds_button.pressed.emit()
assert_int(Settings.short_song_seconds).is_equal(QuizSettingsCard.MIN_SHORT_SONG_SECONDS)
for i: int in 40:
_card.increase_short_song_seconds_button.pressed.emit()
assert_int(Settings.short_song_seconds).is_equal(QuizSettingsCard.MAX_SHORT_SONG_SECONDS)