feat: Level automatisch aus Features

- Katalog-Pirouetten und -Sequenzen setzen element_level aus dem
  Feature-Ergebnis
- Spruenge fest Base, ChSq fest Level 1
- Level-Regler bei Katalog-Elementen read-only
- Unbekannte Freitext-Codes behalten den manuellen Level
- Undo umfasst Feature- und Levelaenderung gemeinsam
- Whiteboard-Tests auf 253 Assertions erweitert (912 gesamt)
- Doku und Findings aktualisiert
This commit is contained in:
torsten 2026-10-31 10:42:55 +01:00
parent 9cb880fca0
commit 1f5834752e
7 changed files with 256 additions and 55 deletions

View file

@ -720,12 +720,12 @@ func _run() -> void:
"element code and level can be edited"
)
_check(
spin.element_code == "CCoSp" and spin.element_level == 4,
"a canonical level suffix is moved into the level field"
spin.element_code == "CCoSp" and spin.element_level == 0,
"a canonical suffix is normalized; without features the level is Base"
)
_check(
spin.get_element_caption() == "CCoSp L4",
"marker caption includes code and level"
spin.get_element_caption() == "CCoSp",
"marker caption omits the derived Base level"
)
_check_approx(
spin.element_duration_seconds,
@ -745,9 +745,28 @@ func _run() -> void:
_check(controller.redo(), "element edit can be redone")
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
_check(
spin != null and spin.get_element_caption() == "CCoSp L4",
spin != null and spin.element_code == "CCoSp",
"redo restores the element data"
)
controller.select_segment(spin.segment_id)
_check(
controller.set_selected_element_features(
PackedStringArray(
[
"difficult_variation",
"difficult_variation",
"difficult_exit",
"change_of_edge",
]
)
),
"features derive the level"
)
_check(spin.element_level == 4, "four features derive Level 4")
_check(
spin.get_element_caption() == "CCoSp L4",
"marker caption includes the derived level"
)
# Element inspector dialog.
controller.select_segment(spin.segment_id)
@ -775,6 +794,10 @@ func _run() -> void:
) == 4,
"element dialog is prefilled with the normalized level"
)
_check(
controller.element_level_option.disabled,
"the level is read-only for a catalog spin"
)
var catalog := controller.get_element_catalog()
_check(catalog != null and catalog.season == "2025/26", "controller loads the ISU catalog")
_check(
@ -783,13 +806,22 @@ func _run() -> void:
)
_select_dialog_code(controller, "CCoSp")
controller.element_level_option.select(
controller.element_level_option.get_item_index(2)
_check(
controller.set_selected_element_features(
PackedStringArray(["difficult_variation", "difficult_exit"])
),
"features update the derived level"
)
_check(
controller.element_level_option.get_item_id(
controller.element_level_option.selected
) == 2,
"the level dropdown follows two features"
)
controller.update_element_value_hint()
_check(
controller.element_value_label.text.contains("2,50"),
"base value follows a family code and level 2"
"base value follows the derived level 2"
)
_set_dialog_free_text(controller, "CCoSp4")
@ -799,7 +831,7 @@ func _run() -> void:
)
_check(
controller.element_value_label.text.contains("3,50"),
"a canonical suffix wins over the level control"
"a canonical suffix wins over the derived level"
)
_set_dialog_free_text(controller, "3X")
@ -809,21 +841,14 @@ func _run() -> void:
)
# Level features and the derived level.
_check(
controller.set_selected_element_features(
PackedStringArray(["difficult_variation", "difficult_exit"])
),
"features can be assigned to an element"
)
_check(
controller.get_selected_element_features().size() == 2,
"features are stored on the selected segment"
)
_check(
controller.element_feature_hint.text.contains("Features: 2")
and controller.element_feature_hint.text.contains("Level 2")
and controller.element_feature_hint.text.contains("gewählt: Level 4"),
"feature hint shows the derived level and the mismatch"
and controller.element_feature_hint.text.contains("Level 2"),
"feature hint shows the derived level"
)
_check(
not controller.element_features_button.disabled,
@ -860,9 +885,11 @@ func _run() -> void:
controller.get_selected_element_features().size() == 3,
"a second difficult variation can be added"
)
_check(spin.element_level == 3, "three features derive Level 3")
_check(
controller.element_feature_hint.text.contains("Features: 3"),
"feature hint follows the selection"
controller.element_feature_hint.text.contains("Features: 3")
and controller.element_feature_hint.text.contains("Level 3"),
"feature hint follows the selection and level"
)
_check(controller.undo(), "feature selection can be undone")
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
@ -872,6 +899,7 @@ func _run() -> void:
controller.get_selected_element_features().size() == 2,
"undo restores the previous feature selection"
)
_check(spin.element_level == 2, "undo restores the derived level")
_check(controller.redo(), "feature selection can be redone")
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
_check(spin != null, "the spin survives redo")
@ -880,6 +908,7 @@ func _run() -> void:
controller.get_selected_element_features().size() == 3,
"redo restores the feature selection"
)
_check(spin.element_level == 3, "redo restores the derived level")
_check(
controller.set_selected_element_features(PackedStringArray()),
"features can be cleared"
@ -888,16 +917,21 @@ func _run() -> void:
controller.get_selected_element_features().is_empty(),
"clearing removes all features"
)
_check(spin.element_level == 0, "clearing features resets the level to Base")
_select_dialog_code(controller, "CCoSp")
controller.element_level_option.select(
controller.element_level_option.get_item_index(2)
_check(
controller.set_selected_element_features(
PackedStringArray(["difficult_variation", "difficult_exit"])
),
"features restore Level 2"
)
_check(spin.element_level == 2, "the restored level is Level 2")
_select_dialog_code(controller, "CCoSp")
controller.element_duration_spin.value = 6.5
controller.element_dialog.confirmed.emit()
_check(
controller.get_selected_element_caption() == "CCoSp L2",
"element dialog applies code and level"
"element dialog applies the derived level"
)
_check_approx(
controller.get_selected_segment().element_duration_seconds,
@ -977,9 +1011,15 @@ func _run() -> void:
),
"a drawn segment can carry a sequence element"
)
_check(
controller.set_selected_element_features(
PackedStringArray(["variety_of_turns", "both_rotations"])
),
"a sequence range can carry level features"
)
_check(
controller.get_selected_element_caption() == "StSq L2",
"sequence range caption combines code and level"
"sequence range caption combines code and derived level"
)
_check(
controller.set_selected_element(PathSegment.ElementType.NONE, "", 0),