feat: Musik, Timeline-Labels, Abschnittssprung, PDF-Export und responsive Dialoge
This commit is contained in:
parent
7bbd8c9c1d
commit
533a12ef1a
17 changed files with 3483 additions and 60 deletions
|
|
@ -102,6 +102,81 @@ func _run() -> void:
|
|||
"the second section excludes the spin of section one"
|
||||
)
|
||||
|
||||
var pdf := RoutinePdfExporter.build(routine)
|
||||
var pdf_text := pdf.get_string_from_ascii()
|
||||
_check(pdf.size() > 1000, "PDF export produces data")
|
||||
_check(
|
||||
pdf_text.begins_with("%PDF-1.4"),
|
||||
"PDF export has a PDF header"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("/Type /Catalog") and pdf_text.contains("/Type /Pages"),
|
||||
"PDF export has catalog and page tree"
|
||||
)
|
||||
_check(
|
||||
_count(pdf_text, "/Type /Page ") == 3,
|
||||
"PDF export contains overview and two section pages"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("/Count 3"),
|
||||
"PDF page tree counts all pages"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("/BaseFont /Helvetica")
|
||||
and pdf_text.contains("/Encoding /WinAnsiEncoding"),
|
||||
"PDF export embeds the built-in fonts with WinAnsi"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("Test & <K\\374r>"),
|
||||
"PDF export encodes umlauts as WinAnsi escapes"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains(" c") or pdf_text.contains(" l"),
|
||||
"PDF export contains vector path operators"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("Start") and pdf_text.contains("Ziel"),
|
||||
"PDF overview marks start and finish"
|
||||
)
|
||||
_check(
|
||||
pdf_text.contains("Timeline-Labels")
|
||||
and pdf_text.contains("Musikstart"),
|
||||
"PDF overview lists custom timeline labels"
|
||||
)
|
||||
|
||||
var section_pdf := RoutinePdfExporter.build(routine, "section-1")
|
||||
var section_pdf_text := section_pdf.get_string_from_ascii()
|
||||
_check(
|
||||
_count(section_pdf_text, "/Type /Page ") == 1,
|
||||
"PDF section export writes a single page"
|
||||
)
|
||||
_check(
|
||||
section_pdf_text.contains("/Count 1"),
|
||||
"PDF section export page tree counts one page"
|
||||
)
|
||||
|
||||
var long_routine := _make_routine()
|
||||
var long_section := RoutineSection.new()
|
||||
long_section.section_id = "section-long"
|
||||
long_section.title = "Langer Abschnitt"
|
||||
long_section.sequence_order = 2
|
||||
for index: int in range(30):
|
||||
long_section.segments.append(
|
||||
_make_segment(
|
||||
"seg-long-%d" % index,
|
||||
Vector2(-20.0 + float(index) * 0.5, -10.0),
|
||||
Vector2(-19.5 + float(index) * 0.5, -10.0),
|
||||
PathSegment.Direction.FORWARD,
|
||||
PathSegment.Edge.OUTSIDE
|
||||
)
|
||||
)
|
||||
long_routine.sections.append(long_section)
|
||||
var long_pdf := RoutinePdfExporter.build(long_routine, "section-long")
|
||||
_check(
|
||||
_count(long_pdf.get_string_from_ascii(), "/Type /Page ") == 2,
|
||||
"long PDF section continues on a second page"
|
||||
)
|
||||
|
||||
var scene := WhiteboardScene.instantiate()
|
||||
var controller := scene as WhiteboardController
|
||||
if controller != null:
|
||||
|
|
@ -115,6 +190,49 @@ func _run() -> void:
|
|||
_finish()
|
||||
return
|
||||
|
||||
_check(
|
||||
controller.export_format_option.item_count == 3
|
||||
and controller.export_format_option.get_item_text(2).contains("PDF"),
|
||||
"export dialog offers the PDF format"
|
||||
)
|
||||
_check(
|
||||
controller.export_open_after_check.button_pressed,
|
||||
"export dialog opens the result by default"
|
||||
)
|
||||
|
||||
# Small viewport: the dialog must stay inside the screen and keep its
|
||||
# confirm button reachable, with the form scrolling instead.
|
||||
get_root().size = Vector2i(800, 400)
|
||||
await process_frame
|
||||
controller._open_export_dialog()
|
||||
await process_frame
|
||||
var export_dialog := controller.export_dialog
|
||||
var scroll := export_dialog.get_node("ExportScroll") as ScrollContainer
|
||||
var ok_button := export_dialog.get_ok_button()
|
||||
_check(
|
||||
export_dialog.size.y <= 400,
|
||||
"export dialog fits a short viewport"
|
||||
)
|
||||
_check(
|
||||
ok_button.global_position.y + ok_button.size.y
|
||||
<= export_dialog.position.y + export_dialog.size.y,
|
||||
"export dialog confirm button stays reachable"
|
||||
)
|
||||
_check(
|
||||
scroll.get_v_scroll_bar().visible,
|
||||
"export dialog form scrolls on a short viewport"
|
||||
)
|
||||
export_dialog.hide()
|
||||
get_root().size = Vector2i(1440, 900)
|
||||
await process_frame
|
||||
|
||||
var file_popup := controller.file_menu_button.get_popup()
|
||||
var has_export_folder := false
|
||||
for index: int in range(file_popup.item_count):
|
||||
if file_popup.get_item_text(index).contains("Exportordner"):
|
||||
has_export_folder = true
|
||||
_check(has_export_folder, "file menu offers the exports folder")
|
||||
|
||||
controller.add_segment(
|
||||
Vector2(-10.0, 0.0),
|
||||
Vector2(0.0, 0.0),
|
||||
|
|
@ -134,6 +252,46 @@ func _run() -> void:
|
|||
_check(content.contains("<svg "), "exported SVG file has SVG content")
|
||||
DirAccess.remove_absolute(export_path)
|
||||
|
||||
var pdf_path := "user://test_export.pdf"
|
||||
_check(
|
||||
controller.export_pdf_to_path(pdf_path),
|
||||
"controller writes a PDF file"
|
||||
)
|
||||
_check(FileAccess.file_exists(pdf_path), "exported PDF exists on disk")
|
||||
if FileAccess.file_exists(pdf_path):
|
||||
var file := FileAccess.open(pdf_path, FileAccess.READ)
|
||||
var bytes := file.get_buffer(file.get_length())
|
||||
file.close()
|
||||
_check(
|
||||
bytes.get_string_from_ascii().begins_with("%PDF-1.4"),
|
||||
"exported PDF file has PDF content"
|
||||
)
|
||||
controller._last_export_path = ProjectSettings.globalize_path(pdf_path)
|
||||
controller._show_export_done()
|
||||
_check(
|
||||
controller.export_done_dialog.visible,
|
||||
"export completion dialog opens"
|
||||
)
|
||||
_check(
|
||||
controller.export_done_label.text.contains(
|
||||
ProjectSettings.globalize_path(pdf_path)
|
||||
),
|
||||
"export completion dialog shows the absolute path"
|
||||
)
|
||||
_check(
|
||||
not controller.export_open_button.disabled
|
||||
and not controller.export_folder_button.disabled,
|
||||
"export completion dialog enables open and folder buttons"
|
||||
)
|
||||
controller.export_done_dialog.hide()
|
||||
DirAccess.remove_absolute(pdf_path)
|
||||
|
||||
_check(
|
||||
controller._open_path_externally("user://missing_export.pdf")
|
||||
== ERR_FILE_NOT_FOUND,
|
||||
"missing export files are not passed to the shell"
|
||||
)
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
_finish()
|
||||
|
|
@ -143,6 +301,9 @@ func _make_routine() -> Routine:
|
|||
var routine := Routine.new()
|
||||
routine.routine_id = "export-test"
|
||||
routine.title = "Test & <Kür>"
|
||||
routine.timeline_labels = [
|
||||
{"time_seconds": 2.5, "text": "Musikstart"},
|
||||
]
|
||||
routine.rink = RinkDimensions.new()
|
||||
|
||||
var section_one := RoutineSection.new()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,22 @@ func _test_json_roundtrip() -> void:
|
|||
_check(loaded.routine_id == routine.routine_id, "routine id survives")
|
||||
_check(loaded.title == routine.title, "title survives")
|
||||
_check(loaded.skater_name == routine.skater_name, "skater name survives")
|
||||
_check(loaded.music_file == routine.music_file, "music file survives")
|
||||
_check(loaded.timeline_labels.size() == 2, "timeline labels survive")
|
||||
if loaded.timeline_labels.size() == 2:
|
||||
_check(
|
||||
loaded.timeline_labels[0]["text"] == "Dreh",
|
||||
"timeline labels are sorted by time"
|
||||
)
|
||||
_check_approx(
|
||||
float(loaded.timeline_labels[0]["time_seconds"]),
|
||||
1.25,
|
||||
"timeline label time survives"
|
||||
)
|
||||
_check(
|
||||
loaded.timeline_labels[1]["text"] == "Finale",
|
||||
"second timeline label survives"
|
||||
)
|
||||
_check(loaded.adult_category == routine.adult_category, "category survives")
|
||||
_check_approx(
|
||||
loaded.assumed_pcs_average,
|
||||
|
|
@ -149,6 +165,56 @@ func _test_json_rejects() -> void:
|
|||
"paths without extension get .json"
|
||||
)
|
||||
|
||||
_check(
|
||||
RoutineFile.safe_music_file_name("kür.mp3") == "kür.mp3",
|
||||
"plain music file names are accepted"
|
||||
)
|
||||
_check(
|
||||
RoutineFile.safe_music_file_name("../song.mp3").is_empty(),
|
||||
"music paths with traversal are rejected"
|
||||
)
|
||||
_check(
|
||||
RoutineFile.safe_music_file_name("/tmp/song.mp3").is_empty(),
|
||||
"absolute music paths are rejected"
|
||||
)
|
||||
_check(
|
||||
RoutineFile.safe_music_file_name("song.exe").is_empty(),
|
||||
"non-audio attachments are rejected"
|
||||
)
|
||||
_check(
|
||||
RoutineFile.is_audio_file("song.MP3")
|
||||
and RoutineFile.is_audio_file("song.ogg")
|
||||
and RoutineFile.is_audio_file("song.wav"),
|
||||
"audio extensions are recognised case-insensitively"
|
||||
)
|
||||
|
||||
var unsafe_music := encoded.replace(
|
||||
"\"music_file\": \"kuer.mp3\"",
|
||||
"\"music_file\": \"../kuer.mp3\""
|
||||
)
|
||||
var unsafe_result := RoutineFile.decode_json(unsafe_music)
|
||||
_check(
|
||||
str(unsafe_result["error"]).is_empty()
|
||||
and (unsafe_result["routine"] as Routine).music_file.is_empty(),
|
||||
"unsafe music references are dropped while the routine still loads"
|
||||
)
|
||||
|
||||
var empty_label := encoded.replace("\"text\": \"Dreh\"", "\"text\": \"\"")
|
||||
var empty_result := RoutineFile.decode_json(empty_label)
|
||||
_check(
|
||||
str(empty_result["error"]).is_empty()
|
||||
and (empty_result["routine"] as Routine).timeline_labels.size() == 1,
|
||||
"empty timeline labels are dropped"
|
||||
)
|
||||
|
||||
var label_data: Dictionary = JSON.parse_string(encoded)
|
||||
label_data["timeline_labels"] = "kaputt"
|
||||
var bad_labels := RoutineFile.decode_json(JSON.stringify(label_data))
|
||||
_check(
|
||||
not str(bad_labels["error"]).is_empty(),
|
||||
"invalid timeline label data is rejected"
|
||||
)
|
||||
|
||||
|
||||
func _test_atomic_write() -> void:
|
||||
var routine := _make_routine()
|
||||
|
|
@ -224,6 +290,11 @@ func _make_routine() -> Routine:
|
|||
routine.routine_id = "format-test"
|
||||
routine.title = "Format Test"
|
||||
routine.skater_name = "Erika"
|
||||
routine.music_file = "kuer.mp3"
|
||||
routine.timeline_labels = [
|
||||
{"time_seconds": 4.5, "text": "Finale"},
|
||||
{"time_seconds": 1.25, "text": "Dreh"},
|
||||
]
|
||||
routine.adult_category = "gold"
|
||||
routine.assumed_pcs_average = 4.75
|
||||
routine.assumed_falls = 1
|
||||
|
|
|
|||
|
|
@ -68,6 +68,48 @@ func _run() -> void:
|
|||
"timeline covers the whole routine"
|
||||
)
|
||||
|
||||
controller.play()
|
||||
controller.advance_playback(0.2)
|
||||
controller.set_active_section(section_two.section_id)
|
||||
_check(not controller.is_playing(), "section change stops active playback")
|
||||
_check_approx(
|
||||
controller.get_playback_time(),
|
||||
4.0,
|
||||
"selecting a section moves the playback to its start"
|
||||
)
|
||||
_check_approx(
|
||||
controller.playback_timeline.value,
|
||||
4.0,
|
||||
"timeline slider jumps to the section start"
|
||||
)
|
||||
_check(
|
||||
controller.get_playback_section_id() == section_two.section_id,
|
||||
"playback reports the newly selected section"
|
||||
)
|
||||
_check_vec(
|
||||
controller.get_playback_position(),
|
||||
Vector2(4.0, 0.0),
|
||||
"playback marker sits at the section start"
|
||||
)
|
||||
|
||||
controller.set_active_section(section_one.section_id)
|
||||
_check_approx(
|
||||
controller.get_playback_time(),
|
||||
0.0,
|
||||
"switching back moves the playback to the first section"
|
||||
)
|
||||
_check_approx(
|
||||
controller.playback_timeline.value,
|
||||
0.0,
|
||||
"timeline slider returns to the first section"
|
||||
)
|
||||
_check(
|
||||
controller.get_playback_section_id() == section_one.section_id,
|
||||
"playback reports the first section again"
|
||||
)
|
||||
# Keep the original active section for the marker tests below.
|
||||
controller.set_active_section(section_two.section_id)
|
||||
|
||||
controller.seek_playback(1.0)
|
||||
_check(not controller.is_playing(), "seeking does not start playback")
|
||||
_check_vec(
|
||||
|
|
@ -202,6 +244,17 @@ func _run() -> void:
|
|||
8.0,
|
||||
"spin marker gets a default stand time"
|
||||
)
|
||||
var zero_marker := controller.add_element_marker(
|
||||
Vector2(24.0, 3.0),
|
||||
PathSegment.ElementType.SEQUENCE,
|
||||
"StSq",
|
||||
0
|
||||
)
|
||||
_check_approx(
|
||||
zero_marker.element_duration_seconds,
|
||||
0.0,
|
||||
"sequence marker can have no stand time"
|
||||
)
|
||||
controller._update_status()
|
||||
_check_approx(
|
||||
controller.get_playback_duration(),
|
||||
|
|
@ -235,11 +288,217 @@ func _run() -> void:
|
|||
"spin marker rotates the playback dot in place"
|
||||
)
|
||||
|
||||
# Timeline labels: element labels are drawn read-only and a click on the
|
||||
# lane creates an editable custom label at that time.
|
||||
forward.label = "Auftakt"
|
||||
last.label = "Finale"
|
||||
controller._update_status()
|
||||
_check(
|
||||
controller.timeline_label_lane.get_element_label_count() == 5,
|
||||
"labelled segments and element captions appear on the timeline"
|
||||
)
|
||||
var has_element_label := false
|
||||
var has_jump_caption := false
|
||||
var has_spin_caption := false
|
||||
var has_zero_caption := false
|
||||
for item: Dictionary in controller.timeline_label_lane.get_display_items():
|
||||
if bool(item["custom"]):
|
||||
continue
|
||||
var item_text := str(item["text"])
|
||||
if item_text == "Auftakt":
|
||||
has_element_label = true
|
||||
elif item_text == "3Lz":
|
||||
has_jump_caption = true
|
||||
elif item_text.begins_with("CCoSp"):
|
||||
has_spin_caption = true
|
||||
elif item_text == "StSq":
|
||||
has_zero_caption = true
|
||||
_check(has_element_label, "element label is part of the timeline drawing")
|
||||
_check(has_jump_caption, "jump caption appears without a free-text label")
|
||||
_check(has_spin_caption, "spin caption appears without a free-text label")
|
||||
_check(has_zero_caption, "zero-duration element stays on the timeline")
|
||||
|
||||
_check(
|
||||
controller.add_timeline_label(5.0, "Musikstart"),
|
||||
"custom timeline label is added"
|
||||
)
|
||||
var custom_labels := controller.get_timeline_labels()
|
||||
_check(custom_labels.size() == 1, "routine stores the custom timeline label")
|
||||
if custom_labels.size() == 1:
|
||||
_check(custom_labels[0]["text"] == "Musikstart", "custom label text survives")
|
||||
_check_approx(
|
||||
float(custom_labels[0]["time_seconds"]),
|
||||
5.0,
|
||||
"custom label keeps its time"
|
||||
)
|
||||
_check(
|
||||
controller.timeline_label_lane.get_custom_label_count() == 1,
|
||||
"custom label is shown on the lane"
|
||||
)
|
||||
|
||||
controller.timeline_label_lane.size = Vector2(600.0, 44.0)
|
||||
controller.timeline_label_lane._rebuild_items()
|
||||
var lane_click := InputEventMouseButton.new()
|
||||
lane_click.button_index = MOUSE_BUTTON_LEFT
|
||||
lane_click.pressed = true
|
||||
lane_click.position = Vector2(100.0, 20.0)
|
||||
controller.timeline_label_lane._gui_input(lane_click)
|
||||
_check(
|
||||
controller.timeline_label_dialog.visible,
|
||||
"clicking the empty lane opens the label dialog"
|
||||
)
|
||||
controller.timeline_label_dialog.hide()
|
||||
|
||||
var label_click := InputEventMouseButton.new()
|
||||
label_click.button_index = MOUSE_BUTTON_LEFT
|
||||
label_click.pressed = true
|
||||
label_click.position = Vector2(
|
||||
controller.timeline_label_lane._time_to_x(5.0) + 2.0,
|
||||
20.0
|
||||
)
|
||||
controller.timeline_label_lane._gui_input(label_click)
|
||||
_check(
|
||||
controller.timeline_label_dialog.visible
|
||||
and controller.timeline_label_edit.text == "Musikstart",
|
||||
"clicking a custom label opens it for editing"
|
||||
)
|
||||
controller.timeline_label_dialog.hide()
|
||||
|
||||
_check(
|
||||
controller.update_timeline_label(0, "Sprung"),
|
||||
"custom timeline label can be edited"
|
||||
)
|
||||
_check(
|
||||
controller.get_timeline_labels()[0]["text"] == "Sprung",
|
||||
"edited label text is stored"
|
||||
)
|
||||
_check(controller.undo(), "timeline label edit can be undone")
|
||||
_check(
|
||||
controller.get_timeline_labels()[0]["text"] == "Musikstart",
|
||||
"undo restores the previous label text"
|
||||
)
|
||||
_check(controller.redo(), "timeline label edit can be redone")
|
||||
_check(
|
||||
controller.get_timeline_labels()[0]["text"] == "Sprung",
|
||||
"redo restores the edited label text"
|
||||
)
|
||||
_check(
|
||||
controller.remove_timeline_label(0),
|
||||
"custom timeline label can be removed"
|
||||
)
|
||||
_check(
|
||||
controller.get_timeline_labels().is_empty(),
|
||||
"removed label is gone from the routine"
|
||||
)
|
||||
_check(
|
||||
controller.timeline_label_lane.get_custom_label_count() == 0,
|
||||
"removed label disappears from the lane"
|
||||
)
|
||||
forward.label = ""
|
||||
last.label = ""
|
||||
controller._update_status()
|
||||
|
||||
# Music: loading copies the track into the routine folder, the player
|
||||
# follows the routine clock and the reference is cleared again on removal.
|
||||
var music_source := "user://test_music.wav"
|
||||
for old_path: String in [music_source, "user://routines/test_music.wav"]:
|
||||
if FileAccess.file_exists(old_path):
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path(old_path))
|
||||
_write_test_wav(music_source)
|
||||
_check(
|
||||
controller.load_music_from_path(music_source),
|
||||
"music file is loaded into the routine"
|
||||
)
|
||||
_check(
|
||||
controller.get_music_file_name() == "test_music.wav",
|
||||
"routine references the copied music file"
|
||||
)
|
||||
_check(
|
||||
FileAccess.file_exists("user://routines/test_music.wav"),
|
||||
"music is stored next to the routine JSON"
|
||||
)
|
||||
_check(controller.has_music_stream(), "player has an audio stream")
|
||||
_check(
|
||||
controller.music_label.text.contains("test_music.wav"),
|
||||
"playback bar shows the music file"
|
||||
)
|
||||
|
||||
controller.seek_playback(0.5)
|
||||
controller.play()
|
||||
_check(controller.music_player.playing, "music starts with routine playback")
|
||||
_check_approx(
|
||||
controller.music_player.pitch_scale,
|
||||
1.0,
|
||||
"music plays at normal speed at 1x"
|
||||
)
|
||||
controller.seek_playback(3.0)
|
||||
_check_approx(
|
||||
controller.get_playback_time(),
|
||||
3.0,
|
||||
"scrubbing moves the routine clock"
|
||||
)
|
||||
controller.speed_option.item_selected.emit(4)
|
||||
_check_approx(
|
||||
controller.music_player.pitch_scale,
|
||||
2.0,
|
||||
"music follows the selected playback speed"
|
||||
)
|
||||
controller.speed_option.item_selected.emit(2)
|
||||
controller.reset_playback()
|
||||
_check(not controller.music_player.playing, "reset stops the music")
|
||||
_check_approx(
|
||||
controller.music_player.pitch_scale,
|
||||
1.0,
|
||||
"reset restores normal music speed"
|
||||
)
|
||||
|
||||
controller._clear_music()
|
||||
_check(controller.get_music_file_name().is_empty(), "music reference is cleared")
|
||||
_check(not controller.has_music_stream(), "cleared music has no stream")
|
||||
_check(
|
||||
FileAccess.file_exists("user://routines/test_music.wav"),
|
||||
"clearing keeps the file for other routines"
|
||||
)
|
||||
DirAccess.remove_absolute(
|
||||
ProjectSettings.globalize_path("user://routines/test_music.wav")
|
||||
)
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path(music_source))
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
# Give the audio thread one real-time slice so its playback objects are
|
||||
# released before ObjectDB checks for leaks at exit.
|
||||
OS.delay_msec(300)
|
||||
await process_frame
|
||||
await process_frame
|
||||
_finish()
|
||||
|
||||
|
||||
func _write_test_wav(path: String) -> void:
|
||||
const SAMPLE_RATE := 8000
|
||||
const DATA_SIZE := SAMPLE_RATE * 2
|
||||
var file := FileAccess.open(path, FileAccess.WRITE)
|
||||
if file == null:
|
||||
return
|
||||
file.store_buffer("RIFF".to_ascii_buffer())
|
||||
file.store_32(36 + DATA_SIZE)
|
||||
file.store_buffer("WAVE".to_ascii_buffer())
|
||||
file.store_buffer("fmt ".to_ascii_buffer())
|
||||
file.store_32(16)
|
||||
file.store_16(1)
|
||||
file.store_16(1)
|
||||
file.store_32(SAMPLE_RATE)
|
||||
file.store_32(SAMPLE_RATE * 2)
|
||||
file.store_16(2)
|
||||
file.store_16(16)
|
||||
file.store_buffer("data".to_ascii_buffer())
|
||||
file.store_32(DATA_SIZE)
|
||||
var silence := PackedByteArray()
|
||||
silence.resize(DATA_SIZE)
|
||||
file.store_buffer(silence)
|
||||
file.close()
|
||||
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
_assertions += 1
|
||||
if not condition:
|
||||
|
|
|
|||
|
|
@ -121,6 +121,18 @@ func _test_naming() -> void:
|
|||
and not RoutineSync.is_routine_file("sync.cfg"),
|
||||
"der Sync akzeptiert JSON und Legacy-.tres"
|
||||
)
|
||||
_check(
|
||||
RoutineSync.is_synced_file("kuer.mp3")
|
||||
and RoutineSync.is_synced_file("kuer.ogg")
|
||||
and RoutineSync.is_synced_file("kuer.wav")
|
||||
and not RoutineSync.is_synced_file("notizen.txt"),
|
||||
"der Sync akzeptiert Musikdateien der Kür"
|
||||
)
|
||||
_check(
|
||||
SyncPlan.conflict_file_name("kuer.mp3", "2026-10-30 1050")
|
||||
== "kuer (Server 2026-10-30 1050).mp3",
|
||||
"Konfliktnamen behalten die Audio-Endung"
|
||||
)
|
||||
var label := SyncPlan.timestamp_label(0)
|
||||
_check(
|
||||
label.length() == 15 and label.contains("-") and label.contains(" "),
|
||||
|
|
@ -168,6 +180,24 @@ func _test_state_roundtrip() -> void:
|
|||
var files := RoutineSync.local_files("user://does_not_exist")
|
||||
_check(files.is_empty(), "fehlendes Verzeichnis liefert keine Dateien")
|
||||
|
||||
var local_dir := "user://test_sync_files"
|
||||
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(local_dir))
|
||||
for name: String in ["kuer.json", "kuer.mp3", "notizen.txt"]:
|
||||
var file := FileAccess.open(local_dir.path_join(name), FileAccess.WRITE)
|
||||
file.store_string("x")
|
||||
file.close()
|
||||
var listed := RoutineSync.local_files(local_dir)
|
||||
_check(
|
||||
listed.has("kuer.json") and listed.has("kuer.mp3"),
|
||||
"lokale Dateiliste enthält Kür und Musik"
|
||||
)
|
||||
_check(not listed.has("notizen.txt"), "lokale Dateiliste ignoriert Fremddateien")
|
||||
for name: String in ["kuer.json", "kuer.mp3", "notizen.txt"]:
|
||||
DirAccess.remove_absolute(
|
||||
ProjectSettings.globalize_path(local_dir.path_join(name))
|
||||
)
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path(local_dir))
|
||||
|
||||
|
||||
func _test_controller_wiring() -> void:
|
||||
var scene := WhiteboardScene.instantiate()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue