# Navigation stress: the sequence that used to kill warden-ui.
#
# Settings > Apps reads the PROJECTED MENU TABLE (app.c's all_proj, populated
# lazily on that page's first build). Walking the app rows writes one timestamp
# per row into app.c's s_row_left. While that array was sized 8 and the shipped
# registry projected 18 rows, leaving any row from index 8 up wrote past it --
# straight over all_count and all_proj, which the linker places immediately
# after. Coming back to Settings > Apps then walked a tick value as a `const
# char *` and the process died with SIGSEGV (rc=139).
#
# So the order matters and is the whole test: populate the table, walk the late
# rows, come BACK. A run that only walks rows never triggers it, because with
# all_count still zero the page's lazy init quietly repairs the array.
#
# Run: ui-drive.sh <zImage> tests/scripts/nav-stress.txt <outdir>
# PASS is ui-drive.sh finding no "warden-ui EXITED" on the console.

echo == populate the projected menu table
tap 47 676
sleep 2
tap 464 40
sleep 4
shot 01-apps-first

echo == back to column 0, where the rail is on screen
tap 174 40
sleep 2

echo == walk the app rows, the late ones included
tap 47 512
sleep 2
tap 47 592
sleep 2
swipe 47 560 47 220 500
sleep 1
tap 47 420
sleep 2
tap 47 500
sleep 2
swipe 47 560 47 220 500
sleep 1
tap 47 380
sleep 2
tap 47 520
sleep 2
shot 02-late-rows

echo == and back: this is the step that used to segfault
tap 47 676
sleep 2
tap 464 40
sleep 4
shot 03-apps-again
sleep 3
shot 04-still-alive
