Fix normal radio report submission
Full build / Import + headless tests (push) Successful in 38s
Full build / Full desktop build + optional release (push) Failing after 4m22s

The radio button was connected only to the emergency hold handlers, so a
normal Send request never reached _submit. Connect pressed for non-emergency
calls while keeping hold-to-confirm exclusive to emergencies, and add tests
for click, short-hold rejection and full emergency hold. Headless 249/249,
Python 94/94.
This commit is contained in:
zwitschi committed 2026-11-01 21:37:39 +01:00
1 parent aa51ee331e
commit fac9b002c3
9 files changed
+62 -8

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
extends RefCounted
## Radio form submission: normal calls send on click; emergency calls require
## the documented hold and do not submit on a quick release.
const RadioPanel := preload("res://src/game/ui/radio_panel.gd")
func test_normal_radio_sends_on_click() -> bool:
var panel: RadioPanel = RadioPanel.new()
var got := {}
panel.submitted.connect(func(report, emergency):
got["report"] = report
got["emergency"] = emergency)
panel.open(null, false, {})
panel.action_button.pressed.emit()
var a := TestUtils.check(got.has("report"), "normal click emits a report")
var b := TestUtils.check(not bool(got.get("emergency", true)), "normal report is not emergency")
var c := TestUtils.check(not panel.visible, "panel closes after sending")
var d := TestUtils.check_eq(str(got.get("report", {}).get("location", "")), "front entrance",
"default location is included")
panel.free()
return a and b and c and d
func test_emergency_requires_hold() -> bool:
var panel: RadioPanel = RadioPanel.new()
var calls := {"count": 0}
panel.submitted.connect(func(_report, _emergency):
calls["count"] = int(calls["count"]) + 1)
panel.open(null, true, {})
panel.action_button.pressed.emit()
var a := TestUtils.check_eq(int(calls["count"]), 0, "quick emergency click does not send")
panel.action_button.button_down.emit()
panel._process(0.2)
panel.action_button.button_up.emit()
var b := TestUtils.check_eq(int(calls["count"]), 0, "short hold does not send")
panel.action_button.button_down.emit()
panel._process(RadioPanel.HOLD_NEEDED + 0.1)
var c := TestUtils.check_eq(int(calls["count"]), 1, "full hold sends exactly once")
panel.free()
return a and b and c