feat: Saison-Vergleich als PDF ausgeben

Der Vergleichsdialog hat jetzt "Als PDF". Der Bericht schreibt dieselben
Gruppen wie der Dialog in eine Textseite im Exportordner
(<Kür>_saisonvergleich_<Saison>.pdf) und zeigt danach den bekannten
Abschluss-Dialog mit Öffnen, Ordner zeigen und Pfad kopieren.

- RoutinePdfExporter.build_season_comparison() nutzt die vorhandenen
  PDF-Bausteine (Seitenkopf, Fußzeile, WinAnsi-Text) und bricht lange
  Meldungen auf die Seitenbreite um.
- Inhalt: fehlende Elemente, Base Values, Elementtyp, Features, Level,
  Kategorie-Grenzen, Summe und die Befunde gegen die Ziel-Saison.
- ExportDoneDialog ist nicht mehr exklusiv, damit er sich über den offenen
  Prüfdialog legen kann.

Bewusst nicht geändert: PDFs bleiben einheitlich deutsch. _text() berechnet
zwar I18n.t(text), schreibt aber das Original; eine konsequente Übersetzung
müsste vor der Interpolation ansetzen. Als offener Punkt dokumentiert.
This commit is contained in:
torsten 2026-11-13 12:47:50 +01:00
parent ad9f60b8aa
commit 4bc00d2bf9
8 changed files with 366 additions and 5 deletions

View file

@ -134,6 +134,64 @@ func _run() -> void:
pdf_text.contains("Test & <K\\374r>"),
"PDF export encodes umlauts as WinAnsi escapes"
)
# Saison-Vergleich als PDF: eigener Bericht, gleiche PDF-Bausteine.
var library := RulesLibrary.scan()
var current := library.get_package("2026/27")
var older := library.get_package("2025/26")
if current != null and older != null:
var comparison_routine := Routine.new()
comparison_routine.routine_id = "upgrade-pdf"
comparison_routine.title = "Vergleich"
comparison_routine.rink = RinkDimensions.new()
comparison_routine.season = "2026/27"
comparison_routine.adult_category = "gold"
var comparison_section := RoutineSection.new()
comparison_section.section_id = "section-upgrade"
comparison_section.title = "Abschnitt 1"
comparison_section.sequence_order = 0
var marker := _make_segment(
"seg-upgrade",
Vector2(0.0, 0.0),
Vector2(0.0, 0.0),
PathSegment.Direction.FORWARD,
PathSegment.Edge.INSIDE
)
marker.set_element(PathSegment.ElementType.SPIN, "ChSp", 1)
comparison_section.segments.append(marker)
comparison_routine.sections.append(comparison_section)
var report := SeasonUpgradeCheck.run(
comparison_routine,
current,
older
)
var comparison_pdf := RoutinePdfExporter.build_season_comparison(
comparison_routine,
report
)
var comparison_text := comparison_pdf.get_string_from_ascii()
_check(comparison_pdf.size() > 1000, "the comparison PDF produces data")
_check(
comparison_text.begins_with("%PDF-1.4"),
"the comparison PDF has a PDF header"
)
_check(
comparison_text.contains("Saison-Vergleich"),
"the comparison PDF has its own title"
)
_check(
comparison_text.contains("nicht im Katalog"),
"the comparison PDF names the missing element"
)
_check(
comparison_text.contains("2026/27") and comparison_text.contains("2025/26"),
"the comparison PDF names both seasons"
)
_check(
comparison_text.contains("Basiswert"),
"the comparison PDF sums the base values"
)
_check(
pdf_text.contains(" c") or pdf_text.contains(" l"),
"PDF export contains vector path operators"

View file

@ -1790,6 +1790,20 @@ func _run() -> void:
controller.get_season() == "2026/27",
"checking alone does not change the season"
)
_check(
not controller.upgrade_pdf_button.disabled,
"the comparison can be written as a PDF"
)
controller._on_upgrade_pdf_pressed()
_check(
controller._last_export_path.ends_with(".pdf"),
"the comparison PDF lands in the export folder"
)
_check(
FileAccess.file_exists(controller._last_export_path),
"the comparison PDF was written"
)
controller.export_done_dialog.hide()
controller._on_upgrade_apply_pressed()
_check(
controller.get_season() == "2025/26",