feat: strukturierte Sprungkombinationen
- PathSegment mit jump_kind und combination_jumps (max. 3 Sprünge) - Base Value summiert strukturierte Kombinations-/Folgeteile - Element-Dialog mit Art, zweitem und drittem Sprung; Level/Features bei Spruengen ausgeblendet - Validator nutzt strukturierte Teile fuer Wiederholungen und Kombinationen - Legacy-Freitext bleibt als Fallback lesbar - 93 Model-, 169 Rules-, 70 Adult- und 288 Whiteboard-Assertions (1051 gesamt) - Doku, Anleitung und Findings aktualisiert
This commit is contained in:
parent
e1f543cb66
commit
8f1cf1bf44
16 changed files with 766 additions and 46 deletions
|
|
@ -93,6 +93,22 @@ func _capture() -> void:
|
|||
controller.open_validation_dialog()
|
||||
elif args.size() > 3 and args[3] == "help":
|
||||
controller.help_button.pressed.emit()
|
||||
elif args.size() > 3 and args[3] == "combo":
|
||||
controller.select_segment(jump.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
var combo_kind := controller.jump_kind_option.get_item_index(
|
||||
PathSegment.JumpKind.COMBINATION
|
||||
)
|
||||
controller.jump_kind_option.select(combo_kind)
|
||||
controller.jump_kind_option.item_selected.emit(combo_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()
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ func _init() -> void:
|
|||
_test_gold_limits()
|
||||
_test_valid_gold()
|
||||
_test_duration_and_repetitions()
|
||||
_test_structured_jump()
|
||||
_test_unknown_category()
|
||||
_finish()
|
||||
|
||||
|
|
@ -187,8 +188,26 @@ func _test_valid_gold() -> void:
|
|||
func _test_duration_and_repetitions() -> void:
|
||||
var routine := _make_routine("gold")
|
||||
var section := routine.sections[0]
|
||||
for code: String in ["2T", "2T", "2T", "2S+2S", "2Lo+2Lo", "2T+2T"]:
|
||||
for code: String in ["2T", "2T", "2T"]:
|
||||
_add_jump(section, code)
|
||||
_add_jump(
|
||||
section,
|
||||
"2S",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2S"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"2Lo",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2Lo"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"2T",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_set_total_duration(section, 200.0)
|
||||
|
||||
var report := _validator.validate_report(routine)
|
||||
|
|
@ -209,6 +228,39 @@ func _test_duration_and_repetitions() -> void:
|
|||
_check(_has_message(report, "Kürdauer"), "duration message")
|
||||
|
||||
|
||||
func _test_structured_jump() -> void:
|
||||
var routine := _make_routine("gold")
|
||||
var section := routine.sections[0]
|
||||
_add_jump(
|
||||
section,
|
||||
"2T",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2S"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"1A",
|
||||
PathSegment.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_set_total_duration(section, 170.0)
|
||||
|
||||
var report := _validator.validate_report(routine)
|
||||
_check(
|
||||
report.get_check("category_combinations").passed == 1,
|
||||
"one combination and one sequence fit the Gold limit"
|
||||
)
|
||||
_check(
|
||||
report.get_check("category_repetitions").passed == 1,
|
||||
"structured combination parts count towards repetitions"
|
||||
)
|
||||
_check_approx(
|
||||
report.base_value_total,
|
||||
5.00,
|
||||
"structured combination and sequence base values are summed"
|
||||
)
|
||||
|
||||
|
||||
func _test_unknown_category() -> void:
|
||||
var routine := _make_routine("unknown")
|
||||
var report := _validator.validate_report(routine)
|
||||
|
|
@ -230,11 +282,17 @@ func _make_routine(category: String) -> Routine:
|
|||
return routine
|
||||
|
||||
|
||||
func _add_jump(section: RoutineSection, code: String) -> PathSegment:
|
||||
func _add_jump(
|
||||
section: RoutineSection,
|
||||
code: String,
|
||||
kind: PathSegment.JumpKind = PathSegment.JumpKind.SOLO,
|
||||
extras: PackedStringArray = PackedStringArray()
|
||||
) -> PathSegment:
|
||||
var segment: PathSegment = PathSegmentModel.new()
|
||||
segment.segment_id = "jump-%d" % section.segments.size()
|
||||
segment.curve = _make_point_curve(Vector2.ZERO)
|
||||
segment.set_element(PathSegment.ElementType.JUMP, code, 0)
|
||||
segment.set_jump_combination(kind, extras)
|
||||
section.segments.append(segment)
|
||||
return segment
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ func _init() -> void:
|
|||
_test_rink_geometry()
|
||||
_test_segment_timing()
|
||||
_test_element_markers()
|
||||
_test_jump_combinations()
|
||||
_test_section_aggregation()
|
||||
_test_routine_validation()
|
||||
_finish()
|
||||
|
|
@ -287,6 +288,80 @@ func _test_element_markers() -> void:
|
|||
)
|
||||
|
||||
|
||||
func _test_jump_combinations() -> void:
|
||||
var jump: PathSegment = PathSegmentModel.new()
|
||||
jump.segment_id = "seg-combination"
|
||||
var curve := Curve2D.new()
|
||||
curve.add_point(Vector2(0.0, 0.0))
|
||||
jump.curve = curve
|
||||
jump.set_element(PathSegmentModel.ElementType.JUMP, "3Lz", 0)
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_check(jump.get_element_caption() == "3Lz+2T", "combination caption")
|
||||
_check(
|
||||
jump.get_jump_parts() == PackedStringArray(["3Lz", "2T"]),
|
||||
"combination parts"
|
||||
)
|
||||
_check(jump.is_valid(), "two-jump combination is valid")
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2A", "2T"])
|
||||
)
|
||||
_check(
|
||||
jump.get_element_caption() == "3Lz+2A+2T+SEQ",
|
||||
"sequence caption"
|
||||
)
|
||||
_check(jump.get_jump_parts().size() == 3, "three-jump sequence parts")
|
||||
_check(jump.is_valid(), "three-jump sequence is valid")
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T", "2Lo", "2S"])
|
||||
)
|
||||
_check(
|
||||
jump.get_jump_parts().size() == PathSegmentModel.JUMP_MAX_PARTS,
|
||||
"combinations are capped at three jumps"
|
||||
)
|
||||
_check(jump.is_valid(), "capped combination is valid")
|
||||
|
||||
jump.combination_jumps = PackedStringArray(["2T", "2Lo", "2S"])
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "must not exceed 3 jumps"),
|
||||
"more than three jumps are rejected"
|
||||
)
|
||||
|
||||
jump.jump_kind = PathSegmentModel.JumpKind.SOLO
|
||||
jump.combination_jumps = PackedStringArray(["2T"])
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "combination jumps need"),
|
||||
"solo jumps reject extra combination jumps"
|
||||
)
|
||||
|
||||
jump.set_element(PathSegmentModel.ElementType.SPIN, "CCoSp", 2)
|
||||
_check(
|
||||
jump.jump_kind == PathSegmentModel.JumpKind.SOLO
|
||||
and jump.combination_jumps.is_empty(),
|
||||
"changing to a spin clears jump combination fields"
|
||||
)
|
||||
|
||||
jump.set_element(PathSegmentModel.ElementType.JUMP, "3Lz", 0)
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray()
|
||||
)
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "needs at least one more jump"),
|
||||
"an empty combination is rejected"
|
||||
)
|
||||
|
||||
|
||||
func _test_section_aggregation() -> void:
|
||||
var section: RoutineSection = RoutineSectionModel.new()
|
||||
section.section_id = "section-steps"
|
||||
|
|
|
|||
|
|
@ -259,6 +259,40 @@ func _test_segment_integration() -> void:
|
|||
"segment integration resolves a choreographic spin"
|
||||
)
|
||||
|
||||
var combo: PathSegment = PathSegmentModel.new()
|
||||
combo.segment_id = "combo"
|
||||
combo.curve = _make_point_curve(Vector2.ZERO)
|
||||
combo.set_element(PathSegment.ElementType.JUMP, "3Lz", 0)
|
||||
combo.set_jump_combination(
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(combo),
|
||||
7.20,
|
||||
"structured combination sums 3Lz + 2T"
|
||||
)
|
||||
|
||||
combo.set_jump_combination(
|
||||
PathSegment.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2A", "2T"])
|
||||
)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(combo),
|
||||
10.50,
|
||||
"structured sequence sums 3Lz + 2A + 2T"
|
||||
)
|
||||
|
||||
var legacy_combo: PathSegment = PathSegmentModel.new()
|
||||
legacy_combo.segment_id = "legacy-combo"
|
||||
legacy_combo.curve = _make_point_curve(Vector2.ZERO)
|
||||
legacy_combo.set_element(PathSegment.ElementType.JUMP, "3Lz+2T", 0)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(legacy_combo),
|
||||
7.20,
|
||||
"legacy free-text combination still sums its jumps"
|
||||
)
|
||||
|
||||
var jump: PathSegment = PathSegmentModel.new()
|
||||
jump.segment_id = "jump"
|
||||
jump.curve = _make_point_curve(Vector2.ZERO)
|
||||
|
|
|
|||
|
|
@ -1397,6 +1397,56 @@ func _run() -> void:
|
|||
)
|
||||
controller.validation_dialog.hide()
|
||||
|
||||
# Structured jump combination in the element dialog.
|
||||
controller.new_routine()
|
||||
var combo_marker := controller.add_element_marker(
|
||||
Vector2(0.0, 0.0),
|
||||
PathSegment.ElementType.JUMP,
|
||||
"2T",
|
||||
0
|
||||
)
|
||||
controller.select_segment(combo_marker.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
_check(
|
||||
controller.jump_combination_box.visible,
|
||||
"the jump combination controls are visible for jumps"
|
||||
)
|
||||
var combo_kind_index := controller.jump_kind_option.get_item_index(
|
||||
PathSegment.JumpKind.COMBINATION
|
||||
)
|
||||
controller.jump_kind_option.select(combo_kind_index)
|
||||
controller.jump_kind_option.item_selected.emit(combo_kind_index)
|
||||
_check(
|
||||
controller.jump_second_option.visible,
|
||||
"choosing a combination reveals the second jump"
|
||||
)
|
||||
_select_option_by_metadata(controller.jump_second_option, "2S")
|
||||
_check(
|
||||
controller.element_value_label.text.contains("2,60"),
|
||||
"the dialog base value sums the combination jumps"
|
||||
)
|
||||
controller.element_dialog.confirmed.emit()
|
||||
controller.element_dialog.hide()
|
||||
_check(
|
||||
combo_marker.get_element_caption() == "2T+2S",
|
||||
"the confirmed marker stores a structured combination"
|
||||
)
|
||||
_check_approx(
|
||||
controller.get_element_catalog().get_segment_base_value(combo_marker),
|
||||
2.60,
|
||||
"the structured combination has the summed base value"
|
||||
)
|
||||
_check(controller.undo(), "the structured combination can be undone")
|
||||
combo_marker = controller.get_active_section().get_segment_by_id(
|
||||
combo_marker.segment_id
|
||||
)
|
||||
_check(
|
||||
combo_marker != null
|
||||
and combo_marker.combination_jumps.is_empty()
|
||||
and combo_marker.get_element_caption() == "2T",
|
||||
"undo restores the solo jump"
|
||||
)
|
||||
|
||||
controller.help_button.pressed.emit()
|
||||
_check(controller.help_dialog.visible, "help button opens the help dialog")
|
||||
_check(
|
||||
|
|
@ -1419,6 +1469,18 @@ func _check(condition: bool, message: String) -> void:
|
|||
_failures.append(message)
|
||||
|
||||
|
||||
func _select_option_by_metadata(
|
||||
option: OptionButton,
|
||||
code: String
|
||||
) -> void:
|
||||
for index: int in range(option.item_count):
|
||||
var metadata: Variant = option.get_item_metadata(index)
|
||||
if metadata != null and str(metadata) == code:
|
||||
option.select(index)
|
||||
option.item_selected.emit(index)
|
||||
return
|
||||
|
||||
|
||||
func _select_dialog_code(
|
||||
controller: WhiteboardController,
|
||||
code: String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue