diff --git a/docs/architecture.md b/docs/architecture.md index f3399b5..32de37f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -164,9 +164,11 @@ Datenquellen. bis zu zwei weitere Sprünge, `jump_kind` unterscheidet Einzelsprung, Kombination und Folge. Der Base Value wird aus den Teilen summiert, die Wiederholungs- und Kombinationsprüfung arbeitet auf denselben Teilen. Alte -Freitext-Kürzel wie `3Lz+2T` werden weiterhin als Fallback geparst; neue -Elemente nutzen die strukturierte Auswahl im Element-Dialog. Der Export -verwendet die zusammengesetzte Caption (`3Lz+2T`, `3Lz+2A+SEQ`). +Freitext-Kürzel wie `3Lz+2T` werden beim Laden oder Übernehmen automatisch in +die strukturierte Form überführt; nicht parsebare Sonderfälle bleiben als +Text erhalten. Sprungfolgen verlangen einen Axel als zweiten oder dritten +Sprung. Der Export verwendet die zusammengesetzte Caption (`3Lz+2T`, +`3Lz+2A+SEQ`). ## 4. View- und Controller-Grenzen @@ -385,7 +387,7 @@ Headless, ohne Editor und ohne Display: Aktueller Stand: -- **Model:** 93 Assertions für Rink-Geometrie, Clamping, Segment-Timing, +- **Model:** 100 Assertions für Rink-Geometrie, Clamping, Segment-Timing, Timing-Modi, Template-Metadaten, Element-Marker samt Kürzel-/Level-/Dauer-Grenzen, Schema-Version, Section-Aggregation und Routine-Validierung. - **Regelwerk:** 169 Assertions für Katalog-Metadaten, Saison/Quelle, @@ -395,7 +397,7 @@ Aktueller Stand: schwierige Variationen, Windmills, Level-4-Voraussetzungen, Pflichtfeatures bei Schrittsequenzen, feste Level (`ChSq`, `ChSp`), Feature-Validierung und die Speicherung am Segment. -- **Validierung:** 63 Assertions für unbekannte Kürzel, Typ-Mismatches, +- **Validierung:** 66 Assertions für unbekannte Kürzel, Typ-Mismatches, nicht verfügbare Level, Sprung-/ChSq-Sonderfälle, Feature-Fehler, Pflichtfeatures, Level-Abweichungen, programmweite Einmal-Features, die Prüfstatistik je Kategorie und die Basiswert-Summe. @@ -404,7 +406,7 @@ Aktueller Stand: - **Adult-Kategorien:** 70 Assertions für Metadaten, Gold/Silver/Bronze, Sprungerlaubnis, Level-Caps, Pflichtelemente, Wiederholungen, Kombinationen, Dauer und unbekannte Kategorien. -- **Whiteboard:** 288 Assertions für Controller-Verdrahtung, Segmenterzeugung, +- **Whiteboard:** 297 Assertions für Controller-Verdrahtung, Segmenterzeugung, Linien-/Bogenpfade, Klemmen an der Bande, Auswahl, Griff- und Richtungs-/Kanten-Bearbeitung, Segmentlöschung, Element-Marker (Setzen, Typwechsel, Inspector inkl. Kürzelauswahl, Standzeit, Base-Value- und @@ -423,9 +425,9 @@ Aktueller Stand: Elementen und die Rotation des Markers in einer Pirouette. - **Timing:** 41 Assertions für Dauer-/Tempo-Kopplung, Level-Presets, Kalibrierung, Undo, Persistenz und Schema-1-Migration. -- **Export:** 26 Assertions für SVG-Struktur, Titel-Escaping, Segment-Labels, - Element-Marker, Section-Filter, Segmentfarben/-strichelung und das Schreiben - der Exportdatei. +- **Export:** 31 Assertions für SVG-Struktur, Titel-Escaping, Segment-Labels, + Element-Marker, strukturierte Sprungkombinationen, Section-Filter, + Segmentfarben/-strichelung und das Schreiben der Exportdatei. - **Touch/Tablet:** 28 Assertions für Ein-Finger-Zeichnen, Zwei-Finger-Pan, Pinch-Zoom, Tipp-Auswahl, Griff-Bearbeitung, Element-Marker per Tipp, Abbruch bei zweitem Finger, diff --git a/docs/findings-2026-10-31-adult-2026-27.md b/docs/findings-2026-10-31-adult-2026-27.md index 6517f22..574d27c 100644 --- a/docs/findings-2026-10-31-adult-2026-27.md +++ b/docs/findings-2026-10-31-adult-2026-27.md @@ -20,7 +20,7 @@ und Bronze. | Wiederholungen | max. 2-mal pro gelistetem Sprung, inkl. Kombinations-Teile | | Kombinationen | Anzahl, Folgen und max. Sprünge pro Kombination | | Punktschätzung | Basiswert + PCS-Annahme + Sturzabzug | -| Tests | 1051 Assertions gesamt, `./tools/test.sh` grün | +| Tests | 1075 Assertions gesamt, `./tools/test.sh` grün | ## Datenupdate 2026/27 @@ -150,10 +150,10 @@ Geschätzte Summe: 49,55 - **Adult:** 70 Assertions (Metadaten, Kategorien, Sprungerlaubnis, Gold-Limits, gültige Gold-Kür, Wiederholungen, Kombinationen, Dauer, strukturierte Kombinationen und unbekannte Kategorie). -- **Whiteboard:** 288 Assertions (Kategorie-Auswahl, Prüfdialog, Gold-Befunde, - Punktschätzung, inline änderbare Annahmen, Hilfe-Dialog und strukturierte - Sprungkombination). -- **Gesamt:** 1051 Assertions. +- **Whiteboard:** 297 Assertions (Kategorie-Auswahl, Prüfdialog, Gold-Befunde, + Punktschätzung, inline änderbare Annahmen, Hilfe-Dialog, strukturierte + Sprungkombinationen, Migration und Folge-Hinweis). +- **Gesamt:** 1075 Assertions. Visuell geprüft bei 1400 × 876 und 1024 × 768: Kategorie-Dropdown, Kopfzeile `Kategorie: Gold · 2:50 ±10 s`, Basiswert und Gold-Befunde. diff --git a/docs/findings-2026-10-31-sprungkombinationen.md b/docs/findings-2026-10-31-sprungkombinationen.md index 3e663f0..6ca74b6 100644 --- a/docs/findings-2026-10-31-sprungkombinationen.md +++ b/docs/findings-2026-10-31-sprungkombinationen.md @@ -14,8 +14,10 @@ geparst. Jetzt sind sie Teil des Modells und der Bedienung. | Caption | `3Lz+2T`, Folge mit `+SEQ` | | Bedienung | Sprungkombination im Element-Dialog | | Prüfung | Wiederholungen/Kombinationen auf strukturierten Teilen | -| Legacy | Freitext-Codes bleiben als Fallback lesbar | -| Tests | 1051 Assertions gesamt, `./tools/test.sh` grün | +| Legacy | Freitext-Codes werden beim Laden/Übernehmen migriert | +| Folge | Axel als 2./3. Sprung verpflichtend, Dialoghinweis | +| Export | Kombination erscheint als ein Marker mit voller Caption | +| Tests | 1075 Assertions gesamt, `./tools/test.sh` grün | ## Modell @@ -67,17 +69,23 @@ Level-/Feature-Bereiche ausgeblendet. ## Tests -- **Model:** 93 Assertions (Kombination, Folge, Grenzen, Typwechsel). +- **Model:** 100 Assertions (Kombination, Folge, Grenzen, Typwechsel, + Legacy-Migration, Axel-Pflicht). - **Regelwerk:** 169 Assertions (strukturierte und Legacy-Base-Values). - **Adult:** 70 Assertions (strukturierte Wiederholungen/Kombinationen). -- **Whiteboard:** 288 Assertions (Dialog, Base-Value-Summe, Undo). -- **Gesamt:** 1051 Assertions. +- **Whiteboard:** 297 Assertions (Dialog, Base-Value-Summe, Undo, + Legacy-Migration, Folge-Hinweis). +- **Export:** 31 Assertions (Kombination als ein Marker inkl. Caption). +- **Gesamt:** 1075 Assertions. Visuell geprüft bei 1400 × 876 und 1024 × 768 mit `3Lz+2T` und Base Value 7,20. ## Offen -- Migration alter Freitext-Kombinationen in die strukturierte Form -- Strukturierte Sprungfolgen mit automatischer Axel-Prüfung -- Kombinationen in Export und Timeline noch stärker als Einheit darstellen +- Nicht parsebare Legacy-Sonderfälle bleiben Freitext und werden von der + Validierung gemeldet. +- Die Axel-Prüfung bewertet den Code, nicht die tatsächliche Verbindung im + Laufweg. +- Die Timeline zeigt weiterhin einen Marker für das gesamte Element; eine + eigene Kombinationsdarstellung kann folgen. diff --git a/docs/isu-rules.md b/docs/isu-rules.md index e35a235..5d5ac42 100644 --- a/docs/isu-rules.md +++ b/docs/isu-rules.md @@ -217,6 +217,7 @@ Abschnitt und Segment. Geprüft werden: - unbekannte Features, zu häufige Features und fehlende Pflichtfeatures - Abweichungen zwischen Feature-Ergebnis und gewähltem Level - Features, die laut Daten nur einmal pro Programm zählen +- Sprungfolgen ohne Axel als zweiten oder dritten Sprung - bei gewählter Adult-Kategorie: Sprunganzahl, erlaubte Sprünge, Pirouetten-/Sequenzanzahl, Level-Caps und Pflichtelemente @@ -284,6 +285,5 @@ mit ausgeliefert. ## Nächste Ausbaustufen - Max. zwei Features pro Fuß und Feature-Positionsregeln -- Altdaten-Migration von Freitext-Kombinationen in die strukturierte Form - GOE-Tabellen und `V`-/Unterrotations-Varianten - Vorschlagsliste im Inspector direkt aus `suggest()` diff --git a/docs/manual.md b/docs/manual.md index 9ae5be1..523c088 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -43,11 +43,12 @@ Sprungkombinationen und -folgen sind strukturiert: - **Kombination** – bis zu zwei weitere Sprünge, z. B. `3Lz+2T` - **Folge (SEQ)** – bis zu zwei weitere Sprünge, Anzeige mit `+SEQ` - Die Base Values der einzelnen Sprünge werden summiert. +- Eine **Folge** braucht einen Axel (1A/2A/3A) als zweiten oder dritten + Sprung; der Dialog zeigt einen entsprechenden Hinweis. - Wiederholungen und Kombinationsgrenzen werden anhand der strukturierten Teile geprüft, nicht mehr aus dem Kürzeltext geraten. - Alte Freitext-Kürzel wie `3Lz+2T` werden weiterhin als Fallback gelesen und - für Prüfung und Base Value geparst. Neu angelegte Elemente sollten die - strukturierte Auswahl verwenden. + beim Laden oder Übernehmen automatisch in die strukturierte Form überführt. ## Level aus Features @@ -156,8 +157,8 @@ Durchschnitt sollte zum aktuellen Leistungsstand passen, nicht zum Wunschziel. ## Grenzen - Features und PCS sind Eingaben, keine Messungen aus der Zeichnung. -- Alte Freitext-Kombinationen werden noch geparst; neue Elemente nutzen die - strukturierte Auswahl im Element-Dialog. +- Alte Freitext-Kombinationen werden beim Laden/Übernehmen migriert; nicht + parsebare Sonderfälle bleiben als Text erhalten. - Max. zwei Features pro Fuß und Feature-Positionsregeln sind offen. - Adult-spezifische Sonderfälle außerhalb des Announcements 2026/27 sind nicht abgebildet. diff --git a/docs/roadmap.md b/docs/roadmap.md index 422f7cb..c33afd0 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -134,7 +134,8 @@ Voraussetzung für Phase 1. - [x] Wiederholungsregeln (max. 2-mal pro gelistetem Sprung) - [x] Kombinationsgrenzen (Anzahl, Folgen, max. Sprünge pro Kombination) - [x] Strukturierte Sprungkombinationen/-folgen (erster Sprung + bis zu zwei weitere) -- [ ] Altdaten-Migration von Freitext-Kombinationen in die strukturierte Form +- [x] Altdaten-Migration von Freitext-Kombinationen in die strukturierte Form +- [x] Axel-Pflicht für Sprungfolgen (Modell, Validator und Dialoghinweis) - [x] Dauerprüfung gegen die Kategorie-Zeit - [x] PCS und Sturzabzüge in der Punktschätzung (mit Annahmen) - [x] In-App-Hilfe „Hilfe & Annahmen“ und `docs/manual.md` diff --git a/rinkplanner/scenes/whiteboard/whiteboard.tscn b/rinkplanner/scenes/whiteboard/whiteboard.tscn index 7037072..91049c5 100644 --- a/rinkplanner/scenes/whiteboard/whiteboard.tscn +++ b/rinkplanner/scenes/whiteboard/whiteboard.tscn @@ -684,6 +684,15 @@ custom_minimum_size = Vector2(0, 48) layout_mode = 2 theme_override_font_sizes/font_size = 16 +[node name="JumpSequenceHint" type="Label" parent="ElementDialog/ElementBox/JumpCombinationBox"] +unique_name_in_owner = true +visible = false +custom_minimum_size = Vector2(480, 0) +layout_mode = 2 +theme_override_colors/font_color = Color(0.74902, 0.803922, 0.878431, 1) +theme_override_font_sizes/font_size = 13 +autowrap_mode = 3 + [node name="ElementFeaturesButton" type="Button" parent="ElementDialog/ElementBox"] unique_name_in_owner = true custom_minimum_size = Vector2(0, 56) diff --git a/rinkplanner/src/core/model/path_segment.gd b/rinkplanner/src/core/model/path_segment.gd index fa500bd..caf0b27 100644 --- a/rinkplanner/src/core/model/path_segment.gd +++ b/rinkplanner/src/core/model/path_segment.gd @@ -231,6 +231,77 @@ func get_jump_parts() -> PackedStringArray: return parts +## Parses a legacy free-text jump combination like "3Lz+2T+SEQ" without +## mutating the segment. Returns valid=false when the code is not a clean +## combination of listed jumps. +static func parse_legacy_combination(code: String) -> Dictionary: + var result := { + "valid": false, + "first": "", + "extras": PackedStringArray(), + "kind": JumpKind.SOLO, + } + var cleaned := code.strip_edges() + if not cleaned.contains("+"): + return result + + var listed := PackedStringArray() + var has_sequence := false + for raw: String in cleaned.split("+"): + var token := raw.strip_edges() + var upper := token.to_upper() + if token.is_empty(): + continue + if upper == "SEQ" or upper == "S": + has_sequence = true + continue + if token.length() < 2 or not token.substr(0, 1).is_valid_int(): + continue + if token.substr(1).to_lower() == "eu": + continue + listed.append(token) + + if listed.size() < 2 or listed.size() > JUMP_MAX_PARTS: + return result + + var extras := PackedStringArray() + for index: int in range(1, listed.size()): + extras.append(listed[index]) + result["valid"] = true + result["first"] = listed[0] + result["extras"] = extras + result["kind"] = ( + JumpKind.SEQUENCE if has_sequence else JumpKind.COMBINATION + ) + return result + + +## Converts a stored legacy free-text combination into the structured fields. +## Returns true when the segment changed. +func normalize_jump_combination() -> bool: + if ( + element_type != ElementType.JUMP + or not combination_jumps.is_empty() + or not element_code.contains("+") + ): + return false + var parsed := parse_legacy_combination(element_code) + if not bool(parsed.get("valid", false)): + return false + element_code = str(parsed.get("first", "")) + jump_kind = parsed.get("kind", JumpKind.SOLO) + combination_jumps = parsed.get("extras", PackedStringArray()) + return true + + +static func is_axel(code: String) -> bool: + var cleaned := code.strip_edges() + return ( + cleaned.length() >= 2 + and cleaned.substr(1).to_lower() == "a" + ) + + ## Short caption for the canvas and exports, e.g. "3Lz" or "CCoSp4 L3". func get_element_caption() -> String: var code := element_code.strip_edges() @@ -327,6 +398,16 @@ func validate() -> PackedStringArray: errors.append( "a jump combination must not exceed %d jumps" % JUMP_MAX_PARTS ) + if jump_kind == JumpKind.SEQUENCE: + var has_axel := false + for extra: String in combination_jumps: + if is_axel(extra): + has_axel = true + break + if not has_axel: + errors.append( + "a jump sequence needs an Axel-type second or third jump" + ) if ( element_duration_seconds < 0.0 or element_duration_seconds > ELEMENT_MAX_DURATION_SECONDS diff --git a/rinkplanner/src/core/rules/routine_validator.gd b/rinkplanner/src/core/rules/routine_validator.gd index 1834b59..51b5d87 100644 --- a/rinkplanner/src/core/rules/routine_validator.gd +++ b/rinkplanner/src/core/rules/routine_validator.gd @@ -526,6 +526,7 @@ func _validate_segment( _pass(report, "level") _validate_features(segment, code, section_id, report) + _validate_jump_sequence(segment, section_id, report) func _validate_features( @@ -654,6 +655,40 @@ func _validate_features( _fail(report, "level_features", false) +func _validate_jump_sequence( + segment: PathSegment, + section_id: String, + report: ValidationReport +) -> void: + if ( + segment.element_type != PathSegment.ElementType.JUMP + or segment.jump_kind != PathSegment.JumpKind.SEQUENCE + ): + return + var parts := _segment_jump_parts(segment) + if parts.size() < 2: + return + var has_axel := false + for index: int in range(1, parts.size()): + if AdultCategoryRules.Category.jump_type( + parts[index] + ).to_lower() == "a": + has_axel = true + break + if has_axel: + _pass(report, "jump_sequence") + return + _append( + report, + ValidationIssue.Severity.WARNING, + "Folge „%s“ braucht einen Axel als 2. oder 3. Sprung." + % segment.get_element_caption(), + section_id, + segment.segment_id + ) + _fail(report, "jump_sequence", false) + + ## Features marked as once-per-program may only count in the first element ## that uses them. The technical rule additionally depends on categories and ## positions; the data flag is the simplified part that can be checked today. diff --git a/rinkplanner/src/core/rules/validation_report.gd b/rinkplanner/src/core/rules/validation_report.gd index 682ad4d..7b21aa9 100644 --- a/rinkplanner/src/core/rules/validation_report.gd +++ b/rinkplanner/src/core/rules/validation_report.gd @@ -13,6 +13,7 @@ const CHECK_ORDER := [ "required", "level_features", "once", + "jump_sequence", "category", "category_jumps", "category_jump_types", @@ -34,6 +35,7 @@ const CHECK_LABELS := { "required": "Pflichtfeatures", "level_features": "Level aus Features", "once": "Einmal pro Programm", + "jump_sequence": "Sprungfolge", "category": "Kategorie", "category_jumps": "Kategorie: Sprunganzahl", "category_jump_types": "Kategorie: erlaubte Sprünge", diff --git a/rinkplanner/src/whiteboard/ctrl/whiteboard_controller.gd b/rinkplanner/src/whiteboard/ctrl/whiteboard_controller.gd index 5ca4d66..58fcd03 100644 --- a/rinkplanner/src/whiteboard/ctrl/whiteboard_controller.gd +++ b/rinkplanner/src/whiteboard/ctrl/whiteboard_controller.gd @@ -123,6 +123,7 @@ const COMPACT_LAYOUT_WIDTH := 1280.0 @onready var jump_kind_option: OptionButton = %JumpKindOption @onready var jump_second_option: OptionButton = %JumpSecondOption @onready var jump_third_option: OptionButton = %JumpThirdOption +@onready var jump_sequence_hint: Label = %JumpSequenceHint @onready var element_features_button: Button = %ElementFeaturesButton @onready var element_feature_hint: Label = %ElementFeatureHint @onready var element_feature_menu: PopupMenu = %ElementFeatureMenu @@ -721,6 +722,8 @@ func _validation_skip_reason(check_code: String) -> String: return "keine Features gesetzt" "once": return "keine Einmal-Features gesetzt" + "jump_sequence": + return "keine Sprungfolge" return "keine passenden Daten" @@ -819,7 +822,11 @@ func _help_content() -> String: + "werden summiert." ) lines.append( - "- Alte Freitext-Kombinationen wie 3Lz+2T bleiben als Fallback lesbar." + "- Eine Folge braucht einen Axel (1A/2A/3A) als 2. oder 3. Sprung." + ) + lines.append( + "- Alte Freitext-Kombinationen werden beim Laden oder Übernehmen " + + "automatisch in die strukturierte Form überführt." ) lines.append( "- ChSq (Choreo-Sequenz) und ChSp (Choreographic Spin) sind fest " @@ -1472,6 +1479,7 @@ func _on_jump_extra_selected(_index: int) -> void: if not code.is_empty(): extras.append(code) _dialog_combination_jumps = extras + _update_jump_controls() update_element_value_hint() @@ -1489,6 +1497,25 @@ func _update_jump_controls() -> void: ) jump_second_option.visible = show_extras jump_third_option.visible = show_extras + var is_sequence := ( + is_jump and _dialog_jump_kind == PathSegment.JumpKind.SEQUENCE + ) + jump_sequence_hint.visible = is_sequence + if is_sequence: + var has_axel := false + for extra: String in _dialog_combination_jumps: + if PathSegment.is_axel(extra): + has_axel = true + break + jump_sequence_hint.text = ( + "Folge: Axel vorhanden." + if has_axel + else "Folge: mindestens ein Axel (1A/2A/3A) als 2. oder 3. Sprung." + ) + jump_sequence_hint.add_theme_color_override( + "font_color", + Color("#22c55e") if has_axel else Color("#f59e0b") + ) func _select_jump_extra(option: OptionButton, code: String) -> void: @@ -1627,6 +1654,22 @@ func set_selected_element_with_features( clamped = int(normalized["level"]) if _is_derived_level(type, cleaned): clamped = _derived_level(type, cleaned, cleaned_features) + if ( + type == PathSegment.ElementType.JUMP + and cleaned_combination.is_empty() + and cleaned.contains("+") + ): + var parsed := PathSegment.parse_legacy_combination(cleaned) + if bool(parsed.get("valid", false)): + cleaned = str(parsed.get("first", cleaned)) + cleaned_kind = parsed.get( + "kind", + PathSegment.JumpKind.SOLO + ) + cleaned_combination = parsed.get( + "extras", + PackedStringArray() + ) var clamped_duration := -1.0 if type == PathSegment.ElementType.NONE: cleaned = "" @@ -1706,6 +1749,7 @@ func add_element_marker( str(normalized["code"]), int(normalized["level"]) ) + segment.normalize_jump_combination() if _is_derived_level(type, segment.element_code): segment.element_level = _derived_level( type, @@ -3210,6 +3254,12 @@ func _install_routine( _routine = routine if _routine.rink == null or not _routine.rink.is_valid(): _routine.rink = RinkDimensions.new() + for section: RoutineSection in _routine.sections: + if section == null: + continue + for segment: PathSegment in section.segments: + if segment != null: + segment.normalize_jump_combination() _sync_adult_category_option() var valid_sections: Array[RoutineSection] = [] diff --git a/rinkplanner/tests/manual/capture_elements.gd b/rinkplanner/tests/manual/capture_elements.gd index 3bec43e..920345a 100644 --- a/rinkplanner/tests/manual/capture_elements.gd +++ b/rinkplanner/tests/manual/capture_elements.gd @@ -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() diff --git a/rinkplanner/tests/run_export_tests.gd b/rinkplanner/tests/run_export_tests.gd index ede5fde..9e9040f 100644 --- a/rinkplanner/tests/run_export_tests.gd +++ b/rinkplanner/tests/run_export_tests.gd @@ -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"), + "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 diff --git a/rinkplanner/tests/run_model_tests.gd b/rinkplanner/tests/run_model_tests.gd index 3115e93..254f01e 100644 --- a/rinkplanner/tests/run_model_tests.gd +++ b/rinkplanner/tests/run_model_tests.gd @@ -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() diff --git a/rinkplanner/tests/run_validation_tests.gd b/rinkplanner/tests/run_validation_tests.gd index 071291b..d3227b4 100644 --- a/rinkplanner/tests/run_validation_tests.gd +++ b/rinkplanner/tests/run_validation_tests.gd @@ -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] diff --git a/rinkplanner/tests/run_whiteboard_tests.gd b/rinkplanner/tests/run_whiteboard_tests.gd index 3d942a7..eaf2c24 100644 --- a/rinkplanner/tests/run_whiteboard_tests.gd +++ b/rinkplanner/tests/run_whiteboard_tests.gd @@ -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(