refactor: Regelsatz als eigenes Objekt (RulesContext)
Etappe 5 der Controller-Zerlegung. Der Regelsatz liegt jetzt in `src/core/rules/rules_context.gd`: Er lädt die Bibliothek, merkt sich die Voreinstellung, wendet eine Saison an und hält die drei Dokumente (catalog, levels, adult). - Der Controller besitzt genau eine Instanz (`_ruleset`) statt sechs Feldern; alle Zugriffe laufen über sie. - `_load_default_rules` und `_apply_rules_for_season` delegieren nur noch. - `RulesContext` ist ohne Szene testbar (Saison laden, wechseln, leeren); eigener Test mit 10 Assertions. Bewusst offen: die drei Statusleisten-Widgets (Saison, Programm, Kategorie) und ihre Sync-Funktionen. Sie sind reine UI und bekommen einen eigenen Node-Schnitt (Etappe 6). Controller: 8.529 -> 8.513 Zeilen (überwiegend Struktur, nicht Zeilen). Suite grün.
This commit is contained in:
parent
7ee5e36af4
commit
ef25c380c9
6 changed files with 212 additions and 116 deletions
|
|
@ -20,6 +20,7 @@ func _init() -> void:
|
|||
_test_season_pair_difference()
|
||||
_test_upgrade_check()
|
||||
_test_season_comparison_text()
|
||||
_test_rules_context()
|
||||
_cleanup()
|
||||
_finish()
|
||||
|
||||
|
|
@ -291,6 +292,30 @@ func _test_season_comparison_text() -> void:
|
|||
)
|
||||
|
||||
|
||||
|
||||
## Der Regelsatz als eigenes Objekt: Saison laden, wechseln, leeren.
|
||||
func _test_rules_context() -> void:
|
||||
var context := RulesContext.new()
|
||||
var package := context.load_default()
|
||||
_check(package != null, "the rules context loads the default season")
|
||||
_check(
|
||||
context.catalog != null and context.levels != null and context.adult != null,
|
||||
"the context exposes the three documents"
|
||||
)
|
||||
_check(
|
||||
context.season_label() == context.library.get_default_season(),
|
||||
"the context reports the default season"
|
||||
)
|
||||
var older := context.apply("2025/26")
|
||||
_check(older != null, "the context switches to an older season")
|
||||
_check(context.season_label() == "2025/26", "the applied season is reported")
|
||||
_check(context.adult != null, "2025/26 has adult rules")
|
||||
_check(context.apply("") == null, "an empty season applies nothing")
|
||||
_check(context.catalog == null, "an empty season clears the documents")
|
||||
context.apply("2030/31")
|
||||
_check(context.package == null, "an unknown season clears the documents")
|
||||
|
||||
|
||||
func _make_pair_routine() -> Routine:
|
||||
var routine := Routine.new()
|
||||
routine.routine_id = "season-pair"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue