test(m62-c): wire the ink checker into the guild, contract and readiness probes

This commit is contained in:
2026-09-14 00:37:57 +08:00
parent 1b0bb88c29
commit e2cbfb212e
3 changed files with 83 additions and 0 deletions
+28
View File
@@ -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: