feat: Legacy-Migration, Axel-Pflicht und Kombinations-Export

- Alte Freitext-Kombinationen werden beim Laden und Uebernehmen in die
  strukturierte Form migriert
- Sprungfolgen verlangen einen Axel als 2. oder 3. Sprung
- Dialoghinweis fuer Folgen (Axel vorhanden/fehlt)
- Export zeigt eine Kombination als einen Marker mit voller Caption
- 100 Model-, 169 Rules-, 66 Validation-, 70 Adult-, 297 Whiteboard-
  und 31 Export-Assertions (1075 gesamt)
- Doku und Findings aktualisiert
This commit is contained in:
torsten 2026-10-31 11:59:13 +01:00
parent 8f1cf1bf44
commit 05dee8da2b
16 changed files with 422 additions and 32 deletions

View file

@ -109,6 +109,22 @@ func _capture() -> void:
controller.jump_second_option.select(index)
controller.jump_second_option.item_selected.emit(index)
break
elif args.size() > 3 and args[3] == "seqwarn":
controller.select_segment(jump.segment_id)
controller.element_button.pressed.emit()
var sequence_kind := controller.jump_kind_option.get_item_index(
PathSegment.JumpKind.SEQUENCE
)
controller.jump_kind_option.select(sequence_kind)
controller.jump_kind_option.item_selected.emit(sequence_kind)
for index: int in range(controller.jump_second_option.item_count):
var metadata: Variant = controller.jump_second_option.get_item_metadata(
index
)
if metadata != null and str(metadata) == "2T":
controller.jump_second_option.select(index)
controller.jump_second_option.item_selected.emit(index)
break
elif args.size() > 3 and args[3] == "adultgold":
controller.set_adult_category("gold")
controller.open_validation_dialog()

View file

@ -38,13 +38,21 @@ func _run() -> void:
"SVG labels get a white outline"
)
_check(
_count(svg, 'class="element-marker"') == 2,
"SVG contains both element markers"
_count(svg, 'class="element-marker"') == 3,
"SVG contains all element markers"
)
_check(
svg.contains('data-element="3Lz"'),
"SVG names the jump marker"
)
_check(
svg.contains('data-element="2T+2S"'),
"SVG treats a combination as one marker"
)
_check(
svg.contains(">2T+2S</text>"),
"SVG draws the combination caption"
)
_check(
svg.contains('data-element="CCoSp4 L3"'),
"SVG names the spin marker with its level"
@ -80,6 +88,20 @@ func _run() -> void:
"section export excludes markers of other sections"
)
var section_two_svg := RoutineSvgExporter.build(routine, "section-2")
_check(
_count(section_two_svg, 'class="element-marker"') == 2,
"the second section exports jump and combination"
)
_check(
section_two_svg.contains('data-element="2T+2S"'),
"the second section exports the combination as one marker"
)
_check(
not section_two_svg.contains('data-element="CCoSp4 L3"'),
"the second section excludes the spin of section one"
)
var scene := WhiteboardScene.instantiate()
var controller := scene as WhiteboardController
if controller != null:
@ -176,7 +198,18 @@ func _make_routine() -> Routine:
"3Lz",
0
)
section_two.segments = [arc, jump_marker]
var combo_marker := _make_marker(
"seg-marker-combo",
Vector2(18.0, 5.0),
PathSegment.ElementType.JUMP,
"2T",
0
)
combo_marker.set_jump_combination(
PathSegment.JumpKind.COMBINATION,
PackedStringArray(["2S"])
)
section_two.segments = [arc, jump_marker, combo_marker]
routine.sections = [section_one, section_two]
return routine

View file

