Add unique identifier for test_phase3c_walk_recovery.gd

This commit is contained in:
2026-09-06 13:09:37 -04:00
parent 1f91f3d2e5
commit 80595a0273
53 changed files with 6806 additions and 471 deletions
+18 -20
View File
@@ -31,7 +31,9 @@
# * `_cancel_rule_build()` clears the anchor.
# * `_finalize_rule()` clears the anchor.
# * `_clear_director_pending()` (mode exit) clears the anchor.
# * `_begin_edit_rule(id)` records a fresh anchor.
# * `_begin_edit_rule(id)` (Phase 3c) opens the consequence-only RuleEditor
# for the rule (the old Phase 4b in-place builder flow was replaced by the
# Phase 3c editor tools).
# * `_reset_rule_builder()` does NOT clear the anchor (TRIG_BACK invariant).
#
# Run with:
@@ -71,7 +73,7 @@ func _run() -> void:
_test_cancel_clears_anchor()
_test_confirm_clears_anchor()
_test_mode_exit_clears_anchor()
await _test_edit_rule_records_fresh_anchor()
await _test_edit_rule_opens_consequence_editor()
_test_reset_preserves_anchor()
print("--------------------------------------------------------")
@@ -369,9 +371,9 @@ func _test_mode_exit_clears_anchor() -> void:
# Edit-rule entry records a fresh anchor
# ---------------------------------------------------------------------------
func _test_edit_rule_records_fresh_anchor() -> void:
func _test_edit_rule_opens_consequence_editor() -> void:
print("")
print("--- _begin_edit_rule() records a fresh anchor ---")
print("--- _begin_edit_rule() opens the consequence-only rule editor (Phase 3c) ---")
var stage := _new_stage()
var rig: StickmanRig = stage._spawner.spawn("stickman", Vector2(0, 0))
_check(rig != null, "stickman rig spawns for the edit-rule test")
@@ -396,23 +398,19 @@ func _test_edit_rule_records_fresh_anchor() -> void:
var rules_arr: Array[Dictionary] = [stored_rule]
stage._event_rules = rules_arr
# A stale anchor from a previous session must be replaced, not reused.
stage._set_popup_anchor(Rect2i(1, 2, 0, 0))
stage._begin_edit_rule(0)
var mouse_rect: Rect2i = stage._mouse_popup_rect()
_check(stage._popup_anchor_set,
"edit-rule entry records the anchor (set flag on)")
_check(stage._popup_anchor == mouse_rect,
"edit-rule entry records a FRESH mouse rect (got %s, mouse %s)"
% [str(stage._popup_anchor), str(mouse_rect)])
_check(stage._rule_editing_id == 0,
"edit-rule entry arms _rule_editing_id (got %d)" % stage._rule_editing_id)
_check(int(stage._rule_step) == 3,
"edit-rule entry sits at SELECT_ACTION (got %d)" % int(stage._rule_step))
_check(stage._rule_context_rig == rig,
"edit-rule entry resolves the rule source rig")
_check(stage._rule_action_popup.visible,
"edit-rule entry opens the rule-action popup")
_check(stage._rule_editor != null, "rule editor exists on the stage")
_check(stage._rule_editor.visible, "edit-rule entry opens the RuleEditor popup")
_check(stage._rule_editor._mode == "consequence",
"edit-rule entry uses consequence-only mode (got '%s')" % stage._rule_editor._mode)
_check(stage._rule_editor._rule_id == 0,
"edit-rule entry preserves the rule id (got %d)" % stage._rule_editor._rule_id)
_check(stage._rule_editor._actions.size() == 1,
"edit-rule entry loads the rule's actions")
_check(stage._rule_editor._trigger_readonly_label.visible,
"consequence editor shows the trigger as read-only")
_check(stage._rule_editor._trigger_readonly_label.text.contains("Completes any action"),
"consequence editor summarizes the trigger (got '%s')" % stage._rule_editor._trigger_readonly_label.text)
await _free_stage(stage)