j132 strafe display check: also assert the chosen tile's ramp border and value plate reach the SVG

This commit is contained in:
2026-09-26 11:54:14 +02:00
parent cc332138b3
commit 0566264b06
@@ -91,6 +91,7 @@ proc main() =
svgTicks = 0 ## ticks whose overlay was rendered and inspected
svgBad = 0 ## the chosen tile's heat NUMBER is not in the SVG
svgNoPlate = 0 ## the chosen tile's dark value plate is not in the SVG
svgNoRamp = 0 ## the chosen tile's ramp border is not in the SVG
for tick, ws in states:
# The GUI half: render the overlay for the first `DrawWindow` ticks, with
@@ -99,8 +100,9 @@ proc main() =
# Drawing is read-only, so the pick sequence stays byte-identical; the SVG
# buffer is cleared every tick exactly as the framework does.
m.debugGraphics = tick < DrawWindow
let gridOn = (tick mod 2 == 0)
if m.debugGraphics:
StrafeHeatGrid = (tick mod 2 == 0)
StrafeHeatGrid = gridOn
clearGraphics()
discard m.computeMove(ws)
@@ -111,9 +113,16 @@ proc main() =
clearGraphics()
if m.targetValid and svg.len > 0:
inc svgTicks
# The number printed ON the chosen tile, as the SVG sees it.
if not svg.contains(fmt">{m.targetPathHeat:.1f}</text>"): inc svgBad
# The chosen tile's ramp-coloured thick border + its dark value plate
# (both unique to the chosen-tile block, drawn whether or not the heat
# grid is on), and - with the grid ON only the chosen tile is labelled,
# so the number in the SVG is provably the chosen tile's -
# the chosen tile's heat NUMBER, as the SVG sees it.
if not svg.contains("stroke-width=\"3.5\""): inc svgNoRamp
if not svg.contains("stroke=\"" & heatRamp(m.targetPathHeat).toHex & "\""):
inc svgNoRamp
if not svg.contains("fill=\"#000000\""): inc svgNoPlate
if gridOn and not svg.contains(fmt">{m.targetPathHeat:.1f}</text>"): inc svgBad
if not m.targetValid: continue
inc targetTicks
@@ -161,8 +170,10 @@ proc main() =
fmt"({under} under / {over} over, {labelBad} bad)", labelBad == 0
check fmt"`strafeHeatText` carries the displayed number ({textBad} bad)",
textBad == 0
check fmt"the chosen tile's heat NUMBER is rendered on the tile, grid ON " &
fmt"and OFF ({svgTicks} rendered ticks, {svgBad} missing)", svgBad == 0
check fmt"the chosen tile's heat NUMBER is rendered on the tile with the " &
fmt"heat grid ON ({svgTicks} rendered ticks, {svgBad} missing)", svgBad == 0
check fmt"the chosen tile's ramp border is rendered ({svgNoRamp} missing)",
svgNoRamp == 0
check fmt"the chosen tile's value plate is rendered ({svgNoPlate} missing)",
svgNoPlate == 0
check "the stream contains picks to check", picks > 0