Add working tests, fix bugs, rework popups and automate releases #36

Merged
Sansan merged 34 commits from feature/adding_tests into develop 2026-10-06 22:14:44 +02:00
4 changed files with 68 additions and 31 deletions
Showing only changes of commit 2a332c2d19 - Show all commits

No files matched your search

+2 -2
View File
@@ -385,9 +385,9 @@ offset_bottom = 96.0
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 401.0
offset_left = 210.0
offset_top = 153.0
offset_right = 401.0
offset_right = 210.0
offset_bottom = 153.0
[node name="SettingsWindow" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
+17 -17
View File
@@ -20,17 +20,21 @@ panel = NodePath("SyncPanel")
[node name="SyncPanel" type="Panel" parent="." unique_id=1714634204]
unique_name_in_owner = true
layout_mode = 0
offset_right = 1152.0
offset_right = 1500.0
offset_bottom = 640.0
[node name="ScrollContainer" type="ScrollContainer" parent="SyncPanel" unique_id=1289116349]
layout_mode = 0
offset_right = 1152.0
offset_bottom = 640.0
offset_left = 20.0
offset_top = 8.0
offset_right = 1480.0
offset_bottom = 632.0
horizontal_scroll_mode = 0
[node name="SyncVBoxContainer" type="VBoxContainer" parent="SyncPanel/ScrollContainer" unique_id=1594735567]
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
theme_override_constants/separation = 12
[node name="SyncTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=2125198054]
unique_name_in_owner = true
@@ -62,7 +66,7 @@ layout_mode = 2
[node name="SyncProgressBar" type="ProgressBar" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/ProgressHBoxContainer" unique_id=719135231]
unique_name_in_owner = true
custom_minimum_size = Vector2(1000, 0)
custom_minimum_size = Vector2(1300, 0)
layout_mode = 2
size_flags_horizontal = 6
step = 1.0
@@ -72,17 +76,13 @@ rounded = true
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 6
theme_override_constants/separation = 30
[node name="VSeparator6" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1432793432]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 16
[node name="SoundtracksAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=897546696]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
[node name="SoundtracksAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksAddedVBox" unique_id=535797768]
layout_mode = 2
@@ -96,7 +96,7 @@ layout_mode = 2
[node name="SoundtracksReAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=995736806]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
[node name="SoundtracksReAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksReAddedVBox" unique_id=1142636525]
layout_mode = 2
@@ -109,7 +109,7 @@ layout_mode = 2
[node name="SoundtracksChangedTitleVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=294212033]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
[node name="SoundtracksChangedTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksChangedTitleVBox" unique_id=696960827]
layout_mode = 2
@@ -122,7 +122,7 @@ layout_mode = 2
[node name="SoundtracksChangedContentVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1470922281]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
[node name="SoundtracksChangedContentLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksChangedContentVBox" unique_id=1209639099]
layout_mode = 2
@@ -135,7 +135,7 @@ layout_mode = 2
[node name="SoundtracksRemovedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1174594338]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
size_flags_horizontal = 3
[node name="SoundtracksRemovedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksRemovedVBox" unique_id=877713862]
layout_mode = 2
@@ -149,7 +149,7 @@ layout_mode = 2
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 4
size_flags_horizontal = 3
[node name="CatchedErrorsLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/CatchedErrorsVBox" unique_id=1784389644]
layout_mode = 2
+4 -12
View File
@@ -60,9 +60,6 @@ var sync_timer: Timer = %SyncTimer
@onready
var restart_sync_button: Button = %RestartSyncButton
@onready
var first_separator: VSeparator = %VSeparator6
var changes: bool = false
var has_synced: bool = false
@@ -120,7 +117,7 @@ func on_sync_finished(data_received: Dictionary) -> void:
if show_section_if_has_data(data_received.soundtracks_added, soundtracks_added_vbox, soundtracks_added_separator, "Added"):
changes = true
if show_section_if_has_data(data_received.soundtracks_re_added, soundtracks_readded_vbox, soundtracks_readded_separator, "ReAdded"):
if show_section_if_has_data(data_received.soundtracks_re_added, soundtracks_readded_vbox, soundtracks_readded_separator, "Re-added"):
changes = true
if data_received.soundtracks_changed_title != null && data_received.soundtracks_changed_title.size() > 0:
@@ -146,9 +143,7 @@ func on_sync_finished(data_received: Dictionary) -> void:
catched_errors_vbox.visible = true
make_list(data_received.catched_errors, catched_errors_vbox, "Errors")
# Hide separators that don't have a visible section after them
# The structure is: RestartSyncButton -> VSeparator6 -> VBox -> Separator -> VBox -> Separator -> ...
# Hide VSeparator6 if there are no visible sections
# Separators go only between visible columns, not after the last one
var visible_sections: Array = []
if soundtracks_added_vbox.visible:
visible_sections.append("added")
@@ -161,8 +156,6 @@ func on_sync_finished(data_received: Dictionary) -> void:
if soundtracks_removed_vbox.visible:
visible_sections.append("removed")
first_separator.visible = visible_sections.size() > 1
# Show section separators only if there's a visible section after them
for i in range(visible_sections.size()):
var section = visible_sections[i]
@@ -205,7 +198,8 @@ func make_soundtrack_label(text: String) -> Label:
var label: Label = Label.new()
label.add_theme_font_size_override("font_size", 18)
label.text = text
label.autowrap_mode = TextServer.AUTOWRAP_OFF
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
return label
func reset_sync_result() -> void:
@@ -224,7 +218,6 @@ func reset_sync_result() -> void:
soundtracks_removed_vbox.visible = false
soundtracks_removed_separator.visible = false
catched_errors_vbox.visible = false
first_separator.visible = false
func make_list(list: Array, vbox: VBoxContainer, text: String) -> void:
Settings.delete_children(vbox)
@@ -250,4 +243,3 @@ func show_sync_progress() -> void:
sync_hbox.visible = false
catched_errors_vbox.visible = false
restart_sync_button.visible = false
first_separator.visible = false
+45
View File
@@ -153,3 +153,48 @@ func test_errors_section_has_errors_header() -> void:
_finish_sync(result)
assert_str((_node("CatchedErrorsVBox").get_child(0) as Label).text).is_equal("Errors")
func test_long_names_wrap_instead_of_widening_the_window() -> void:
_runner.invoke("start_sync")
var long_name: String = "The Legend of Zelda: Breath of the Wild Original Soundtrack"
var result: Dictionary = _empty_result()
result.soundtracks_added = [long_name]
result.soundtracks_re_added = [long_name]
result.soundtracks_changed_content = [long_name]
result.soundtracks_removed = [long_name]
result.soundtracks_changed_title = {long_name: long_name}
result.catched_errors = [long_name + " could not be read"]
_finish_sync(result)
await _runner.simulate_frames(2)
# The minimum width is what the content needs; wider than the panel it would stick out
var panel_width: float = (_window.get_node("SyncPanel") as Control).size.x
assert_float(_node("SyncHBoxContainer").get_combined_minimum_size().x) \
.is_less(panel_width)
assert_float(_node("CatchedErrorsVBox").get_combined_minimum_size().x) \
.is_less(panel_width)
func test_visible_columns_share_the_width_equally() -> void:
_runner.invoke("start_sync")
var result: Dictionary = _empty_result()
result.soundtracks_added = ["Chrono Cross", "Xenoblade Chronicles X Original Soundtrack"]
result.soundtracks_removed = ["Bad Rip"]
_finish_sync(result)
await _runner.simulate_frames(2)
assert_float(_node("SoundtracksAddedVBox").size.x).is_equal_approx(
_node("SoundtracksRemovedVBox").size.x, 1.0)
func test_column_headers() -> void:
_runner.invoke("start_sync")
var result: Dictionary = _empty_result()
result.soundtracks_re_added = ["Super Metroid"]
_finish_sync(result)
assert_str((_node("SoundtracksReAddedVBox").get_child(0) as Label).text).is_equal("Re-added")