code wiki / _hdl_build / nx_browser_user_sim.nx
nx_browser_user_sim.nx
buildroot/runtime/_hdl_build/nx_browser_user_sim.nx
about
nx_browser_user_sim.nx -- THE SYNTHETIC USER (operator: prove it "via ocr and user testing like trying
to scroll maximize etc ... without needing a human but matching a humans experience"). Drives the REAL
browser core through the interactions a human tester would try, asserting each behavior mechanically:
U1 SCROLL: render viewport at scroll 0 vs 120 -> the same content row appears EXACTLY 120px higher
(row-hash equality, not just "pixels differ") AND the chrome strip is byte-IDENTICAL (fixed).
U2 SCROLL BOUNDS: content above the fold disappears when scrolled past (mechanically gone).
U3 RESIZE (narrow->wide): re-layout 400->800 -> page_h SHRINKS (reflow real) and NO text ink paints
beyond the right content margin at either width (no runaway/clipped lines).
U4 MAXIMIZE: re-layout at 1600 -> still coherent (ok, page_h monotonically <= the 800 height, ink in bounds).
U5 CLICK-NAV: hit-test the link box -> href resolves; a click 200px below it hits NOTHING (miss is real).
U6 READABILITY-AT-EVERY-STEP: the scrolled viewport + resized renders are written as PNGs for the OCR
judge (knowledge/status/usersim_*.png) -- the harness runner OCRs them; this organ asserts
render integrity, the census asserts the OCR numbers.
NEG U7: a scroll offset of 0 vs 0 produces IDENTICAL frames (the differ in U1 is not noise).
All through the SAME br_layout/br_draw_fb_at path every OS surface ships. license_tier: ORIGINAL
expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_browser_render.nxnx_itoa_lib.nxnx_apng_write.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 30 | const US_W: i64 = 500 // layout width (16px default renders at scale 2 -> 1000px viewport) |
| 31 | const US_VH: i64 = 400 // viewport height in page px |
functions
| 23 | func us_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 28 | func us_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 34 | func us_frame(page: *Page, sy: i64) -> *u8 |
| 44 | func us_rowhash(px: *u8, W: i64, row: i64) -> i64 |
| 52 | func us_ink_right_of(px: *u8, W: i64, H: i64, x0: i64) -> i64 |
| 66 | func us_png(px: *u8, W: i64, H: i64, path: *u8) -> i64 |
| 74 | func us_clip_frame(page: *Page, sy: i64, rgb: *u8) -> i64 |
| 86 | func us_mark(rgb: *u8, W: i64, H: i64, cx: i64, cy: i64) -> i64 |
| 98 | func main() -> i64 |