refactor: Dialog "Küren verwalten" als eigene Szene

`scenes/routine/routine_manager_panel.tscn` mit `RoutineManagerPanel`:
Das Panel baut die Zeilen (Öffnen/Umbenennen/Löschen) und meldet die Auswahl
über Signale. Die Abläufe bleiben beim Controller, weil sie Dateien, den
aktuellen Pfad und den Sync brauchen.

- Der Controller füllt das Panel nur noch (`open_for`, `refresh`), prüft
  `is_open()` und schließt es über `close()`.
- `manager_tabs` ist aus dem Controller entfernt: `%Name` gilt nur innerhalb
  der Szene, die den Knoten besitzt.
- Neuer eigener Test `run_routine_manager_panel_tests.gd` (13 Assertions):
  Zeilen, Signalnutzlast, Neuaufbau, Leerzustand, Öffnen/Schließen.

Controller: 8.116 -> 8.082 Zeilen. Suite grün (23 Suiten).
This commit is contained in:
torsten 2026-11-13 15:10:51 +01:00
parent a835831201
commit 7c83128d28
11 changed files with 290 additions and 123 deletions

View file

@ -0,0 +1,86 @@
extends SceneTree
## Headless test for `RoutineManagerPanel` on its own: rows and signals, no
## WhiteboardController and no routine files.
##
## Run with:
## godot --headless --path rinkplanner --script res://tests/run_routine_manager_panel_tests.gd
const PanelScene := preload("res://scenes/routine/routine_manager_panel.tscn")
var _assertions: int = 0
var _failures: PackedStringArray = PackedStringArray()
func _init() -> void:
_run.call_deferred()
func _run() -> void:
var panel := PanelScene.instantiate() as RoutineManagerPanel
_check(panel != null, "the panel scene carries its script")
if panel == null:
_finish()
return
root.size = Vector2i(1280, 800)
root.add_child(panel)
await process_frame
_check(not panel.is_open(), "the dialog starts closed")
var opened: Array = []
var renamed: Array = []
var deleted: Array = []
panel.open_requested.connect(func(name: String) -> void: opened.append(name))
panel.rename_requested.connect(func(name: String) -> void: renamed.append(name))
panel.delete_requested.connect(func(name: String) -> void: deleted.append(name))
panel.open_for(["b.json", "a.json"], Vector2i(800, 600))
_check(panel.is_open(), "the dialog opens")
_check(panel.list.get_child_count() == 2, "one row per routine")
var first_row := panel.list.get_child(0) as HBoxContainer
_check(first_row != null and first_row.get_child_count() == 3, "a row has open, rename and delete")
if first_row != null and first_row.get_child_count() == 3:
var open_button := first_row.get_child(0) as Button
_check(open_button.text == "b", "the row shows the name without extension")
open_button.pressed.emit()
(first_row.get_child(1) as Button).pressed.emit()
(first_row.get_child(2) as Button).pressed.emit()
_check(opened == ["b.json"], "the open signal carries the file")
_check(renamed == ["b.json"], "the rename signal carries the file")
_check(deleted == ["b.json"], "the delete signal carries the file")
panel.refresh(["c.json"])
_check(panel.list.get_child_count() == 1, "refreshing replaces the rows")
panel.refresh([])
_check(panel.list.get_child_count() == 1, "an empty list shows one hint")
_check(
(panel.list.get_child(0) as Label).text.contains("Keine"),
"the hint says that no routines are stored"
)
panel.close()
_check(not panel.is_open(), "the dialog closes")
panel.queue_free()
await process_frame
_finish()
func _check(condition: bool, message: String) -> void:
_assertions += 1
if not condition:
_failures.append(message)
func _finish() -> void:
if _failures.is_empty():
print("PASS: %d assertions" % _assertions)
quit(0)
return
for failure: String in _failures:
printerr("FAIL: %s" % failure)
printerr("%d of %d assertions failed" % [_failures.size(), _assertions])
quit(1)

View file

@ -0,0 +1 @@
uid://bkwa2hkn4gob7

View file

@ -784,7 +784,7 @@ func _test_controller_wiring() -> void:
manager_item = index
_check(manager_item >= 0, "das Dateimenü bietet die Kürenverwaltung an")
_check(
controller.routine_manager_dialog != null
controller.routine_manager_panel.dialog != null
and controller.delete_routine_dialog != null,
"Verwaltungs- und Löschdialog sind in der Szene verdrahtet"
)
@ -892,13 +892,13 @@ func _test_controller_wiring() -> void:
)
)
controller._refresh_routine_manager()
controller.routine_manager_dialog.show()
controller.routine_manager_panel.dialog.show()
_check(
controller.routine_manager_dialog.visible,
controller.routine_manager_panel.dialog.visible,
"der Verwaltungsdialog lässt sich öffnen"
)
var manager_row: HBoxContainer = null
for child: Node in controller.routine_manager_list.get_children():
for child: Node in controller.routine_manager_panel.list.get_children():
if child is HBoxContainer:
var open_button := child.get_child(0) as Button
if open_button != null and open_button.text == "sync-test-manager":
@ -995,7 +995,7 @@ func _test_controller_wiring() -> void:
)
)
controller._refresh_routine_manager()
controller.routine_manager_dialog.hide()
controller.routine_manager_panel.dialog.hide()
controller.sync_settings_dialog.hide()
# Ohne Refresh-Token öffnet "Jetzt synchronisieren" die Einstellungen.