refactor: Inhalt der Statusleisten-Auswahl aus dem Controller lösen
Etappe 6 der Controller-Zerlegung. `SeasonPanelModel`
(src/whiteboard/view/season_panel_model.gd) baut den Inhalt der drei
Dropdowns: Beschriftungen, Werte und die passende Auswahl, zurückgegeben als
`{"items": [...], "selected": int}`.
- Der Controller füllt seine OptionButtons nur noch über `_fill_option()`;
Signalverdrahtung und Zustand bleiben bei ihm.
- `_season_tooltip()` entfällt, die Tooltip-Texte kommen ebenfalls aus dem
Modell.
- Test für die Fälle, die vorher nur über die Szene prüfbar waren: "nicht
festgelegt", unbekannte Saison, unbekannte Kategorie (bleibt als "nicht
verfügbar" sichtbar), Programmtyp.
Controller: 8.513 -> 8.459 Zeilen. Kein Verhalten geändert, Suite grün.
Offen bleibt der Node-Schnitt der Widgets; er ändert nur die Verdrahtung und
lohnt erst mit der UI-Gliederung.
This commit is contained in:
parent
ef25c380c9
commit
dbc7e1e484
6 changed files with 195 additions and 93 deletions
|
|
@ -21,6 +21,7 @@ func _init() -> void:
|
|||
_test_upgrade_check()
|
||||
_test_season_comparison_text()
|
||||
_test_rules_context()
|
||||
_test_season_panel_model()
|
||||
_cleanup()
|
||||
_finish()
|
||||
|
||||
|
|
@ -316,6 +317,53 @@ func _test_rules_context() -> void:
|
|||
_check(context.package == null, "an unknown season clears the documents")
|
||||
|
||||
|
||||
|
||||
## Inhalt der Statusleisten-Auswahl: Beschriftung, Zuordnung, Auswahl.
|
||||
func _test_season_panel_model() -> void:
|
||||
var library := RulesLibrary.scan()
|
||||
|
||||
var empty := SeasonPanelModel.season_items("", library)
|
||||
_check(int(empty["selected"]) == 0, "without a season the first entry is selected")
|
||||
_check(str(empty["items"][0]["value"]) == "", "the first entry has no value")
|
||||
|
||||
var current := SeasonPanelModel.season_items("2026/27", library)
|
||||
_check(
|
||||
str(current["items"][int(current["selected"])]["value"]) == "2026/27",
|
||||
"the current season is selected"
|
||||
)
|
||||
var unknown := SeasonPanelModel.season_items("2030/31", library)
|
||||
_check(
|
||||
str(unknown["items"][int(unknown["selected"])]["value"]) == "2030/31",
|
||||
"an unknown season stays visible"
|
||||
)
|
||||
|
||||
var categories: Array = []
|
||||
var package := library.get_package("2026/27")
|
||||
if package != null and package.adult != null:
|
||||
categories.assign(package.adult.get_categories("free"))
|
||||
_check(categories.size() == 5, "the free-skating categories are offered")
|
||||
var known := SeasonPanelModel.category_items("gold", categories)
|
||||
_check(
|
||||
str(known["items"][int(known["selected"])]["value"]) == "gold",
|
||||
"a known category is selected"
|
||||
)
|
||||
var missing := SeasonPanelModel.category_items("legacy", categories)
|
||||
_check(
|
||||
str(missing["items"][int(missing["selected"])]["value"]) == "legacy",
|
||||
"an unknown category stays visible"
|
||||
)
|
||||
_check(
|
||||
str(missing["items"][int(missing["selected"])]["label"]).contains(
|
||||
"nicht verfügbar"
|
||||
),
|
||||
"an unknown category is labelled"
|
||||
)
|
||||
_check(
|
||||
SeasonPanelModel.program_items("artistic")["selected"] == 1,
|
||||
"the artistic programme is selected"
|
||||
)
|
||||
|
||||
|
||||
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