fix(ui): PR #195 review round — attractor stroke widths zoom-compensated (Tyre I1/I2/I3)
I1: _draw_attractor_shape's three stroke-width args (Confluence arc, Coastal/NaturalHarbor arc, Oasis spokes) were raw screen-space literals — Godot multiplies stroke widths by canvas scale exactly like radii, so at the Region orbital fit zoom the outlines rasterized at ~0.01px, the identical sub-pixel class the dot/ring compensation fixed, missed on glyph internals (and attractors are Region-only — precisely where it bites). Widths now arrive pre-compensated via a px_w param, keeping the primitive pure. Regression pin: a source-scan test asserting no draw_arc/draw_line in the function carries a bare numeric width (the draw-smoke suite documents its own vacuous-pass mode, so source-scan is the environment-independent gate); revert-verified by name. I2: D-226 visibility-direction sentence — Araminta's fade-down inversion recorded as pre-T-1170 with its single revisit point named. I3: class-header call-site claim corrected (enter() funnels through _enter_at_rung). Tickets: T-1156 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -216,3 +216,40 @@ func test_draw_with_zero_grid_dims_returns_before_any_draw_call() -> void:
|
||||
SimBridge.atlas_layers_received.emit(_mock_response("GJ380c", layer1))
|
||||
o._draw() # grid_w<=0 -> returns before touching the canvas — safe to call directly
|
||||
assert_that(o.get_layer1()).is_not_null()
|
||||
|
||||
|
||||
## PR #195 review (Tyre I1) regression pin: every stroke-WIDTH argument in
|
||||
## _draw_attractor_shape() must route through the pre-compensated `px_w`
|
||||
## param, never a raw numeric literal — Godot multiplies stroke widths by the
|
||||
## canvas scale exactly like radii, so a raw `2.0` rasterizes at ~0.01px at
|
||||
## the Region orbital fit zoom (the identical sub-pixel failure the dot/ring
|
||||
## zoom compensation fixed, missed on glyph outlines in the first pass). The
|
||||
## draw-smoke suite cannot gate this (its own header documents the vacuous-
|
||||
## pass mode under X11 BadMatch), so this is a SOURCE-SCAN pin: parse the
|
||||
## overlay script's _draw_attractor_shape body and assert no draw_arc/
|
||||
## draw_line call carries a bare numeric width literal. Crude but
|
||||
## environment-independent, and it pins the exact regression class (someone
|
||||
## reintroducing a literal width in a new glyph arm).
|
||||
func test_attractor_shape_stroke_widths_are_never_raw_literals() -> void:
|
||||
var src: String = (
|
||||
FileAccess.get_file_as_string("res://ui/implant/apps/atlas/atlas_window_nature_overlay.gd")
|
||||
)
|
||||
var fn_start := src.find("func _draw_attractor_shape(")
|
||||
assert_that(fn_start).override_failure_message(
|
||||
"_draw_attractor_shape must exist in atlas_window_nature_overlay.gd"
|
||||
).is_not_equal(-1)
|
||||
var next_fn := src.find("\nfunc ", fn_start + 1)
|
||||
var body := src.substr(fn_start, (next_fn - fn_start) if next_fn != -1 else -1)
|
||||
var stroke_re := RegEx.new()
|
||||
# A draw_arc/draw_line call whose FINAL (width) argument is a bare numeric
|
||||
# literal: `, <digits[.digits]>)` at call end. px_w-scaled forms
|
||||
# (`px_w`, `2.0 * px_w`) do not match.
|
||||
stroke_re.compile("draw_(arc|line)\\([^\\n]*,\\s*\\d+(\\.\\d+)?\\s*\\)")
|
||||
var hits := stroke_re.search_all(body)
|
||||
var offenders: Array[String] = []
|
||||
for hit in hits:
|
||||
offenders.append(hit.get_string())
|
||||
assert_array(offenders).override_failure_message(
|
||||
"raw numeric stroke width(s) in _draw_attractor_shape — route through"
|
||||
+ " px_w (PR #195 Tyre I1): %s" % [offenders]
|
||||
).is_empty()
|
||||
|
||||
Reference in New Issue
Block a user