From a89e744ed0e8c759caf041a580112365bbfe4303 Mon Sep 17 00:00:00 2001 From: radiohotline Date: Tue, 25 Aug 2026 16:33:56 +0300 Subject: escoria update --- .../gdUnit4/src/ui/parts/InspectorProgressBar.gd | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 addons/gdUnit4/src/ui/parts/InspectorProgressBar.gd (limited to 'addons/gdUnit4/src/ui/parts/InspectorProgressBar.gd') diff --git a/addons/gdUnit4/src/ui/parts/InspectorProgressBar.gd b/addons/gdUnit4/src/ui/parts/InspectorProgressBar.gd new file mode 100644 index 0000000..d368ed3 --- /dev/null +++ b/addons/gdUnit4/src/ui/parts/InspectorProgressBar.gd @@ -0,0 +1,49 @@ +@tool +extends ProgressBar + + +@onready var status: Label = $Label +@onready var style: StyleBoxFlat = get("theme_override_styles/fill") + +var _state: GdUnitInspectorTreeConstants.STATE + +func _ready() -> void: + style.bg_color = Color.DARK_GREEN + value = 0 + max_value = 0 + update_text() + + +func update_text() -> void: + status.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: + style.bg_color = Color.DARK_GREEN + + # do only update the state is higher prio than current state + if state <= _state: + return + _state = state + + if is_flaky(state): + style.bg_color = Color.WEB_GREEN + if is_failed(state): + style.bg_color = Color.DARK_RED + + +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 -- cgit v1.3