mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 02:11:58 +02:00
Add settings screen and adult space with progress report and save export/restore (0.4.0)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
extends GutTest
|
||||
## Tests d'AppSettings : valeurs par defaut, nettoyage des fichiers abimes,
|
||||
## conversions volume/echelle de texte.
|
||||
|
||||
|
||||
func test_defaults_are_usable() -> void:
|
||||
var settings := AppSettings.defaults()
|
||||
assert_true(settings["animations_enabled"])
|
||||
assert_eq(AppSettings.text_scale(settings), 1.0)
|
||||
|
||||
|
||||
func test_sanitize_of_non_dictionary_gives_defaults() -> void:
|
||||
assert_eq(AppSettings.sanitize("n'importe quoi"), AppSettings.defaults())
|
||||
assert_eq(AppSettings.sanitize(null), AppSettings.defaults())
|
||||
|
||||
|
||||
func test_sanitize_clamps_out_of_range_values() -> void:
|
||||
var clean := AppSettings.sanitize(
|
||||
{"volume": 7.0, "text_scale_index": 99, "animations_enabled": false}
|
||||
)
|
||||
assert_eq(clean["volume"], 1.0)
|
||||
assert_eq(clean["text_scale_index"], AppSettings.TEXT_SCALES.size() - 1)
|
||||
assert_false(clean["animations_enabled"])
|
||||
assert_eq(AppSettings.sanitize({"volume": -2})["volume"], 0.0)
|
||||
|
||||
|
||||
func test_sanitize_ignores_wrong_types() -> void:
|
||||
var clean := AppSettings.sanitize(
|
||||
{"volume": "fort", "text_scale_index": "grand", "animations_enabled": "oui"}
|
||||
)
|
||||
assert_eq(clean, AppSettings.defaults())
|
||||
|
||||
|
||||
func test_zero_volume_is_real_silence() -> void:
|
||||
assert_eq(AppSettings.volume_db(0.0), -80.0)
|
||||
assert_eq(AppSettings.volume_db(1.0), 0.0)
|
||||
assert_lt(AppSettings.volume_db(0.5), 0.0)
|
||||
Reference in New Issue
Block a user