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

+26 -7
View File
@@ -9,15 +9,33 @@ func before_test() -> void:
_popup = _window.get_node("SettingsPopup")
func test_less_played_toggle_changes_the_setting() -> void:
Settings.use_low_played_mode = false
func test_random_songs_choice_lists_the_three_modes() -> void:
var names: Array[String] = []
for index: int in _popup.random_mode_button.item_count:
names.append(_popup.random_mode_button.get_item_text(index))
assert_array(names).contains_exactly(["Normal", "Low played", "Classic"])
@warning_ignore("unused_parameter")
func test_random_songs_choice_changes_the_setting(mode: Settings.RandomMode,
test_parameters: Array = [[Settings.RandomMode.LOW_PLAYED],
[Settings.RandomMode.CLASSIC], [Settings.RandomMode.NORMAL]]) -> void:
_popup.open()
await _runner.simulate_frames(1)
assert_bool(_popup.low_played_button.button_pressed).is_false()
await _click_at(_popup.low_played_button.get_global_rect().get_center())
_popup.random_mode_button.select(mode)
_popup.random_mode_button.item_selected.emit(mode)
assert_bool(Settings.use_low_played_mode).is_true()
assert_int(Settings.random_mode).is_equal(mode)
func test_random_songs_choice_shows_the_mode_in_use() -> void:
Settings.random_mode = Settings.RandomMode.CLASSIC
_popup.open()
assert_int(_popup.random_mode_button.selected).is_equal(Settings.RandomMode.CLASSIC)
func test_statistics_toggle_changes_the_setting() -> void:
@@ -33,14 +51,15 @@ func test_statistics_toggle_changes_the_setting() -> void:
func test_statistics_settings_are_not_saved_with_the_quiz_settings() -> void:
Settings.add_to_stats = false
Settings.use_low_played_mode = true
Settings.random_mode = Settings.RandomMode.LOW_PLAYED
Settings.save_settings()
var saved: ConfigFile = ConfigFile.new()
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
assert_bool(saved.has_section_key("quiz", "add_to_stats")).is_false()
assert_bool(saved.has_section_key("quiz", "use_low_played_mode")).is_false()
assert_bool(saved.has_section_key("quiz", "random_mode")).is_false()
assert_bool(saved.has_section_key("app", "random_mode")).is_false()
func test_popup_fits_its_rows_and_is_centred() -> void: