code wiki / _hdl_build / nx_browser_user_sim.nx

nx_browser_user_sim.nx

buildroot/runtime/_hdl_build/nx_browser_user_sim.nx

16725 B311 linesdepth 9pulls 31 transitivereach 0 importersview sourcekind tooltopic browser
docsdependenciesstructsconstsfunctions

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

nx_browser_render.nx nx_itoa_lib.nx nx_apng_write.nx nx_browser_user_sim.nx

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

main us_puts sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close br_layout br_slen sys_mmap ↻ rh_extract_styles sys_mmap ↻ nx_html_cursor_init nx_html_next_token _scan_name _is_name _is_void_element _lc nx_html_is_raw_text_tag _lc ↻ nx_html_consume_raw_text _lc ↻ _is_ws _lfd_name_eq _lfd_lc _rh_copy_css rh_filter_media sys_mmap ↻ rh_find rh_media_matches rh_find ↻ rh_num_after rh_digit cx_expand sys_mmap ↻ cx_collect cx_ch cx_is_ws cx_find

structs

none

consts

30const US_W: i64 = 500 // layout width (16px default renders at scale 2 -> 1000px viewport)
31const US_VH: i64 = 400 // viewport height in page px

functions

23func 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
28func us_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
34func us_frame(page: *Page, sy: i64) -> *u8
44func us_rowhash(px: *u8, W: i64, row: i64) -> i64
52func us_ink_right_of(px: *u8, W: i64, H: i64, x0: i64) -> i64
66func us_png(px: *u8, W: i64, H: i64, path: *u8) -> i64
74func us_clip_frame(page: *Page, sy: i64, rgb: *u8) -> i64
86func us_mark(rgb: *u8, W: i64, H: i64, cx: i64, cy: i64) -> i64
98func main() -> i64