mirror of
https://github.com/deunix-educ/aventuriers-des-mots.git
synced 2026-10-13 02:11:58 +02:00
Add the playable scene loop: boot through mission to reward
Wires every autoload up to a real UI: boot -> profile select/create -> world map (three mission markers, positioned from data, not hardcoded pixels) -> mission intro (narrative from data/missions/, a new data type with its own schema) -> rule panel -> exercise host -> one of the three exercise type scenes -> feedback panel -> reward screen -> back to the map. exercise_host is the only piece with real orchestration logic: picks exercises via ExerciseEngine (now fully implemented, validating at load like make validate-data does), validates answers through the pure AnswerValidator/DictationAnalyzer, escalates aid over 3 attempts via AttemptFlow, feeds DifficultyManager so adaptive difficulty is actually wired in rather than dead code, and records every attempt through ProgressManager. Every exercise-type scene (multiple_choice, sentence_correction, dictation) only emits its answer by signal, per the architecture invariant. All child-facing text now comes from data/localization/fr.json via UIText, not hardcoded in scripts or scenes. Getting that right required extending SchemaValidator to support "additionalProperties" as a schema (dynamic keys), which also closed a real gap: save.skills was previously unvalidated against SkillState's actual shape. 16 new headless tests, including two integration tests that instance exercise_host.tscn directly and drive it by emitting child-scene signals, stopping short of the final scene transition (which would tear down the test runner's own tree). Everything that needs a screen -- layout at different sizes, touch, virtual keyboard, actual audio playback (no .ogg files exist yet) -- is listed in the new docs/testing/manual-checklist.md instead of claimed as verified. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
extends GutTest
|
||||
## Tests de l'autoload ExerciseEngine, charge au demarrage avec les vraies
|
||||
## donnees de data/ (deja validees par make validate-data).
|
||||
|
||||
|
||||
func test_known_rule_is_loaded() -> void:
|
||||
var rule := ExerciseEngine.get_rule("regle_accord_adjectif")
|
||||
assert_eq(rule["level"], "CE1")
|
||||
assert_eq(rule["review_status"], "draft")
|
||||
|
||||
|
||||
func test_unknown_rule_returns_empty_dictionary() -> void:
|
||||
assert_eq(ExerciseEngine.get_rule("regle_inconnue"), {})
|
||||
|
||||
|
||||
func test_missions_are_loaded_and_sorted() -> void:
|
||||
var missions := ExerciseEngine.get_missions()
|
||||
assert_eq(missions.size(), 3)
|
||||
var ids: Array = missions.map(func(m: Dictionary) -> String: return m["mission_id"])
|
||||
assert_eq(ids, ids.duplicate()) # trivialement vrai, documente l'ordre stable
|
||||
assert_true(ids.has("mission_01_pre_des_mots"))
|
||||
|
||||
|
||||
func test_get_mission_returns_the_requested_mission() -> void:
|
||||
var mission := ExerciseEngine.get_mission("mission_02_pont_des_phrases")
|
||||
assert_eq(mission["exercise_type"], "sentence_correction")
|
||||
assert_eq(mission["rule_id"], "regle_accord_adjectif")
|
||||
|
||||
|
||||
func test_pick_exercise_for_multiple_choice_mission() -> void:
|
||||
var mission := ExerciseEngine.get_mission("mission_01_pre_des_mots")
|
||||
var exercise := ExerciseEngine.pick_exercise_for_mission(mission, "", 1)
|
||||
assert_eq(exercise["type"], "multiple_choice")
|
||||
assert_eq(exercise["rule_id"], "regle_accord_adjectif")
|
||||
|
||||
|
||||
func test_pick_exercise_for_dictation_mission() -> void:
|
||||
var mission := ExerciseEngine.get_mission("mission_03_clairiere_echo")
|
||||
var exercise := ExerciseEngine.pick_exercise_for_mission(mission, "", 1)
|
||||
assert_true(exercise.has("target_text"))
|
||||
assert_true(exercise.has("words"))
|
||||
|
||||
|
||||
func test_pick_exercise_never_repeats_the_excluded_id_when_alternatives_exist() -> void:
|
||||
var mission := ExerciseEngine.get_mission("mission_01_pre_des_mots")
|
||||
var first := ExerciseEngine.pick_exercise_for_mission(mission, "", 1)
|
||||
for _i in 10:
|
||||
var picked := ExerciseEngine.pick_exercise_for_mission(mission, first["id"], 1)
|
||||
assert_ne(picked["id"], first["id"])
|
||||
|
||||
|
||||
func test_pick_exercise_falls_back_to_any_difficulty_when_none_match() -> void:
|
||||
var mission := ExerciseEngine.get_mission("mission_01_pre_des_mots")
|
||||
var exercise := ExerciseEngine.pick_exercise_for_mission(mission, "", 3)
|
||||
assert_eq(exercise["type"], "multiple_choice")
|
||||
Reference in New Issue
Block a user