@ -361,6 +361,69 @@ func _test_jump_combinations() -> void:
"an empty combination is rejected"
)
var legacy_combo: PathSegment = PathSegmentModel.new()
legacy_combo.segment_id = "legacy-combo"
legacy_combo.curve = curve
legacy_combo.set_element(
PathSegmentModel.ElementType.JUMP,
"3Lz+2T",
0
)
_check(
legacy_combo.normalize_jump_combination(),
"legacy combination is migrated"
)
_check(
legacy_combo.element_code == "3Lz"
and legacy_combo.jump_kind == PathSegmentModel.JumpKind.COMBINATION
and legacy_combo.combination_jumps == PackedStringArray(["2T"]),
"legacy combination parts are structured"
)
_check(
legacy_combo.get_element_caption() == "3Lz+2T",
"legacy combination keeps its caption"
)
var legacy_sequence: PathSegment = PathSegmentModel.new()
legacy_sequence.segment_id = "legacy-sequence"
legacy_sequence.curve = curve
legacy_sequence.set_element(
PathSegmentModel.ElementType.JUMP,
"3S+2A+SEQ",
0
)
_check(
legacy_sequence.normalize_jump_combination(),
"legacy sequence is migrated"
)
_check(
legacy_sequence.jump_kind == PathSegmentModel.JumpKind.SEQUENCE
and legacy_sequence.combination_jumps == PackedStringArray(["2A"]),
"legacy sequence parts are structured"
)
_check(legacy_sequence.is_valid(), "legacy sequence with Axel is valid")
var sequence_without_axel: PathSegment = PathSegmentModel.new()
sequence_without_axel.segment_id = "sequence-no-axel"
sequence_without_axel.curve = curve
sequence_without_axel.set_element(
PathSegmentModel.ElementType.JUMP,
"3S",
0
)
sequence_without_axel.set_jump_combination(
PathSegmentModel.JumpKind.SEQUENCE,
PackedStringArray(["2T"])
)
_check(
not sequence_without_axel.is_valid()
and _contains_error(
sequence_without_axel.validate(),
"Axel-type second or third jump"
),
"a sequence without an Axel is rejected"
)
func _test_section_aggregation() -> void:
var section: RoutineSection = RoutineSectionModel.new()

View file

@ -34,6 +34,7 @@ func _init() -> void:
_test_missing_code()
_test_feature_selection()
_test_level_mismatch()
_test_jump_sequence()
_test_program_once_features()
_test_missing_rules()
_finish()
@ -324,6 +325,38 @@ func _test_level_mismatch() -> void:
)
func _test_jump_sequence() -> void:
var routine := _make_routine()
var segment := _add_marker(
routine.sections[0],
"sequence",
PathSegment.ElementType.JUMP,
"3S",
0,
PackedStringArray()
)
segment.set_jump_combination(
PathSegment.JumpKind.SEQUENCE,
PackedStringArray(["2T"])
)
var report := _validator.validate_report(routine)
_check(
report.get_check("jump_sequence").warnings == 1,
"a sequence without an Axel is reported"
)
_check(_has_message(report.issues, "Axel als 2. oder 3. Sprung"), "Axel message")
segment.set_jump_combination(
PathSegment.JumpKind.SEQUENCE,
PackedStringArray(["2A"])
)
report = _validator.validate_report(routine)
_check(
report.get_check("jump_sequence").passed == 1,
"a sequence with an Axel passes"
)
func _test_program_once_features() -> void:
var routine := _make_routine()
var section := routine.sections[0]

View file

@ -1447,6 +1447,62 @@ func _run() -> void:
"undo restores the solo jump"
)
var legacy_marker := controller.add_element_marker(
Vector2(0.0, 0.0),
PathSegment.ElementType.JUMP,
"3Lz+2T",
0
)
_check(
legacy_marker.element_code == "3Lz"
and legacy_marker.jump_kind == PathSegment.JumpKind.COMBINATION
and legacy_marker.combination_jumps == PackedStringArray(["2T"]),
"legacy free-text combinations are migrated on insert"
)
_check(
legacy_marker.get_element_caption() == "3Lz+2T",
"the migrated legacy marker keeps its caption"
)
controller.select_segment(combo_marker.segment_id)
controller.element_button.pressed.emit()
var sequence_kind_index := controller.jump_kind_option.get_item_index(
PathSegment.JumpKind.SEQUENCE
)
controller.jump_kind_option.select(sequence_kind_index)
controller.jump_kind_option.item_selected.emit(sequence_kind_index)
_check(
controller.jump_sequence_hint.visible
and controller.jump_sequence_hint.text.contains("mindestens ein Axel"),
"the sequence hint asks for an Axel"
)
_select_option_by_metadata(controller.jump_second_option, "2T")
_check(
controller.jump_sequence_hint.text.contains("mindestens ein Axel"),
"a sequence without an Axel keeps the warning"
)
_select_option_by_metadata(controller.jump_second_option, "2A")
_check(
controller.jump_sequence_hint.text.contains("Axel vorhanden"),
"selecting an Axel satisfies the sequence hint"
)
_check(
controller.element_value_label.text.contains("4,60"),
"the sequence base value sums 2T + 2A"
)
controller.element_dialog.confirmed.emit()
controller.element_dialog.hide()
_check(
combo_marker.get_element_caption() == "2T+2A+SEQ",
"the confirmed marker stores a structured sequence"
)
_check_approx(
controller.get_element_catalog().get_segment_base_value(combo_marker),
4.60,
"the structured sequence has the summed base value"
)
_check(controller.undo(), "the structured sequence can be undone")
controller.help_button.pressed.emit()
_check(controller.help_dialog.visible, "help button opens the help dialog")
_check(