From e2cbfb212e1c9bc1bb49a202e0a8880f97bc4880 Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Mon, 14 Sep 2026 00:37:57 +0800 Subject: [PATCH] test(m62-c): wire the ink checker into the guild, contract and readiness probes --- runtime/tools/m53_guild_visual_probe.gd | 28 +++++++++++++++++++ runtime/tools/m54_contract_visual_probe.gd | 28 +++++++++++++++++++ .../m55_readiness_result_visual_probe.gd | 27 ++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/runtime/tools/m53_guild_visual_probe.gd b/runtime/tools/m53_guild_visual_probe.gd index 72490f90..ea0d9279 100644 --- a/runtime/tools/m53_guild_visual_probe.gd +++ b/runtime/tools/m53_guild_visual_probe.gd @@ -1,8 +1,11 @@ extends SceneTree const GuildView = preload("res://entry/views/guild_page_view.gd") +const InkCheck = preload("res://tools/ui_ink_check.gd") const FIXTURES := [Vector2i(760, 360), Vector2i(844, 390), Vector2i(1280, 720)] const LOCALES := ["zh_CN", "en"] +var ink_scanned := 0 +var ink_violations: Array = [] func _initialize() -> void: call_deferred("_run") @@ -14,12 +17,36 @@ func _run() -> void: quit(1) return DirAccess.make_dir_recursive_absolute(out) + var ink_self := InkCheck.self_test(root) + if ink_self.size() < 3: + push_error("M62 ink self-test expected at least 3 violations, got %d" % ink_self.size()) + quit(1) + return + print("ABG_M62_INK_SELF_TEST_OK violations=%d" % ink_self.size()) + ink_scanned = 0 + ink_violations = [] for fixture in FIXTURES: for locale in LOCALES: await _capture_fixture(fixture, locale, out) + if not ink_violations.is_empty(): + for violation in ink_violations: + push_error("M62 ink violation %s %s: %s" % [violation.node, violation.kind, violation.detail]) + print("ABG_M62_INK_CHECK_FAIL scanned=%d violations=%d" % [ink_scanned, ink_violations.size()]) + quit(1) + return + print("ABG_M62_INK_CHECK_OK scanned=%d violations=0" % ink_scanned) print("ABG_M53_GUILD_VISUAL_PROBE_OK fixtures=3 locales=2 views=static,dynamic,final") quit(0) + +func _scan_ink(view: Control, locale: String, label: String) -> void: + var violations := InkCheck.scan(view) + ink_scanned += 1 + for violation in violations: + violation["locale"] = locale + violation["fixture"] = label + ink_violations.append(violation) + func _capture_fixture(fixture: Vector2i, locale: String, out: String) -> void: root.size = Vector2(fixture) var capture_viewport := SubViewport.new() @@ -35,6 +62,7 @@ func _capture_fixture(fixture: Vector2i, locale: String, out: String) -> void: capture_viewport.add_child(view) view.render({"ok": true, "locale": locale, "company": {"owned_count": 2, "coin": 38, "display_recruits": []}, "destinations": {}, "recruits": [], "notice": ""}) await _settle() + _scan_ink(view, locale, "%dx%d" % [fixture.x, fixture.y]) _save(capture_viewport, out, locale, fixture, "final") var overlay := view.find_child("GuildAnchorRoot", true, false) as Control if overlay != null: diff --git a/runtime/tools/m54_contract_visual_probe.gd b/runtime/tools/m54_contract_visual_probe.gd index 6cc60486..a8440da0 100644 --- a/runtime/tools/m54_contract_visual_probe.gd +++ b/runtime/tools/m54_contract_visual_probe.gd @@ -1,8 +1,11 @@ extends SceneTree const View = preload("res://entry/views/contract_choice_page_view.gd") +const InkCheck = preload("res://tools/ui_ink_check.gd") const FIXTURES := [Vector2i(760, 360), Vector2i(844, 390), Vector2i(1280, 720)] const LOCALES := ["zh_CN", "en"] +var ink_scanned := 0 +var ink_violations: Array = [] func _initialize() -> void: call_deferred("_run") @@ -14,12 +17,36 @@ func _run() -> void: quit(1) return DirAccess.make_dir_recursive_absolute(out) + var ink_self := InkCheck.self_test(root) + if ink_self.size() < 3: + push_error("M62 ink self-test expected at least 3 violations, got %d" % ink_self.size()) + quit(1) + return + print("ABG_M62_INK_SELF_TEST_OK violations=%d" % ink_self.size()) + ink_scanned = 0 + ink_violations = [] for fixture in FIXTURES: for locale in LOCALES: await _capture(fixture, locale, out) + if not ink_violations.is_empty(): + for violation in ink_violations: + push_error("M62 ink violation %s %s: %s" % [violation.node, violation.kind, violation.detail]) + print("ABG_M62_INK_CHECK_FAIL scanned=%d violations=%d" % [ink_scanned, ink_violations.size()]) + quit(1) + return + print("ABG_M62_INK_CHECK_OK scanned=%d violations=0" % ink_scanned) print("ABG_M54_CONTRACT_VISUAL_PROBE_OK fixtures=3 locales=2 views=static,dynamic,final") quit(0) + +func _scan_ink(view: Control, locale: String, label: String) -> void: + var violations := InkCheck.scan(view) + ink_scanned += 1 + for violation in violations: + violation["locale"] = locale + violation["fixture"] = label + ink_violations.append(violation) + func _capture(fixture: Vector2i, locale: String, out: String) -> void: var viewport := SubViewport.new() viewport.size = fixture @@ -32,6 +59,7 @@ func _capture(fixture: Vector2i, locale: String, out: String) -> void: viewport.add_child(view) view.render(_fixture(locale)) await _settle() + _scan_ink(view, locale, "%dx%d" % [fixture.x, fixture.y]) _save(viewport, out, fixture, locale, "final") var overlay := view.find_child("ContractChoiceFrame", true, false) as Control if overlay != null: diff --git a/runtime/tools/m55_readiness_result_visual_probe.gd b/runtime/tools/m55_readiness_result_visual_probe.gd index dc851cf2..ef7e8199 100644 --- a/runtime/tools/m55_readiness_result_visual_probe.gd +++ b/runtime/tools/m55_readiness_result_visual_probe.gd @@ -1,20 +1,47 @@ extends SceneTree const Readiness = preload("res://entry/views/readiness_page_view.gd") const Result = preload("res://entry/views/battle_result_page_view.gd") +const InkCheck = preload("res://tools/ui_ink_check.gd") const SIZES := [Vector2i(760,360), Vector2i(844,390), Vector2i(1280,720)] const LOCALES := ["zh_CN", "en"] +var ink_scanned := 0 +var ink_violations: Array = [] func _initialize() -> void: call_deferred("_run") func _run() -> void: var out := OS.get_environment("ABG_EVIDENCE_DIR") if out.is_empty(): quit(1); return DirAccess.make_dir_recursive_absolute(out) + var ink_self := InkCheck.self_test(root) + if ink_self.size() < 3: + push_error("M62 ink self-test expected at least 3 violations, got %d" % ink_self.size()) + quit(1) + return + print("ABG_M62_INK_SELF_TEST_OK violations=%d" % ink_self.size()) + ink_scanned = 0 + ink_violations = [] for size in SIZES: for locale in LOCALES: for mode in ["static", "dynamic", "final"]: await _capture(Readiness, _readiness_data(locale), size, locale, "readiness", out, mode) await _capture(Result, _result_data(locale), size, locale, "result", out) + if not ink_violations.is_empty(): + for violation in ink_violations: + push_error("M62 ink violation %s %s: %s" % [violation.node, violation.kind, violation.detail]) + print("ABG_M62_INK_CHECK_FAIL scanned=%d violations=%d" % [ink_scanned, ink_violations.size()]) + quit(1) + return + print("ABG_M62_INK_CHECK_OK scanned=%d violations=0" % ink_scanned) print("ABG_M55_READINESS_RESULT_VISUAL_PROBE_OK sizes=3 locales=2 pages=2") quit(0) + +func _scan_ink(view: Control, locale: String, label: String) -> void: + var violations := InkCheck.scan(view) + ink_scanned += 1 + for violation in violations: + violation["locale"] = locale + violation["fixture"] = label + ink_violations.append(violation) + func _capture(script: Script, data: Dictionary, size: Vector2i, locale: String, page: String, out: String, mode := "final") -> void: var viewport := SubViewport.new(); viewport.size = size; viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS; root.add_child(viewport) var view: Control = script.new(); view.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT); view.configure_presentation({"safe_area":24,"text_scale":1.0,"locale":locale}); viewport.add_child(view); view.render(data)