j132 strafe display check: also assert the chosen tile's ramp border and value plate reach the SVG
This commit is contained in:
@@ -91,6 +91,7 @@ proc main() =
|
|||||||
svgTicks = 0 ## ticks whose overlay was rendered and inspected
|
svgTicks = 0 ## ticks whose overlay was rendered and inspected
|
||||||
svgBad = 0 ## the chosen tile's heat NUMBER is not in the SVG
|
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
|
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:
|
for tick, ws in states:
|
||||||
# The GUI half: render the overlay for the first `DrawWindow` ticks, with
|
# 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
|
# Drawing is read-only, so the pick sequence stays byte-identical; the SVG
|
||||||
# buffer is cleared every tick exactly as the framework does.
|
# buffer is cleared every tick exactly as the framework does.
|
||||||
m.debugGraphics = tick < DrawWindow
|
m.debugGraphics = tick < DrawWindow
|
||||||
|
let gridOn = (tick mod 2 == 0)
|
||||||
if m.debugGraphics:
|
if m.debugGraphics:
|
||||||
StrafeHeatGrid = (tick mod 2 == 0)
|
StrafeHeatGrid = gridOn
|
||||||
clearGraphics()
|
clearGraphics()
|
||||||
|
|
||||||
discard m.computeMove(ws)
|
discard m.computeMove(ws)
|
||||||
@@ -111,9 +113,16 @@ proc main() =
|
|||||||
clearGraphics()
|
clearGraphics()
|
||||||
if m.targetValid and svg.len > 0:
|
if m.targetValid and svg.len > 0:
|
||||||
inc svgTicks
|
inc svgTicks
|
||||||
# The number printed ON the chosen tile, as the SVG sees it.
|
# The chosen tile's ramp-coloured thick border + its dark value plate
|
||||||
if not svg.contains(fmt">{m.targetPathHeat:.1f}</text>"): inc svgBad
|
# (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 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
|
if not m.targetValid: continue
|
||||||
inc targetTicks
|
inc targetTicks
|
||||||
@@ -161,8 +170,10 @@ proc main() =
|
|||||||
fmt"({under} under / {over} over, {labelBad} bad)", labelBad == 0
|
fmt"({under} under / {over} over, {labelBad} bad)", labelBad == 0
|
||||||
check fmt"`strafeHeatText` carries the displayed number ({textBad} bad)",
|
check fmt"`strafeHeatText` carries the displayed number ({textBad} bad)",
|
||||||
textBad == 0
|
textBad == 0
|
||||||
check fmt"the chosen tile's heat NUMBER is rendered on the tile, grid ON " &
|
check fmt"the chosen tile's heat NUMBER is rendered on the tile with the " &
|
||||||
fmt"and OFF ({svgTicks} rendered ticks, {svgBad} missing)", svgBad == 0
|
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)",
|
check fmt"the chosen tile's value plate is rendered ({svgNoPlate} missing)",
|
||||||
svgNoPlate == 0
|
svgNoPlate == 0
|
||||||
check "the stream contains picks to check", picks > 0
|
check "the stream contains picks to check", picks > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user