fix: Feature-Auswahl im Element-Dialog pending und live
- Feature-Button folgt dem pending Typ/Kuerzel statt dem gespeicherten Segment; nach der Kuerzelwahl wird er sofort aktiv - Feature-Auswahl aktualisiert Level, Base Value und Hinweis live - Erst Uebernehmen schreibt Typ, Kuerzel, Features, Level und Standzeit in einem Undo-Schritt; Abbrechen verwirft - 259 Whiteboard-Assertions (918 gesamt) - Doku und Findings aktualisiert
This commit is contained in:
parent
1f5834752e
commit
15f7eab9cf
6 changed files with 234 additions and 72 deletions
|
|
@ -91,6 +91,21 @@ func _capture() -> void:
|
|||
controller.element_button.pressed.emit()
|
||||
elif args.size() > 3 and args[3] == "validate":
|
||||
controller.open_validation_dialog()
|
||||
elif args.size() > 3 and args[3] == "pending":
|
||||
controller.select_segment(jump.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
var spin_type_index := controller.element_dialog_type_option.get_item_index(
|
||||
PathSegment.ElementType.SPIN
|
||||
)
|
||||
controller.element_dialog_type_option.select(spin_type_index)
|
||||
controller.element_dialog_type_option.item_selected.emit(spin_type_index)
|
||||
var code_index := controller._find_code_option_index("CCoSp")
|
||||
controller.element_code_option.select(code_index)
|
||||
controller.element_code_option.item_selected.emit(code_index)
|
||||
controller._populate_feature_menu()
|
||||
controller.element_feature_menu.set_item_checked(0, true)
|
||||
controller.element_feature_menu.set_item_checked(6, true)
|
||||
controller._on_feature_menu_hidden()
|
||||
elif args.size() > 3 and args[3] == "free":
|
||||
controller.select_segment(free_marker.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
|
|
|
|||
|
|
@ -839,8 +839,17 @@ func _run() -> void:
|
|||
controller.element_value_label.text.contains("nicht im Katalog"),
|
||||
"unknown codes are marked as not in the catalog"
|
||||
)
|
||||
_check(
|
||||
controller.element_features_button.disabled,
|
||||
"feature button is disabled for an unknown code"
|
||||
)
|
||||
|
||||
# Level features and the derived level.
|
||||
_select_dialog_code(controller, "CCoSp")
|
||||
_check(
|
||||
not controller.element_features_button.disabled,
|
||||
"feature button is enabled for a catalog spin"
|
||||
)
|
||||
_check(
|
||||
controller.get_selected_element_features().size() == 2,
|
||||
"features are stored on the selected segment"
|
||||
|
|
@ -850,10 +859,6 @@ func _run() -> void:
|
|||
and controller.element_feature_hint.text.contains("Level 2"),
|
||||
"feature hint shows the derived level"
|
||||
)
|
||||
_check(
|
||||
not controller.element_features_button.disabled,
|
||||
"feature button is enabled for a spin"
|
||||
)
|
||||
_check(
|
||||
controller._populate_feature_menu(),
|
||||
"feature menu populates for a spin"
|
||||
|
|
@ -882,33 +887,52 @@ func _run() -> void:
|
|||
)
|
||||
controller._on_feature_menu_hidden()
|
||||
_check(
|
||||
controller.get_selected_element_features().size() == 3,
|
||||
"a second difficult variation can be added"
|
||||
controller._dialog_features.size() == 3,
|
||||
"a second difficult variation updates the pending selection"
|
||||
)
|
||||
_check(
|
||||
controller.element_level_option.get_item_id(
|
||||
controller.element_level_option.selected
|
||||
) == 3,
|
||||
"the pending level follows the pending features"
|
||||
)
|
||||
_check(spin.element_level == 3, "three features derive Level 3")
|
||||
_check(
|
||||
controller.element_feature_hint.text.contains("Features: 3")
|
||||
and controller.element_feature_hint.text.contains("Level 3"),
|
||||
"feature hint follows the selection and level"
|
||||
"feature hint follows the pending selection and level"
|
||||
)
|
||||
_check(controller.undo(), "feature selection can be undone")
|
||||
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
|
||||
_check(spin != null, "the spin survives undo")
|
||||
controller.select_segment(spin.segment_id)
|
||||
|
||||
controller.element_duration_spin.value = 6.5
|
||||
controller.element_dialog.confirmed.emit()
|
||||
_check(
|
||||
controller.get_selected_element_features().size() == 2,
|
||||
"undo restores the previous feature selection"
|
||||
controller.get_selected_element_caption() == "CCoSp L3",
|
||||
"element dialog applies features and the derived level"
|
||||
)
|
||||
_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")
|
||||
controller.select_segment(spin.segment_id)
|
||||
_check(
|
||||
controller.get_selected_element_features().size() == 3,
|
||||
"redo restores the feature selection"
|
||||
spin.element_features.size() == 3 and spin.element_level == 3,
|
||||
"features and level are stored together"
|
||||
)
|
||||
_check(spin.element_level == 3, "redo restores the derived level")
|
||||
_check_approx(
|
||||
controller.get_selected_segment().element_duration_seconds,
|
||||
6.5,
|
||||
"element dialog applies the stand time"
|
||||
)
|
||||
|
||||
_check(controller.undo(), "element dialog change can be undone")
|
||||
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
|
||||
_check(
|
||||
spin != null and spin.element_features.size() == 2 and spin.element_level == 2,
|
||||
"undo restores features and the derived level"
|
||||
)
|
||||
controller.select_segment(spin.segment_id)
|
||||
_check(controller.redo(), "element dialog change can be redone")
|
||||
spin = controller.get_active_section().get_segment_by_id(spin.segment_id)
|
||||
_check(
|
||||
spin != null and spin.element_features.size() == 3 and spin.element_level == 3,
|
||||
"redo restores features and the derived level"
|
||||
)
|
||||
controller.select_segment(spin.segment_id)
|
||||
|
||||
_check(
|
||||
controller.set_selected_element_features(PackedStringArray()),
|
||||
"features can be cleared"
|
||||
|
|
@ -918,7 +942,6 @@ func _run() -> void:
|
|||
"clearing removes all features"
|
||||
)
|
||||
_check(spin.element_level == 0, "clearing features resets the level to Base")
|
||||
|
||||
_check(
|
||||
controller.set_selected_element_features(
|
||||
PackedStringArray(["difficult_variation", "difficult_exit"])
|
||||
|
|
@ -926,18 +949,11 @@ func _run() -> void:
|
|||
"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 the derived level"
|
||||
)
|
||||
_check_approx(
|
||||
controller.get_selected_segment().element_duration_seconds,
|
||||
6.5,
|
||||
"element dialog applies the stand time"
|
||||
"the restored caption shows Level 2"
|
||||
)
|
||||
|
||||
controller.element_button.pressed.emit()
|
||||
_check_approx(
|
||||
controller.element_duration_spin.value,
|
||||
|
|
@ -1157,6 +1173,58 @@ func _run() -> void:
|
|||
)
|
||||
DirAccess.remove_absolute(save_as_path)
|
||||
|
||||
# Flow from an empty marker to a derived spin level.
|
||||
controller.message_dialog.hide()
|
||||
controller.element_dialog.hide()
|
||||
var derived_marker := controller.add_element_marker(
|
||||
Vector2(0.0, 0.0),
|
||||
PathSegment.ElementType.JUMP,
|
||||
"",
|
||||
0
|
||||
)
|
||||
_check(derived_marker != null, "an empty marker can be created")
|
||||
controller.select_segment(derived_marker.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
var spin_type_index := controller.element_dialog_type_option.get_item_index(
|
||||
PathSegment.ElementType.SPIN
|
||||
)
|
||||
controller.element_dialog_type_option.select(spin_type_index)
|
||||
controller.element_dialog_type_option.item_selected.emit(spin_type_index)
|
||||
_check(
|
||||
controller.element_features_button.disabled,
|
||||
"feature button waits for a catalog code"
|
||||
)
|
||||
_select_dialog_code(controller, "CCoSp")
|
||||
_check(
|
||||
not controller.element_features_button.disabled,
|
||||
"selecting a catalog code enables the feature button"
|
||||
)
|
||||
_check(
|
||||
controller.element_feature_hint.text.contains("Features: 0")
|
||||
and controller.element_feature_hint.text.contains("Base"),
|
||||
"a catalog spin without features starts at Base"
|
||||
)
|
||||
_check(
|
||||
controller._populate_feature_menu(),
|
||||
"the feature menu opens for the pending spin"
|
||||
)
|
||||
controller.element_feature_menu.set_item_checked(0, true)
|
||||
controller.element_feature_menu.set_item_checked(6, true)
|
||||
controller._on_feature_menu_hidden()
|
||||
_check(
|
||||
controller.element_level_option.get_item_id(
|
||||
controller.element_level_option.selected
|
||||
) == 2,
|
||||
"two pending features raise the pending level to Level 2"
|
||||
)
|
||||
controller.element_dialog.confirmed.emit()
|
||||
controller.element_dialog.hide()
|
||||
_check(
|
||||
derived_marker.element_level == 2
|
||||
and derived_marker.element_features.size() == 2,
|
||||
"the confirmed marker stores features and the derived level"
|
||||
)
|
||||
|
||||
# Validation dialog.
|
||||
controller.new_routine()
|
||||
controller.add_element_marker(
|
||||
|
|
@ -1258,6 +1326,8 @@ func _set_dialog_free_text(
|
|||
controller.element_code_option.select(free_index)
|
||||
controller.element_code_option.item_selected.emit(free_index)
|
||||
controller.element_code_edit.text = code
|
||||
controller._update_level_control_state()
|
||||
controller.update_element_feature_hint()
|
||||
controller.update_element_value_hint()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue