feat: Sections und Ghosting-UI für das Whiteboard hinzufügen
- Abschnittsliste rechts mit Anlegen, Umbenennen, Löschen und Sortieren - aktive Section voll sichtbar, inaktive auf 20 % geghostet - Sequenznummern werden nach Änderungen neu durchnummeriert - Wechsel der Section verwirft die Segmentauswahl - Tests auf 231 Assertions erweitert
This commit is contained in:
parent
c609f065dd
commit
18efa6ae3c
5 changed files with 470 additions and 5 deletions
|
|
@ -340,6 +340,131 @@ func _run() -> void:
|
|||
)
|
||||
controller.set_tool(WhiteboardController.Tool.LINE)
|
||||
|
||||
# Section management and ghosting state.
|
||||
var first_section_id := section.section_id
|
||||
var first_segment_count := section.segments.size()
|
||||
var second_section := controller.add_section()
|
||||
_check(routine.sections.size() == 2, "add_section appends a section")
|
||||
_check(
|
||||
controller.get_active_section() == second_section,
|
||||
"a new section becomes active"
|
||||
)
|
||||
_check(
|
||||
second_section.sequence_order == 1,
|
||||
"new section is ordered after the first"
|
||||
)
|
||||
_check(second_section.segments.is_empty(), "new section starts empty")
|
||||
_check(
|
||||
controller.section_list.get_child_count() == 2,
|
||||
"section list builds one button per section"
|
||||
)
|
||||
_check(
|
||||
controller.rink_canvas.get_active_section_id() == second_section.section_id,
|
||||
"canvas switches to the new active section"
|
||||
)
|
||||
_check(
|
||||
controller.status_label.text.contains("Abschnitt 2"),
|
||||
"status bar shows the new active section"
|
||||
)
|
||||
|
||||
controller.add_segment(
|
||||
Vector2(-5.0, 10.0),
|
||||
Vector2(5.0, 10.0),
|
||||
PathSegment.Direction.FORWARD,
|
||||
PathSegment.Edge.OUTSIDE
|
||||
)
|
||||
_check(
|
||||
second_section.segments.size() == 1,
|
||||
"segments go into the active section"
|
||||
)
|
||||
_check(
|
||||
section.segments.size() == first_segment_count,
|
||||
"other sections keep their segments"
|
||||
)
|
||||
|
||||
controller.set_active_section(first_section_id)
|
||||
_check(
|
||||
controller.get_active_section() == section,
|
||||
"switching sections changes the active section"
|
||||
)
|
||||
_check(
|
||||
controller.get_selected_segment() == null,
|
||||
"switching sections clears the segment selection"
|
||||
)
|
||||
_check(
|
||||
controller.rink_canvas.get_active_section_id() == first_section_id,
|
||||
"canvas follows the switched section"
|
||||
)
|
||||
|
||||
_check(
|
||||
controller.rename_section(first_section_id, "Eröffnung"),
|
||||
"section can be renamed"
|
||||
)
|
||||
_check(
|
||||
section.title == "Eröffnung",
|
||||
"rename updates the section title"
|
||||
)
|
||||
var first_button := controller.section_list.get_child(0) as Button
|
||||
_check(
|
||||
first_button.text.contains("Eröffnung"),
|
||||
"section list shows the new title"
|
||||
)
|
||||
|
||||
_check(
|
||||
controller.move_section(first_section_id, 1),
|
||||
"section can be moved down"
|
||||
)
|
||||
_check(
|
||||
routine.sections[0] == second_section and routine.sections[1] == section,
|
||||
"moving reorders the routine sections"
|
||||
)
|
||||
_check(
|
||||
routine.sections[0].sequence_order == 0
|
||||
and routine.sections[1].sequence_order == 1,
|
||||
"sequence orders are renumbered after moving"
|
||||
)
|
||||
_check(
|
||||
controller.get_active_section() == section,
|
||||
"moving a section keeps it active"
|
||||
)
|
||||
|
||||
_check(
|
||||
controller.move_section(first_section_id, -1),
|
||||
"section can be moved up again"
|
||||
)
|
||||
_check(routine.sections[0] == section, "moving up restores the order")
|
||||
|
||||
_check(
|
||||
controller.delete_section(second_section.section_id),
|
||||
"a non-active section can be deleted"
|
||||
)
|
||||
_check(routine.sections.size() == 1, "delete removes the section")
|
||||
_check(
|
||||
controller.get_active_section() == section,
|
||||
"deleting a non-active section keeps the active one"
|
||||
)
|
||||
_check(
|
||||
not controller.delete_section(first_section_id),
|
||||
"the last remaining section cannot be deleted"
|
||||
)
|
||||
|
||||
var third_section := controller.add_section()
|
||||
_check(
|
||||
controller.delete_section(third_section.section_id),
|
||||
"the active section can be deleted when another exists"
|
||||
)
|
||||
_check(
|
||||
controller.get_active_section() == section,
|
||||
"deleting the active section falls back to the remaining one"
|
||||
)
|
||||
|
||||
controller.rename_edit.text = "Testname"
|
||||
controller.rename_dialog.confirmed.emit()
|
||||
_check(
|
||||
controller.get_active_section().title == "Testname",
|
||||
"rename dialog applies the edited title"
|
||||
)
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
_finish()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue