feat: Kuerzelauswahl im Element-Inspector
- Katalog-Dropdown mit Anzeigenamen je Elementtyp - Freitext-Fallback fuer Kombinationen und Varianten - Suffix-Codes und feste Level werden beim Oeffnen uebernommen - Typwechsel erhaelt nicht passende Codes als Freitext - Whiteboard-Tests auf 241 Assertions erweitert (900 gesamt) - Doku, Findings und Roadmap aktualisiert
This commit is contained in:
parent
57c0b4cb8e
commit
9cb880fca0
9 changed files with 310 additions and 25 deletions
|
|
@ -57,7 +57,7 @@ func _capture() -> void:
|
|||
"CCoSp4",
|
||||
3
|
||||
)
|
||||
controller.add_element_marker(
|
||||
var free_marker := controller.add_element_marker(
|
||||
Vector2(12.0, -8.0),
|
||||
PathSegment.ElementType.SEQUENCE,
|
||||
"ChStSq",
|
||||
|
|
@ -91,6 +91,9 @@ 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] == "free":
|
||||
controller.select_segment(free_marker.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
elif args.size() > 3 and args[3] == "spin":
|
||||
var elapsed := 0.0
|
||||
for segment: PathSegment in controller.get_active_section().segments:
|
||||
|
|
|
|||
|
|
@ -757,6 +757,18 @@ func _run() -> void:
|
|||
controller.element_code_edit.text == "CCoSp",
|
||||
"element dialog is prefilled with the normalized code"
|
||||
)
|
||||
var selected_code_index := controller.element_code_option.selected
|
||||
_check(
|
||||
selected_code_index >= 0
|
||||
and str(
|
||||
controller.element_code_option.get_item_metadata(selected_code_index)
|
||||
) == "CCoSp",
|
||||
"the code dropdown is prefilled with the catalog family"
|
||||
)
|
||||
_check(
|
||||
not controller.element_code_edit.visible,
|
||||
"a catalog code hides the free-text field"
|
||||
)
|
||||
_check(
|
||||
controller.element_level_option.get_item_id(
|
||||
controller.element_level_option.selected
|
||||
|
|
@ -770,7 +782,7 @@ func _run() -> void:
|
|||
"element dialog shows the base value of the current code and level"
|
||||
)
|
||||
|
||||
controller.element_code_edit.text = "CCoSp"
|
||||
_select_dialog_code(controller, "CCoSp")
|
||||
controller.element_level_option.select(
|
||||
controller.element_level_option.get_item_index(2)
|
||||
)
|
||||
|
|
@ -780,15 +792,17 @@ func _run() -> void:
|
|||
"base value follows a family code and level 2"
|
||||
)
|
||||
|
||||
controller.element_code_edit.text = "CCoSp4"
|
||||
controller.update_element_value_hint()
|
||||
_set_dialog_free_text(controller, "CCoSp4")
|
||||
_check(
|
||||
controller.element_code_edit.visible,
|
||||
"free-text mode shows the text field"
|
||||
)
|
||||
_check(
|
||||
controller.element_value_label.text.contains("3,50"),
|
||||
"a canonical suffix wins over the level control"
|
||||
)
|
||||
|
||||
controller.element_code_edit.text = "3X"
|
||||
controller.update_element_value_hint()
|
||||
_set_dialog_free_text(controller, "3X")
|
||||
_check(
|
||||
controller.element_value_label.text.contains("nicht im Katalog"),
|
||||
"unknown codes are marked as not in the catalog"
|
||||
|
|
@ -875,7 +889,7 @@ func _run() -> void:
|
|||
"clearing removes all features"
|
||||
)
|
||||
|
||||
controller.element_code_edit.text = "CCoSp"
|
||||
_select_dialog_code(controller, "CCoSp")
|
||||
controller.element_level_option.select(
|
||||
controller.element_level_option.get_item_index(2)
|
||||
)
|
||||
|
|
@ -1180,6 +1194,33 @@ func _check(condition: bool, message: String) -> void:
|
|||
_failures.append(message)
|
||||
|
||||
|
||||
func _select_dialog_code(
|
||||
controller: WhiteboardController,
|
||||
code: String
|
||||
) -> void:
|
||||
var index := controller._find_code_option_index(code)
|
||||
if index < 0:
|
||||
return
|
||||
controller.element_code_option.select(index)
|
||||
controller.element_code_option.item_selected.emit(index)
|
||||
controller.update_element_value_hint()
|
||||
|
||||
|
||||
func _set_dialog_free_text(
|
||||
controller: WhiteboardController,
|
||||
code: String
|
||||
) -> void:
|
||||
var free_index := controller.element_code_option.get_item_index(
|
||||
WhiteboardController.CODE_OPTION_FREE_ID
|
||||
)
|
||||
if free_index < 0:
|
||||
return
|
||||
controller.element_code_option.select(free_index)
|
||||
controller.element_code_option.item_selected.emit(free_index)
|
||||
controller.element_code_edit.text = code
|
||||
controller.update_element_value_hint()
|
||||
|
||||
|
||||
func _check_approx(actual: float, expected: float, message: String) -> void:
|
||||
_check(
|
||||
absf(actual - expected) <= 0.001,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue