Replace the broken test suite with working GdUnit4 tests

The previous tests never compiled: they used GUT's assert functions,
Godot 3 APIs and reassigned autoload functions, so no test ran.

- 90 tests: unit tests for the playlist, songs, player scoring, time
  formatting, search and the server client, plus integration tests
  that run MainWindow and SyncWindow against a fake server
- Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep
  following the player rows while players are added and removed
- run_tests.sh finds Godot and runs the suite headless (~10 seconds)
- CI runs the tests before the build job in gitea-build.yaml; the
  separate test.yml used a GitHub action that does not exist
- GdUnit4 is committed instead of ignored, since the project enables
  it, and .gitea/ is no longer ignored
- Exported builds leave out tests/ and addons/gdUnit4/
This commit is contained in:
Sansan committed 2026-10-06 08:32:56 +02:00
1 parent 56e9fe66d3
commit c985a6ce5b
559 files changed
+32474 -2100

No files matched your search

@@ -0,0 +1,56 @@
@tool
extends ProgressBar
@onready var progress_counter: Label = %progess_counter
@onready var style: StyleBoxFlat = get("theme_override_styles/fill")
var _state: GdUnitInspectorTreeConstants.STATE
func _ready() -> void:
style.bg_color = Color.TRANSPARENT
value = 0
max_value = 0
update_text()
# register for progress changes
if Engine.is_editor_hint():
@warning_ignore("unsafe_property_access", "unsafe_method_access")
if get_parent().get_parent().get_parent().find_child("MainPanel", true, false).test_counters_changed.connect(_on_test_counter_changed) != OK:
push_error("ProgressBar: Can't connect to MainPanel")
func update_text() -> void:
progress_counter.text = "%d:%d" % [value, max_value]
func _on_test_counter_changed(index: int, total: int, state: GdUnitInspectorTreeConstants.STATE) -> void:
value = index
max_value = total
update_text()
# inital state
if index == 0:
_state = GdUnitInspectorTreeConstants.STATE.INITIAL
style.bg_color = Color.TRANSPARENT
# do only update the state is higher prio than current state
if state <= _state:
return
_state = state
if is_failed(state):
style.bg_color = Color.DARK_RED
else:
style.bg_color = Color.DARK_GREEN
func is_failed(state: GdUnitInspectorTreeConstants.STATE) -> bool:
return state in [
GdUnitInspectorTreeConstants.STATE.FAILED,
GdUnitInspectorTreeConstants.STATE.ERROR,
GdUnitInspectorTreeConstants.STATE.ABORDED]
func is_flaky(state: GdUnitInspectorTreeConstants.STATE) -> bool:
return state == GdUnitInspectorTreeConstants.STATE.FLAKY
@@ -0,0 +1 @@
uid://5jlhfo21m5f4
@@ -0,0 +1,49 @@
[gd_scene format=3 uid="uid://dva3tonxsxrlk"]
[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/parts/GdUnitInspectorProgressBar.gd" id="1"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ayfir"]
bg_color = Color(1, 1, 1, 0)
[node name="MarginContainer" type="MarginContainer" unique_id=542070056]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 2
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 2
[node name="ProgressBar" type="ProgressBar" parent="." unique_id=419200362]
custom_minimum_size = Vector2(0, 20)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 9
theme_override_styles/fill = SubResource("StyleBoxFlat_ayfir")
allow_greater = true
show_percentage = false
script = ExtResource("1")
[node name="progess_counter" type="Label" parent="ProgressBar" unique_id=648033469]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -11.5
offset_top = -11.5
offset_right = 11.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
horizontal_alignment = 1
vertical_alignment = 1
autowrap_trim_flags = 0
justification_flags = 0
max_lines_visible = 1
@@ -0,0 +1,303 @@
@tool
extends Control
signal select_failure_next()
signal select_failure_prevous()
signal select_error_next()
signal select_error_prevous()
signal select_flaky_next()
signal select_flaky_prevous()
signal select_skipped_next()
signal select_skipped_prevous()
signal select_orphan_next()
signal select_orphan_prevous()
@warning_ignore("unused_signal")
signal tree_view_mode_changed(flat :bool)
@onready var _button_sync: Button = %btn_tree_sync
@onready var _button_view_mode: MenuButton = %btn_tree_mode
@onready var _button_sort_mode: MenuButton = %btn_tree_sort
@onready var _icon_template: SpinBox = %icon_template
@onready var time_value: Label = %time_value
@onready var time_icon: TextureRect = %time_icon
const STATE = GdUnitInspectorTreeConstants.STATE
var total_failed := 0
var total_errors := 0
var total_flaky := 0
var total_skipped := 0
var total_orphans := 0
var _timer: LocalTime
var icon_mappings := {
# tree sort modes
0x100 + GdUnitInspectorTreeConstants.SORT_MODE.UNSORTED : GdUnitUiTools.get_icon("TripleBar"),
0x100 + GdUnitInspectorTreeConstants.SORT_MODE.NAME_ASCENDING : GdUnitUiTools.get_icon("Sort"),
0x100 + GdUnitInspectorTreeConstants.SORT_MODE.NAME_DESCENDING : GdUnitUiTools.get_flipped_icon("Sort"),
0x100 + GdUnitInspectorTreeConstants.SORT_MODE.EXECUTION_TIME : GdUnitUiTools.get_icon("History"),
# tree view modes
0x200 + GdUnitInspectorTreeConstants.TREE_VIEW_MODE.TREE : GdUnitUiTools.get_icon("Tree", Color.GHOST_WHITE),
0x200 + GdUnitInspectorTreeConstants.TREE_VIEW_MODE.FLAT : GdUnitUiTools.get_icon("AnimationTrackGroup", Color.GHOST_WHITE)
}
@warning_ignore("return_value_discarded")
func _ready() -> void:
_button_sync.icon = GdUnitUiTools.get_icon("Loop")
_set_sort_mode_menu_options()
_set_view_mode_menu_options()
_init_status_pannels()
time_value.text = "0ms"
time_icon.texture = GdUnitUiTools.get_icon("Time")
GdUnitSignals.instance().gdunit_event.connect(_on_gdunit_event)
GdUnitSignals.instance().gdunit_settings_changed.connect(_on_settings_changed)
func _process(_delta: float) -> void:
if _timer:
time_value.text = _timer.elapsed_since()
func _init_status_pannels() -> void:
_init_statistic_panels(STATE.FAILED)
_init_statistic_panels(STATE.ERROR)
_init_statistic_panels(STATE.FLAKY)
_init_statistic_panels(STATE.SKIPPED)
_init_statistic_panels(STATE.ORPHAN)
func _notification(what: int) -> void:
if what == EditorSettings.NOTIFICATION_EDITOR_SETTINGS_CHANGED:
_init_status_pannels()
func _init_statistic_panels(state: STATE) -> void:
var panel: Control = find_child(str(STATE.keys()[state]), true, false)
var icon: TextureRect = panel.find_child("icon")
if icon.texture == null:
icon.texture = GdUnitUiTools.get_state_icon(state)
icon.tooltip_text = panel.get_tooltip_text()
var value: LineEdit = panel.find_child("value")
value.text = "0"
value.tooltip_text = panel.get_tooltip_text()
var btn_up: TextureButton = panel.find_child("up")
var btn_down: TextureButton = panel.find_child("down")
var up_icon := _icon_template.get_theme_icon("up_hover")
var texture_normal := ImageTexture.create_from_image(
GdUnitUiTools._modulate_image(up_icon.get_image(),
Color.GRAY)
)
var texture_hover := ImageTexture.create_from_image(
GdUnitUiTools._modulate_image(up_icon.get_image(),
Color.WHITE)
)
var texture_pressed := ImageTexture.create_from_image(
GdUnitUiTools._modulate_image(up_icon.get_image(),
Color.SKY_BLUE)
)
btn_up.texture_normal = texture_normal
btn_up.texture_hover = texture_hover
btn_up.texture_pressed = texture_pressed
btn_down.texture_normal = texture_normal
btn_down.texture_hover = texture_hover
btn_down.texture_pressed = texture_pressed
if not btn_up.pressed.is_connected(_on_button_up):
btn_up.pressed.connect(_on_button_up.bind(state))
if not btn_down.pressed.is_connected(_on_button_down):
btn_down.pressed.connect(_on_button_down.bind(state))
func _on_button_up(state: STATE) -> void:
match state:
STATE.FAILED:
select_failure_prevous.emit()
STATE.ERROR:
select_error_prevous.emit()
STATE.FLAKY:
select_flaky_prevous.emit()
STATE.SKIPPED:
select_skipped_prevous.emit()
STATE.ORPHAN:
select_orphan_prevous.emit()
func _on_button_down(state: STATE) -> void:
match state:
STATE.FAILED:
select_failure_next.emit()
STATE.ERROR:
select_error_next.emit()
STATE.FLAKY:
select_flaky_next.emit()
STATE.SKIPPED:
select_skipped_next.emit()
STATE.ORPHAN:
select_orphan_next.emit()
func _update_statistics(state: STATE, count: int) -> void:
var panel: Node = find_child(str(STATE.keys()[state]), true, false)
var value: LineEdit = panel.find_child("value")
value.text = str(count)
func _set_sort_mode_menu_options() -> void:
_button_sort_mode.icon = GdUnitUiTools.get_icon("Sort")
# construct context sort menu according to the available modes
var context_menu :PopupMenu = _button_sort_mode.get_popup()
context_menu.clear()
if not context_menu.index_pressed.is_connected(_on_sort_mode_changed):
@warning_ignore("return_value_discarded")
context_menu.index_pressed.connect(_on_sort_mode_changed)
var configured_sort_mode := GdUnitSettings.get_inspector_tree_sort_mode()
for sort_mode: String in GdUnitInspectorTreeConstants.SORT_MODE.keys():
var enum_value :int = GdUnitInspectorTreeConstants.SORT_MODE.get(sort_mode)
var icon :Texture2D = icon_mappings[0x100 + enum_value]
context_menu.add_icon_check_item(icon, normalise(sort_mode), enum_value)
context_menu.set_item_checked(enum_value, configured_sort_mode == enum_value)
func _set_view_mode_menu_options() -> void:
_button_view_mode.icon = GdUnitUiTools.get_icon("Tree", Color.GHOST_WHITE)
# construct context tree view menu according to the available modes
var context_menu :PopupMenu = _button_view_mode.get_popup()
context_menu.clear()
if not context_menu.index_pressed.is_connected(_on_tree_view_mode_changed):
@warning_ignore("return_value_discarded")
context_menu.index_pressed.connect(_on_tree_view_mode_changed)
var configured_tree_view_mode := GdUnitSettings.get_inspector_tree_view_mode()
for tree_view_mode: String in GdUnitInspectorTreeConstants.TREE_VIEW_MODE.keys():
var enum_value :int = GdUnitInspectorTreeConstants.TREE_VIEW_MODE.get(tree_view_mode)
var icon :Texture2D = icon_mappings[0x200 + enum_value]
context_menu.add_icon_check_item(icon, normalise(tree_view_mode), enum_value)
context_menu.set_item_checked(enum_value, configured_tree_view_mode == enum_value)
func normalise(value: String) -> String:
var parts := value.to_lower().split("_")
parts[0] = parts[0].capitalize()
return " ".join(parts)
func status_changed(errors: int, failed: int, flaky: int, skipped: int, orphans: int) -> void:
total_failed += failed
total_errors += errors
total_flaky += flaky
total_skipped += skipped
total_orphans += orphans
_update_statistics(STATE.FAILED, total_failed)
_update_statistics(STATE.ERROR, total_errors)
_update_statistics(STATE.FLAKY, total_flaky)
_update_statistics(STATE.SKIPPED, total_skipped)
_update_statistics(STATE.ORPHAN, total_orphans)
func disable_buttons(value :bool) -> void:
_button_sync.set_disabled(value)
_button_sort_mode.set_disabled(value)
_button_view_mode.set_disabled(value)
func _on_gdunit_event(event: GdUnitEvent) -> void:
match event.type():
GdUnitEvent.DISCOVER_START:
disable_buttons(true)
GdUnitEvent.DISCOVER_END:
disable_buttons(false)
GdUnitEvent.INIT:
total_errors = 0
total_failed = 0
total_flaky = 0
total_skipped = 0
total_orphans = 0
status_changed(total_errors, total_failed, total_flaky, total_skipped, total_orphans)
GdUnitEvent.TESTCASE_AFTER:
status_changed(event.error_count(), event.failed_count(), event.is_flaky(), event.is_skipped(), event.orphan_nodes())
GdUnitEvent.TESTSUITE_AFTER:
status_changed(event.error_count(), event.failed_count(), event.is_flaky(), 0, event.orphan_nodes())
GdUnitEvent.SESSION_START:
disable_buttons(true)
_timer = LocalTime.now()
GdUnitEvent.SESSION_CLOSE, GdUnitEvent.STOP:
disable_buttons(false)
_timer = null
func _on_btn_error_up_pressed() -> void:
select_error_prevous.emit()
func _on_btn_error_down_pressed() -> void:
select_error_next.emit()
func _on_failure_up_pressed() -> void:
select_failure_prevous.emit()
func _on_failure_down_pressed() -> void:
select_failure_next.emit()
func _on_btn_flaky_up_pressed() -> void:
select_flaky_prevous.emit()
func _on_btn_flaky_down_pressed() -> void:
select_flaky_next.emit()
func _on_btn_skipped_up_pressed() -> void:
select_skipped_prevous.emit()
func _on_btn_skipped_down_pressed() -> void:
select_skipped_next.emit()
func _on_btn_orphan_up_pressed() -> void:
select_orphan_prevous.emit()
func _on_btn_orphan_down_pressed() -> void:
select_orphan_next.emit()
func _on_btn_tree_sync_pressed() -> void:
await GdUnitTestDiscoverer.run()
func _on_sort_mode_changed(index: int) -> void:
var selected_sort_mode :GdUnitInspectorTreeConstants.SORT_MODE = GdUnitInspectorTreeConstants.SORT_MODE.values()[index]
GdUnitSettings.set_inspector_tree_sort_mode(selected_sort_mode)
func _on_tree_view_mode_changed(index: int) ->void:
var selected_tree_mode :GdUnitInspectorTreeConstants.TREE_VIEW_MODE = GdUnitInspectorTreeConstants.TREE_VIEW_MODE.values()[index]
GdUnitSettings.set_inspector_tree_view_mode(selected_tree_mode)
################################################################################
# external signal receiver
################################################################################
func _on_settings_changed(property :GdUnitProperty) -> void:
if property.name() == GdUnitSettings.INSPECTOR_TREE_SORT_MODE:
_set_sort_mode_menu_options()
if property.name() == GdUnitSettings.INSPECTOR_TREE_VIEW_MODE:
_set_view_mode_menu_options()
@@ -0,0 +1 @@
uid://cbrfyg1fv3eb6
@@ -0,0 +1,362 @@
[gd_scene format=3 uid="uid://c22l4odk7qesc"]
[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/parts/GdUnitInspectorStatusBar.gd" id="3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mb3ih"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wo03e"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jh28t"]
[node name="StatusBar" type="VBoxContainer" unique_id=214621769]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 132.0
grow_horizontal = 2
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource("3")
[node name="tree_tools" type="HBoxContainer" parent="." unique_id=1524945370]
layout_mode = 2
size_flags_vertical = 0
[node name="Label" type="Label" parent="tree_tools" unique_id=226892195]
layout_mode = 2
size_flags_horizontal = 0
text = "Statistics:"
autowrap_trim_flags = 0
justification_flags = 0
[node name="timings" type="HBoxContainer" parent="tree_tools" unique_id=1494080859]
layout_mode = 2
size_flags_horizontal = 2
size_flags_vertical = 4
alignment = 1
[node name="time_icon" type="TextureRect" parent="tree_tools/timings" unique_id=156277722]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
stretch_mode = 2
[node name="time_value" type="Label" parent="tree_tools/timings" unique_id=387690970]
unique_name_in_owner = true
custom_minimum_size = Vector2(64, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "0ms"
horizontal_alignment = 2
vertical_alignment = 1
autowrap_trim_flags = 0
justification_flags = 0
[node name="tree_buttons" type="HBoxContainer" parent="tree_tools" unique_id=1600307316]
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 4
alignment = 2
[node name="VSeparator" type="VSeparator" parent="tree_tools/tree_buttons" unique_id=1191926359]
layout_mode = 2
[node name="btn_tree_sync" type="Button" parent="tree_tools/tree_buttons" unique_id=2138788372]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Run discover tests."
theme_override_styles/normal = SubResource("StyleBoxEmpty_mb3ih")
[node name="btn_tree_sort" type="MenuButton" parent="tree_tools/tree_buttons" unique_id=1452127838]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Sets tree sorting mode."
theme_override_styles/normal = SubResource("StyleBoxEmpty_wo03e")
flat = false
[node name="btn_tree_mode" type="MenuButton" parent="tree_tools/tree_buttons" unique_id=1744382439]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Sets tree presentation mode."
theme_override_styles/normal = SubResource("StyleBoxEmpty_jh28t")
flat = false
[node name="HSeparator" type="HSeparator" parent="." unique_id=1416084348]
layout_mode = 2
size_flags_vertical = 4
theme_override_constants/separation = 0
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=89354949]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
[node name="status_bar" type="HFlowContainer" parent="MarginContainer" unique_id=1576624226]
layout_direction = 2
layout_mode = 2
size_flags_vertical = 2
[node name="icon_template" type="SpinBox" parent="MarginContainer/status_bar" unique_id=1487498266]
unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="ERROR" type="HBoxContainer" parent="MarginContainer/status_bar" unique_id=310880909]
layout_mode = 2
tooltip_text = "Detected Errors"
[node name="value" type="LineEdit" parent="MarginContainer/status_bar/ERROR" unique_id=1630464164]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
tooltip_text = "Detected Errors"
text = "0"
alignment = 2
max_length = 3
editable = false
context_menu_enabled = false
emoji_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
selecting_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_enabled = false
virtual_keyboard_enabled = false
[node name="icon" type="TextureRect" parent="MarginContainer/status_bar/ERROR/value" unique_id=729348405]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 4.0
offset_top = -8.0
offset_right = 20.0
offset_bottom = 8.0
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
stretch_mode = 2
[node name="buttons" type="VBoxContainer" parent="MarginContainer/status_bar/ERROR" unique_id=541942806]
layout_mode = 2
size_flags_horizontal = 0
[node name="up" type="TextureButton" parent="MarginContainer/status_bar/ERROR/buttons" unique_id=1146002542]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 10
[node name="down" type="TextureButton" parent="MarginContainer/status_bar/ERROR/buttons" unique_id=1867410350]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 2
flip_v = true
[node name="FAILED" type="HBoxContainer" parent="MarginContainer/status_bar" unique_id=1390016421]
layout_mode = 2
tooltip_text = "Failed Tests"
[node name="value" type="LineEdit" parent="MarginContainer/status_bar/FAILED" unique_id=75554621]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
tooltip_text = "Failed Tests"
text = "0"
alignment = 2
max_length = 3
editable = false
context_menu_enabled = false
emoji_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
selecting_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_enabled = false
virtual_keyboard_enabled = false
[node name="icon" type="TextureRect" parent="MarginContainer/status_bar/FAILED/value" unique_id=1889621378]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 4.0
offset_top = -8.0
offset_right = 20.0
offset_bottom = 8.0
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
stretch_mode = 2
[node name="buttons" type="VBoxContainer" parent="MarginContainer/status_bar/FAILED" unique_id=699611313]
layout_mode = 2
size_flags_horizontal = 0
[node name="up" type="TextureButton" parent="MarginContainer/status_bar/FAILED/buttons" unique_id=1774403865]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 10
[node name="down" type="TextureButton" parent="MarginContainer/status_bar/FAILED/buttons" unique_id=1605438045]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 2
flip_v = true
[node name="FLAKY" type="HBoxContainer" parent="MarginContainer/status_bar" unique_id=480870974]
layout_mode = 2
tooltip_text = "Flaky Tests"
[node name="value" type="LineEdit" parent="MarginContainer/status_bar/FLAKY" unique_id=2059394293]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
tooltip_text = "Flaky Tests"
text = "0"
alignment = 2
max_length = 3
editable = false
context_menu_enabled = false
emoji_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
selecting_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_enabled = false
virtual_keyboard_enabled = false
[node name="icon" type="TextureRect" parent="MarginContainer/status_bar/FLAKY/value" unique_id=885817973]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 4.0
offset_top = -8.0
offset_right = 20.0
offset_bottom = 8.0
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
stretch_mode = 2
[node name="buttons" type="VBoxContainer" parent="MarginContainer/status_bar/FLAKY" unique_id=968503310]
layout_mode = 2
size_flags_horizontal = 0
[node name="up" type="TextureButton" parent="MarginContainer/status_bar/FLAKY/buttons" unique_id=1127861257]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 10
[node name="down" type="TextureButton" parent="MarginContainer/status_bar/FLAKY/buttons" unique_id=949128796]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 2
flip_v = true
[node name="SKIPPED" type="HBoxContainer" parent="MarginContainer/status_bar" unique_id=2053554589]
layout_mode = 2
tooltip_text = "Skipped Tests"
[node name="value" type="LineEdit" parent="MarginContainer/status_bar/SKIPPED" unique_id=1877800941]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
tooltip_text = "Skipped Tests"
text = "0"
alignment = 2
max_length = 3
editable = false
context_menu_enabled = false
emoji_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
selecting_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_enabled = false
virtual_keyboard_enabled = false
[node name="icon" type="TextureRect" parent="MarginContainer/status_bar/SKIPPED/value" unique_id=932936779]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 4.0
offset_top = -8.0
offset_right = 20.0
offset_bottom = 8.0
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
stretch_mode = 2
[node name="buttons" type="VBoxContainer" parent="MarginContainer/status_bar/SKIPPED" unique_id=1650258492]
layout_mode = 2
size_flags_horizontal = 0
[node name="up" type="TextureButton" parent="MarginContainer/status_bar/SKIPPED/buttons" unique_id=357027687]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 10
[node name="down" type="TextureButton" parent="MarginContainer/status_bar/SKIPPED/buttons" unique_id=603266459]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 2
flip_v = true
[node name="ORPHAN" type="HBoxContainer" parent="MarginContainer/status_bar" unique_id=1284157443]
layout_mode = 2
tooltip_text = "Detected Orphan Nodes"
[node name="value" type="LineEdit" parent="MarginContainer/status_bar/ORPHAN" unique_id=629163801]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
tooltip_text = "Detected Orphan Nodes"
text = "0"
alignment = 2
max_length = 3
editable = false
context_menu_enabled = false
emoji_menu_enabled = false
shortcut_keys_enabled = false
middle_mouse_paste_enabled = false
selecting_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_enabled = false
virtual_keyboard_enabled = false
[node name="icon" type="TextureRect" parent="MarginContainer/status_bar/ORPHAN/value" unique_id=2121368482]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 4.0
offset_top = -8.0
offset_right = 20.0
offset_bottom = 8.0
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
stretch_mode = 2
[node name="buttons" type="VBoxContainer" parent="MarginContainer/status_bar/ORPHAN" unique_id=433516040]
layout_mode = 2
size_flags_horizontal = 0
[node name="up" type="TextureButton" parent="MarginContainer/status_bar/ORPHAN/buttons" unique_id=159317457]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 10
[node name="down" type="TextureButton" parent="MarginContainer/status_bar/ORPHAN/buttons" unique_id=1357830825]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 2
flip_v = true
[connection signal="pressed" from="tree_tools/tree_buttons/btn_tree_sync" to="." method="_on_btn_tree_sync_pressed"]
@@ -0,0 +1,104 @@
@tool
extends Control
const GdUnitInspectorTreeMainPanel := preload("res://addons/gdUnit4/src/ui/parts/GdUnitInspectorTreeMainPanel.gd")
@onready var _version_label: Control = %version
@onready var _button_wiki: Button = %help
@onready var _tool_button: Button = %tool
@onready var _button_run_overall: Button = %run_overall
@onready var _button_run: Button = %run
@onready var _button_run_debug: Button = %debug
@onready var _button_stop: Button = %stop
var inspector: GdUnitInspectorTreeMainPanel
var command_handler: GdUnitCommandHandler
func _ready() -> void:
command_handler = GdUnitCommandHandler.instance()
inspector = get_parent().get_parent().find_child("MainPanel", false, false)
if inspector == null:
push_error("Internal error, can't connect to the test inspector!")
else:
inspector.tree_item_selected.connect(_on_inspector_selected)
GdUnit4Version.init_version_label(_version_label)
GdUnitSignals.instance().gdunit_event.connect(_on_gdunit_event)
GdUnitSignals.instance().gdunit_settings_changed.connect(_on_settings_changed)
_init_buttons()
func _init_buttons() -> void:
_init_button(_button_run_overall, GdUnitCommandRunTestsOverall.ID)
_init_button(_button_run, GdUnitCommandInspectorRunTests.ID)
_init_button(_button_run_debug, GdUnitCommandInspectorDebugTests.ID)
_init_button(_button_stop, GdUnitCommandStopTestSession.ID)
_button_stop.icon = command_handler.command_icon(GdUnitCommandStopTestSession.ID)
_tool_button.icon = GdUnitUiTools.get_icon("Tools")
_button_wiki.icon = GdUnitUiTools.get_icon("HelpSearch")
# Set run buttons initial disabled
_button_run.disabled = true
_button_run_debug.disabled = true
func _init_button(button: Button, comand_id: String) -> void:
button.set_meta("GdUnitCommand", comand_id)
button.icon = command_handler.command_icon(comand_id)
button.shortcut = command_handler.command_shortcut(comand_id)
if button == _button_run_overall:
button.visible = GdUnitSettings.is_inspector_toolbar_button_show()
func _on_inspector_selected(item: TreeItem) -> void:
var button_disabled := item == null
_button_run.disabled = button_disabled
_button_run_debug.disabled = button_disabled
func _on_gdunit_event(event: GdUnitEvent) -> void:
if event.type() == GdUnitEvent.SESSION_START:
_button_run_overall.disabled = true
_button_run.disabled = true
_button_run_debug.disabled = true
_button_stop.disabled = false
return
if event.type() == GdUnitEvent.SESSION_CLOSE:
_button_run_overall.disabled = false
_button_stop.disabled = true
func _on_button_pressed(source: BaseButton) -> void:
var command_id: String = source.get_meta("GdUnitCommand")
await command_handler.command_execute(command_id)
func _on_wiki_pressed() -> void:
var status := OS.shell_open("https://godot-gdunit-labs.github.io/gdUnit4/latest")
if status != OK:
push_error("Can't open GdUnit4 documentaion page: %s" % error_string(status))
func _on_btn_tool_pressed() -> void:
var settings_dlg: Window = EditorInterface.get_base_control().find_child("GdUnitSettingsDialog", false, false)
if settings_dlg == null:
settings_dlg = preload("res://addons/gdUnit4/src/ui/settings/GdUnitSettingsDialog.tscn").instantiate()
EditorInterface.get_base_control().add_child(settings_dlg, true)
settings_dlg.popup_centered_ratio(.60)
func _on_settings_changed(property: GdUnitProperty) -> void:
# needs to wait a frame to be command handler notified first for settings changes
await get_tree().process_frame
_button_run_overall.visible = GdUnitSettings.is_inspector_toolbar_button_show()
if property.name().begins_with(GdUnitSettings.GROUP_SHORTCUT_INSPECTOR):
_button_run.shortcut = command_handler.command_shortcut(GdUnitCommandInspectorRunTests.ID)
_button_run_debug.shortcut = command_handler.command_shortcut(GdUnitCommandInspectorDebugTests.ID)
_button_run_overall.shortcut = command_handler.command_shortcut(GdUnitCommandRunTestsOverall.ID)
_button_stop.shortcut = command_handler.command_shortcut(GdUnitCommandStopTestSession.ID)
@@ -0,0 +1 @@
uid://birjse4jr7jbc
@@ -0,0 +1,150 @@
[gd_scene format=3 uid="uid://dx7xy4dgi3wwb"]
[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/parts/GdUnitInspectorToolBar.gd" id="3"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_c7rhl"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3erui"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p22nw"]
[sub_resource type="InputEventKey" id="InputEventKey_4j3on"]
alt_pressed = true
pressed = true
keycode = 4194338
physical_keycode = 4194338
[sub_resource type="Shortcut" id="Shortcut_5pa04"]
events = [SubResource("InputEventKey_4j3on")]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3lcek"]
[sub_resource type="InputEventKey" id="InputEventKey_85ykl"]
alt_pressed = true
pressed = true
keycode = 4194336
physical_keycode = 4194336
[sub_resource type="Shortcut" id="Shortcut_fpubx"]
events = [SubResource("InputEventKey_85ykl")]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ndw0i"]
[sub_resource type="InputEventKey" id="InputEventKey_1iti7"]
alt_pressed = true
pressed = true
keycode = 4194337
physical_keycode = 4194337
[sub_resource type="Shortcut" id="Shortcut_hpi24"]
events = [SubResource("InputEventKey_1iti7")]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_eoihf"]
[sub_resource type="InputEventKey" id="InputEventKey_hb3do"]
alt_pressed = true
pressed = true
keycode = 4194339
physical_keycode = 4194339
[sub_resource type="Shortcut" id="Shortcut_lm2q6"]
events = [SubResource("InputEventKey_hb3do")]
[node name="ToolBar" type="HBoxContainer" unique_id=295615556]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 32.0
grow_horizontal = 2
script = ExtResource("3")
[node name="tools" type="HBoxContainer" parent="." unique_id=753222103]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
[node name="help" type="Button" parent="tools" unique_id=1834372497]
unique_name_in_owner = true
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_c7rhl")
[node name="tool" type="Button" parent="tools" unique_id=144277615]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "GdUnit Settings"
theme_override_styles/normal = SubResource("StyleBoxEmpty_3erui")
[node name="controls" type="HBoxContainer" parent="." unique_id=108317981]
layout_mode = 2
size_flags_horizontal = 6
size_flags_vertical = 4
alignment = 1
[node name="VSeparator3" type="VSeparator" parent="controls" unique_id=1244151035]
layout_mode = 2
[node name="run_overall" type="Button" parent="controls" unique_id=95775836]
unique_name_in_owner = true
use_parent_material = true
layout_mode = 2
tooltip_text = "Run overall tests"
theme_override_styles/normal = SubResource("StyleBoxEmpty_p22nw")
shortcut = SubResource("Shortcut_5pa04")
metadata/GdUnitCommand = "Run Tests Overall"
[node name="run" type="Button" parent="controls" unique_id=121281977]
unique_name_in_owner = true
use_parent_material = true
layout_mode = 2
tooltip_text = "Rerun unit tests"
theme_override_styles/normal = SubResource("StyleBoxEmpty_3lcek")
disabled = true
shortcut = SubResource("Shortcut_fpubx")
metadata/GdUnitCommand = "Run Inspector Tests"
[node name="debug" type="Button" parent="controls" unique_id=1188465777]
unique_name_in_owner = true
use_parent_material = true
layout_mode = 2
tooltip_text = "Rerun unit tests (Debug)"
theme_override_styles/normal = SubResource("StyleBoxEmpty_ndw0i")
disabled = true
shortcut = SubResource("Shortcut_hpi24")
metadata/GdUnitCommand = "Debug Inspector Tests"
[node name="stop" type="Button" parent="controls" unique_id=2086070257]
unique_name_in_owner = true
use_parent_material = true
layout_mode = 2
tooltip_text = "Stops runing unit tests"
theme_override_styles/normal = SubResource("StyleBoxEmpty_eoihf")
disabled = true
shortcut = SubResource("Shortcut_lm2q6")
metadata/GdUnitCommand = "Stop Test Session"
[node name="VSeparator4" type="VSeparator" parent="controls" unique_id=1661024234]
layout_mode = 2
[node name="CenterContainer" type="HBoxContainer" parent="." unique_id=1521483443]
use_parent_material = true
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 4
alignment = 2
[node name="version" type="Label" parent="CenterContainer" unique_id=558200171]
unique_name_in_owner = true
auto_translate_mode = 2
use_parent_material = true
layout_mode = 2
size_flags_horizontal = 2
size_flags_vertical = 13
localize_numeral_system = false
horizontal_alignment = 1
justification_flags = 160
[connection signal="pressed" from="tools/help" to="." method="_on_wiki_pressed"]
[connection signal="pressed" from="tools/tool" to="." method="_on_btn_tool_pressed"]
[connection signal="pressed" from="controls/run_overall" to="." method="_on_button_pressed" flags=18]
[connection signal="pressed" from="controls/run" to="." method="_on_button_pressed" flags=18]
[connection signal="pressed" from="controls/debug" to="." method="_on_button_pressed" flags=18]
[connection signal="pressed" from="controls/stop" to="." method="_on_button_pressed" flags=18]
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
uid://7elllplde43b
@@ -0,0 +1,133 @@
[gd_scene format=3 uid="uid://bqfpidewtpeg0"]
[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/parts/GdUnitInspectorTreeMainPanel.gd" id="1"]
[ext_resource type="PackedScene" path="res://addons/gdUnit4/src/ui/menu/GdUnitInspectorContextMenu.tscn" id="2_o6s0p"]
[ext_resource type="PackedScene" path="res://addons/gdUnit4/src/ui/parts/GdUnitReportPanel.tscn" id="3_miuuy"]
[sub_resource type="DPITexture" id="DPITexture_njcuo"]
_source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#e0e0e0\" d=\"M4 12a1 1 0 0 0 1.555.832l6-4a1 1 0 0 0 0-1.664l-6-4A1 1 0 0 0 4 4z\"/></svg>
"
saturation = 2.0
color_map = {
Color(1, 0.37254903, 0.37254903, 1): Color(1, 0.47, 0.42, 1),
Color(0.37254903, 1, 0.5921569, 1): Color(0.45, 0.95, 0.5, 1),
Color(1, 0.8666667, 0.39607844, 1): Color(0.83, 0.78, 0.62, 1)
}
[sub_resource type="DPITexture" id="DPITexture_o05pk"]
_source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#e0e0e0\" d=\"M3 3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm4.975 0A1 1 0 0 0 7 3.998v8a1 1 0 0 0 1.625.781l5-4a1 1 0 0 0 0-1.56l-5-4A1 1 0 0 0 7.975 3z\"/></svg>
"
saturation = 2.0
color_map = {
Color(1, 0.37254903, 0.37254903, 1): Color(1, 0.47, 0.42, 1),
Color(0.37254903, 1, 0.5921569, 1): Color(0.45, 0.95, 0.5, 1),
Color(1, 0.8666667, 0.39607844, 1): Color(0.83, 0.78, 0.62, 1)
}
[sub_resource type="DPITexture" id="DPITexture_njtpf"]
_source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#e0e0e0\" d=\"m8 9.669-3.536 2.583H7v2.537h2v-2.537h2.536zm0-3.314L4.464 3.772H7V1.235h2v2.537h2.536zm-7.296.73h14.591v1.831H.704z\"/></svg>
"
saturation = 2.0
color_map = {
Color(1, 0.37254903, 0.37254903, 1): Color(1, 0.47, 0.42, 1),
Color(0.37254903, 1, 0.5921569, 1): Color(0.45, 0.95, 0.5, 1),
Color(1, 0.8666667, 0.39607844, 1): Color(0.83, 0.78, 0.62, 1)
}
[sub_resource type="DPITexture" id="DPITexture_eg3rq"]
_source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#e0e0e0\" d=\"m8 16-3.5-2.5H7V11h2v2.5h2.5zM8 0 4.5 2.5H7V5h2V2.5h2.5zM1 7h14v2H1z\"/></svg>
"
saturation = 2.0
color_map = {
Color(1, 0.37254903, 0.37254903, 1): Color(1, 0.47, 0.42, 1),
Color(0.37254903, 1, 0.5921569, 1): Color(0.45, 0.95, 0.5, 1),
Color(1, 0.8666667, 0.39607844, 1): Color(0.83, 0.78, 0.62, 1)
}
[node name="MainPanel" type="Control" unique_id=944258025]
custom_minimum_size = Vector2(120, 240)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1")
[node name="contextMenu" parent="." unique_id=73764904 instance=ExtResource("2_o6s0p")]
unique_name_in_owner = true
visible = false
item_0/icon = SubResource("DPITexture_njcuo")
item_1/icon = SubResource("DPITexture_o05pk")
item_2/icon = SubResource("DPITexture_njcuo")
item_4/icon = SubResource("DPITexture_njtpf")
item_5/icon = SubResource("DPITexture_eg3rq")
[node name="split" type="VSplitContainer" parent="." unique_id=1044515559]
clip_contents = true
custom_minimum_size = Vector2(0, 160)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/autohide = 0
split_offsets = PackedInt32Array(120)
split_offset = 120
[node name="Panel" type="Panel" parent="split" unique_id=290722553]
custom_minimum_size = Vector2(0, 120)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Tree" type="Tree" parent="split/Panel" unique_id=741772884]
unique_name_in_owner = true
use_parent_material = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/icon_max_width = 16
columns = 2
allow_reselect = true
allow_rmb_select = true
hide_root = true
select_mode = 1
[node name="discover_hint" type="HBoxContainer" parent="split/Panel" unique_id=555683311]
unique_name_in_owner = true
visible = false
use_parent_material = true
layout_mode = 0
alignment = 1
[node name="spinner" type="Button" parent="split/Panel/discover_hint" unique_id=200472082]
unique_name_in_owner = true
clip_contents = true
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_stretch_ratio = 1.94
disabled = true
button_mask = 0
text = "Discover Tests"
flat = true
alignment = 2
[node name="report" parent="split" unique_id=1465857421 instance=ExtResource("3_miuuy")]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 40)
layout_mode = 2
[connection signal="item_activated" from="split/Panel/Tree" to="." method="_on_Tree_item_activated"]
[connection signal="item_mouse_selected" from="split/Panel/Tree" to="." method="_on_tree_item_mouse_selected"]
[connection signal="item_selected" from="split/Panel/Tree" to="." method="_on_Tree_item_selected"]
@@ -0,0 +1,62 @@
@tool
class_name GdUnitReportPanel
extends Panel
@onready var report_list: Node = %report_list
@onready var message_template: RichTextLabel = %message
func clear() -> void:
for child in report_list.get_children():
report_list.remove_child(child)
child.queue_free()
func show_report(reports: Array[GdUnitReport]) -> void:
clear()
for report in reports:
report_list.add_child(build_report(report))
func build_report(report: GdUnitReport) -> RichTextLabel:
var message: RichTextLabel = message_template.duplicate()
GdUnitFonts.init_fonts(message)
message.push_color(GdUnitEditorColorTheme.text_color)
message.append_text(report.message())
message.pop()
add_stack_trace(message, report.stack_trace())
message.visible = true
return message
func add_stack_trace(message: RichTextLabel, trace: GdUnitStackTrace) -> void:
if trace == null:
return
message.newline()
for frame in trace.get_frames():
message.push_indent(1)
message.push_meta(frame, RichTextLabel.META_UNDERLINE_ON_HOVER, frame._source)
message.push_color(GdUnitEditorColorTheme.text_color)
message.append_text("at ")
message.push_color(GdUnitEditorColorTheme.function_definition_color)
message.append_text(frame._function)
message.pop()
message.append_text(" in ")
message.pop()
message.push_color(GdUnitEditorColorTheme.engine_type_color)
message.append_text(frame._source.get_file())
message.append_text(" : ")
message.append_text(str(frame._line))
message.pop() # push_color
message.pop() # push_meta
message.pop() # push_indent
message.newline()
if not message.meta_clicked.is_connected(_on_meta_clicked):
message.meta_clicked.connect(_on_meta_clicked)
func _on_meta_clicked(meta: Variant) -> void:
var frame: GdUnitStackTraceElement = meta
GdUnitScriptEditorControls.edit_script(frame._source, frame._line)
@@ -0,0 +1 @@
uid://dhcy3bq74qcl0
@@ -0,0 +1,47 @@
[gd_scene format=3 uid="uid://dga8nhaxnyr53"]
[ext_resource type="Script" path="res://addons/gdUnit4/src/ui/parts/GdUnitReportPanel.gd" id="1_w8qy0"]
[node name="report" type="Panel" unique_id=1075065511]
clip_contents = true
custom_minimum_size = Vector2(120, 80)
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1_w8qy0")
[node name="message" type="RichTextLabel" parent="." unique_id=1680360176]
unique_name_in_owner = true
auto_translate_mode = 2
visible = false
layout_mode = 0
size_flags_horizontal = 3
size_flags_vertical = 3
focus_mode = 2
mouse_filter = 1
bbcode_enabled = true
fit_content = true
autowrap_mode = 0
selection_enabled = true
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=385317760]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
[node name="report_list" type="VBoxContainer" parent="ScrollContainer" unique_id=1467163528]
unique_name_in_owner = true
clip_contents = true
custom_minimum_size = Vector2(120, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 2
theme_override_constants/separation = 2