mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 02:11:58 +02:00
Add choice between five background music tracks (0.5.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,23 @@ func test_music_follows_the_level() -> void:
|
||||
assert_eq(SoundCatalog.music_for_level("CE2"), "marsh")
|
||||
|
||||
|
||||
func test_there_are_five_music_tracks_and_an_automatic_choice() -> void:
|
||||
assert_eq(SoundCatalog.MUSIC_IDS.size(), 5)
|
||||
assert_eq(SoundCatalog.music_choices().size(), 6)
|
||||
assert_eq(SoundCatalog.music_choices()[0], SoundCatalog.MUSIC_AUTO)
|
||||
|
||||
|
||||
func test_resolve_music_follows_choice_or_level() -> void:
|
||||
assert_eq(SoundCatalog.resolve_music("night", "CE1"), "night")
|
||||
assert_eq(SoundCatalog.resolve_music("auto", "CE2"), "marsh")
|
||||
assert_eq(SoundCatalog.resolve_music("n_importe_quoi", "CE1"), "forest")
|
||||
|
||||
|
||||
func test_every_music_choice_has_a_label() -> void:
|
||||
for choice in SoundCatalog.music_choices():
|
||||
assert_ne(UIText.get_text("music.%s" % choice), "music.%s" % choice)
|
||||
|
||||
|
||||
func test_audio_manager_plays_without_crashing_and_remembers_music() -> void:
|
||||
AudioManager.play_sfx("success")
|
||||
AudioManager.play_music("marsh")
|
||||
|
||||
@@ -42,3 +42,9 @@ func test_music_and_effects_volumes_are_bounded() -> void:
|
||||
assert_eq(clean["music_volume"], 1.0)
|
||||
assert_eq(clean["effects_volume"], 0.0)
|
||||
assert_eq(AppSettings.sanitize({})["music_volume"], AppSettings.defaults()["music_volume"])
|
||||
|
||||
|
||||
func test_music_track_must_be_a_known_choice() -> void:
|
||||
assert_eq(AppSettings.sanitize({"music_track": "river"})["music_track"], "river")
|
||||
assert_eq(AppSettings.sanitize({"music_track": "../x"})["music_track"], "auto")
|
||||
assert_eq(AppSettings.sanitize({"music_track": 3})["music_track"], "auto")
|
||||
|
||||
Reference in New Issue
Block a user