JFLib

12. Testing -- always verify#

  • Command line of every app: --shot FILE.png (headless render, no window system needed), --script FILE.uis (headless UI test, exit code 0 = every expect met), --dump (widget tree as JSON lines), --verify-dirty (compare every incremental redraw with a full redraw), --size WxH (DIP), --scale PERCENT, --theme light|dark, --theme-file PATH (an app theme, §34), --accent RRGGBB, --anim off, --log-events, --auto-close MS, --threads N, --simd sse2 (no AVX2 paths), --inspect (the live inspector, §30). Environment: jfgui_DEBUG=1 (layout / render trace), jfgui_CSD=1, jfgui_FILEDLG=builtin, jfgui_THEME, jfgui_SCALE (Linux), jfgui_BACKEND, jfgui_GPU=0 (nothing of the GPU anywhere; on Windows, Linux and Android the windows show their frames through the GPU by default; GPU.md "Ausgabe der UI"; jfgui_GPU_VERIFY=1 reads every presented image back and compares it, jfgui_GPU_TRACE=1 prints its stages, jfgui_GPU_LAYERS=0 keeps one texture per window, jfgui_GPU_IMAGES=0 keeps images on the CPU, jfgui_GPU_IMAGE_MB=n their budget), jfgui_TEST_NOACTIVATE=1 (a test's window appears without taking the keyboard and without DWM's fade-in), jfgui_INSPECT=1 (the inspector's hot keys Ctrl+Shift+I / F12 work), jfgui_RENDER_PAR=0 (every render on one thread), =1 (row bands for every render, whatever its size), =2 (every render both ways, a UIWARN when a byte differs: run the scripts with it after a change to the renderer or a Draw), jfgui_HOTRELOAD=DIR (hot reload's session, set by build_rs.py watch; development builds, §30), jfgui_EDITOR / jfgui_SRC (the inspector's editor command and source folder; development builds, §30).
  • Never start an app without --shot, --script or --auto-close: a plain start opens a real window on the user's desktop. An app that saves its settings when a real window closes needs its own test folder for every real-window run (JFPainter: --config build/<name>/cfg).
  • Linux binaries run through WSL: wsl.exe -d Ubuntu-24.04 --cd <repo> -e ./build/linux/NAME --script apps/NAME/tests/x.uis (jfgui_BACKEND=x11 through -e env jfgui_BACKEND=x11 ./build/linux/NAME ...).
  • Android runs on an emulator or a device, not in the suite: the debug APK of apps/androidGallery carries instrumentations for input, accessibility and files (python apps/androidGallery/tests/android_files.py --serial S --apk APK: internal storage across a restart, the system's picker answered through UiAutomation, content://, the clipboard), the sensors and the location (android_sensors.py --serial S, also for a real phone: it says what to do); see apps/androidGallery/README.md. The output through the GPU: android_gpu.py --serial S (the swapchain, its life cycle, the fallback), apps/gputest/tests/android.py --serial S (gputest as a program for adb shell); the suite runs these two with jfgui_TEST_ANDROID=S. Programs without a UI (coretest, plattest, asynctest) build for Android as a program for adb shell and a test APK beside it; python tools/android_console.py APP --serial S [-- ARGS] runs them both ways, the APK in an app's process with the system's seccomp filter (ANDROID.md, AN0). An app with an APK builds that way with jfgui_ANDROID_CONSOLE=1 (apps/jfWord/tests/android.py: its self-test and scripts). python tools/android_ci.py does all of it on an emulator of its own, as the workflow android.yml does on GitHub; the suite takes these runs too with jfgui_TEST_ANDROID=S.
  • Look at screenshots (shot) with an image viewer or the Read tool; test dark and light and 150 %. Real windows: python tools/wincap.py build/win/NAME.exe --out cap.png, python tools/wslcap.py --title T --out cap.png -- build/linux/NAME.

The script language (ui/auto.rs; one command per line, # starts a comment, coordinates in DIP):

CommandEffect
click S [l|r|m] [shift|ctrl|alt]..., rclick S, dblclick S [shift|ctrl|alt]..., move S, down S [l|r|m], up [S] [l|r|m]pointer (the modifier words are held during the click)
drag S1 S2 [steps] [hold MS] [shift] [ctrl] [alt] [right|middle]drag with modifiers / other buttons; hold MS: the button rests MS ms before the first move, on the virtual clock like wait (a dock tab asks for it)
drag ... pen P0 P1, drag ... eraser P0 P1a pen stroke, pressure P0 -> P1 (%)
pointer mouse | pen [P [TX TY]] | eraser [P ...] | touchpen data of the following pointer events (touch: they are a finger, §37)
tap S, longpress S [MS]a finger: down and up at S; resting MS ms (default 600) in between
swipe S1 S2 [MS] [hold]a finger from S1 to S2 at an even speed in MS ms (default 300, a sample every 8 ms), then it lifts with that speed (a fling starts, wait runs it); hold: it rests 100 ms first (no fling)
flick S DX DY [MS]a quick swipe from S by DX, DY (DIP) in MS ms (default 60)
finger [N] down S, finger [N] move S, finger [N] up, finger [N] cancelone raw finger event: it stays down across other commands; N its id (default 0), for a second one; cancel: the system took it
pinch S D0 D1 [MS]two fingers around S, D0 DIP apart, go to D1 DIP apart in MS ms (default 300), then they lift
pan2 S DX DY [MS]two fingers around S, 80 DIP apart, move by DX, DY (DIP) in MS ms (default 300), then they lift
wheel S DY [DX] [fine|pixels] [shift] [ctrl] [alt]raw wheel units (120 = one notch; DX sideways, right positive); the modifiers are held during the wheel event (Ctrl + wheel zoom); fine: a device in fine steps of the 120 (plat::WHEEL_FINE, a precision touchpad on Windows), pixels: DY and DX are DIP of a device that scrolls by pixels (plat::WHEEL_PIXELS, a trackpad)
key CHORD...key ctrl+s, key tab shift+tab enter esc left f4, also [ ] , . - + /, num0..num9, numadd ... (every key a pass of its own, as the platform delivers them; with the US layout's character, KeyEvent::ch)
keydown CHORD [scan N|code N] [left|right|numpad] [char "c"|none] [dead], keyup CHORD ...a key down and held (shift / ctrl / alt stay held for the following events; down again: an auto-repeat) and up again, with a scancode (code N: the key at USB HID usage N, KeyEvent::code), location and character for ui.key_event_take (the US layout's character for the key and its Shift; char "c" another layout's, char none none, dead a dead key)
motion DX DYraw motion of the pointer while the window holds the pointer lock a headless run plays (ui.pointer_lock, ui.pointer_motion; section 39); nothing without the lock
pad connect N [xbox|playstation|nintendo|other] [NAME], pad disconnect N, pad press N BUTTON [VALUE], pad release N BUTTON, pad axis N lx|ly|rx|ry VALUEgame pad N comes or goes, a button of the standard layout (a b x y lb rb lt rt back start ls rs up down left right home; VALUE 0 to 1, default 1) goes down or up, a stick's axis moves (-1 to 1, right and down positive): ui.gamepads, UIC_GAMEPAD (section 39)
keys [N] CHORD...the chords N times over, queued for ONE pass of the window with the keyboard (more keys than frames, as a tool window hands them on)
type "text"typed text ("\n" presses Enter), a character per event; the whole quoted string, as long as a script line (16 KiB)
commit "text" [N]an input method commits the text (N times over: one long commit, as the platform queues it); the text as long as a script line
preedit "text" [CURSOR]an input method's composition (ui.ime_preedit; CURSOR a byte offset, default the end; "" ends it)
focus Skeyboard focus to a widget (focus ring shown)
cmd ID [ARG]run a command as if a menu row was chosen
wait MSadvance the virtual clock (16 ms frames; a frame the app or the library asked for comes with the next one, as in the window loop); nothing else happens meanwhile, so the run is the same every time
wait real MSMS of real time pass while the app's own threads work (an engine with threads of its own): their wake-ups (plat::wake) reach App::command (UIC_WAKE) as they come, and the virtual clock follows the real one (timers fire, frames asked for come). Not deterministic: expect what holds however long the threads took, or sync on a hook first
size W H, theme dark|light|contrast, scale P [window ID]window size, theme, dpi
theme file PATH, theme none, style NAMEan app theme from a file (an error is printed and remembered, the theme stays), none, another linked style (§34)
expect theme "NAME"|none, expect theme error "TEXT"|none, expect style NAMEthe app theme, the error of the last theme file (contains TEXT), the style in use
expect token NAME #RRGGBB|#AARRGGBB, expect pixel X Y #RRGGBB, expect same FILE.png [X Y W H]a colour token now (bg, accent_text, ...), the rendered colour at a point of the main window (DIP), the main window (with X Y W H: that part, DIP) rendered now has the pixels of an earlier shot (taken with the same crop)
expect S exists|missing|hover|nohover|focused|checked|unchecked|disabled|enabled|selected|open|pressed|unpressedwidget states
expect S value N, expect S value MIN..MAX, expect S max N, expect S text "s", expect S rect X Y W Hvalues, texts, rectangles (DIP; * takes any value: rect * * * 36)
shot FILE.png [window ID|desktop] [X Y W H], dump [FILE], print TEXT, bench N, quitoutput
bench N anim [MAX_US], bench N drag S1 S2 [middle|right|shift|ctrl|alt]... [MAX_US], bench N wheel S DY [shift|ctrl|alt]... [MAX_US]frame times while things move: N frames 16 ms apart on the virtual clock, the N moves of a drag (every other run drags back), N wheel events (DY and -DY by turns); each frame's passes and the render of its dirty cells are timed; prints mean, render, median and max; with MAX_US a run passes when its median is at most MAX_US, up to three runs, else FAIL
window ID|main|anyselectors only look into that window
expect window ID open|closed|visible|active|modal|keys, expect window ID rect X Y W Hsecondary windows (keys: the window the keys go to now -- a tool window borrows them after F6 / Ctrl+F6, §27)
close window ID, movewin ID X Y, resizewin ID W H, activate IDthe user moves / closes windows
sync [MS] [soft]wait (real time, at most MS, default 10 s) until no background job is pending (sync_hook_set, async tasks, the spell checker); reaching MS fails the script, with soft it does not (a note is printed, the expects after it decide). The virtual clock stands still meanwhile: timers of the app fire in wait real, not in sync
expect_warn, expect_nowarna UIWARN was / was not printed since the last check
gpu on [fast]|off, gpu wait [MS], gpu hold MS, gpu lose, gpu print, gpu budget BYTES, gpu tilebudget BYTES, gpu settle, gpu shot FILE, gpu expect gpu|cpu|same|window|screen|upload N|base N|raster N|layers N|images N|apart N|tiles N|fills N|nodiff(Windows, Linux with the GPU; else a SKIP once; GPU.md "Ausgabe der UI") gpu on: real windows through the swapchain, shown without activation, every presented image read back and compared with the framebuffer (fast: not read back, for measurements), a render after every input edge; a canvas stays on its tiles until settle or same. wait: until the windows are on the swapchain again. hold: real time passes, the windows stay as they are (a look from outside). lose: the device behaves as lost. budget: what image textures may take, tilebudget: what canvas tiles may take. settle: every canvas back to the CPU's picture. shot: the image the window presents now, also a gesture's tiles (shot writes the framebuffer). same: every canvas settled, every window presents once more, byte for byte; window: the window's DC = the framebuffer (the CPU path); screen: the composed screen = the framebuffer (a covered window is a note; X11: what the server holds; Wayland: a note, no client can read a window); upload N: at most N bytes uploaded since the last check; base N: at most N of them to the base texture; raster N: at most N pixels of the base layer drawn; layers N: N layers above the base have a texture now; images N: N image textures exist; apart N: N canvases come from tiles now; tiles N: N tiles exist; fills N: at most N tiles drawn since the last check; nodiff: no pixel of a canvas's tiles differed from the CPU's since the last same or nodiff
expect scrollcopy [N]|noneat least N (default 1) / no rendered frames moved pixels by a scroll copy since the last check (§5; frames checked by --verify-dirty copy whenever they can, jfgui_DEBUG=1 prints each copy)
expect sound KIND|nonethe last sound ui.beep / ui.dialog_sound asked for since the last check (default, information, warning, error, question, notify; headless runs play nothing, §33)
drop X Y FILE...files dropped at (X, Y) of the scoped window (onto a drop target, else UIC_DROP)
drop X Y [files F...] [text "s"] [html "s"] [url U] [image F] [copy|move|link] [sync] [allows copy|move|link...], drop X Y selfother content dropped there (copy/move/link: the effect the platform delivers); self: the app's own drag that left the window comes back; sync: the platform answers the source at the drop, as macOS does (ui.drop_defer() says false); allows: the effects the source allows, given with the drop as Windows' Drop does (without: those of the dragover before it, else all; ui.drag_allowed() in the drop's pass)
drop expect copy|move|link|none|pendingwhat the source of the last drop was answered (none: not taken; the effect it was delivered with, or ui.drop_finish's), pending: the answer waits (ui.drop_defer, §7)
dragover X Y [files] [text] [url] [html] [image] [copy|move|link], dragleaveanother program's drag hovers there, its source allowing those effects (default copy and move: ui.drag_allowed()) / leaves
dragover expect copy|move|link|none [ctrl] [shift]what the platform would answer that drag now (the target's drop_effect_set, the system's pointer)
dragout expect none|text "s"|html "s"|url "s"|files N|image|kinds N, dragout end copy|move|link|nonewhat the app's drag handed to the platform when it left the window, the platform's answer
system focus in|out, system suspend|resume, system background|foreground, system session-end, system settings theme|locale|contrast|fonts|other|monitors|Nthe platform's lifecycle events (UIC_ACTIVE, UIC_SUSPEND, ...; background / foreground: a hidden tab, Android's onStop / onStart)
system browser default|other|unknown(E13) what ui.default_browser() answers from here (headless runs never ask the system; at first other, section 21); then the app loses the keyboard and gets it back as after the system's settings (UIC_ACTIVE 0 and 1; only 1 when it was not active), so an app that keeps the status reads it again
system env NAME VALUE|-set (- removes) a jfgui_* environment variable of the run: the overrides of the system settings (then system settings ...), jfgui_CSD (the library title bar and its resize band from the next pass), jfgui_FONT_FALLBACK 1 (system fonts for missing characters from here, section 11)
sensor accel|gravity|gyro|magnet X Y Z [ACCURACY], sensor rot X Y Z W [abs|rel], sensor none NAME|all, sensor expect NAME off|waiting|running|paused|denied|unavailablea reading of plat::sensors as the host would deliver it (the sensor exists from now on; a stopped one delivers nothing), a sensor gone, its state (§36)
location LAT LON [ACC ALT SPEED BEARING] (-: the provider does not say), location age MS, location searching|denied|off|none, location expect off|searching|fix|paused|denied|disabled|unavailablea fix of plat::sensors, how old it is, the host's answer (off: the system's switch; none: no location service, as at the start), the state (§36)
expect wm none|move|menu|minimize|maximize|restore|close|lower|resize EDGEwhat the title bar or the resize band asked the window manager for since the last check (headless runs only record it; EDGE n, s, w, e, nw, ne, sw, se, physical)
system hotkey ID, system pick RRGGBB|cancela recorded global shortcut pressed (UIC_HOTKEY); the user's answer to a running colour pick (UIC_PICK, a CP_PIPETTE picker; section 21)
clip text "s", clip file F, clip dib F, clip clear, clip save F [bmp], clip expect none|text|image|pngthe headless clipboard (never the real one)
clip utf8 Fexact UTF-8 text clipboard bytes from a file (up to 4 MiB), including CR/LF and long paste payloads; opt-in Rust extension
clip data FORMAT F [FORMAT F ...]publish one to four representations together; formats: text, html, rtf, docx; opt-in Rust extension
clip save F text|html|rtf|docx, clip expect html|rtf|docx|text-onlysave exact bytes or check rich-format availability; text-only also checks absence of rich representations
inspect on|off|arm|pick|select S|..., inspect expect open|idle|same|selected S|selector "s"|...the live inspector headless: open it, pick, select, check the overlay, the selector and that a closed inspector changes nothing (§30)
inspect set KEY VALUE, inspect reset [KEY], inspect undo|redo|save PATH|list, inspect do click|drag DX DY|value N|type "s"|cmd ID, inspect expect changes N|value KEY "s"|list "s"|...editing in the inspector (development builds): theme tokens, accent, radius, spacing, height, text sizes, font, mode, style, language, scales; undo / redo / reset, the theme file, the change list; the selected widget operated (§30)
inspect editor "COMMAND"|none, inspect open [dry], inspect expect source "PREFIX"|none, inspect expect sources "PREFIX", inspect expect opened "s"|none, inspect expect note "s"|nonethe selected widget's source in the inspector (development builds): the file and line of the app's call (prefix), "Im Editor öffnen" with the editor the script sets (dry: the command line built and the permission checked, nothing started; a script never starts the user's editor), the command line opened, the note below the source (§30)

Selectors S: #123 (widget id), "Label", kind:"Label" (button:"OK", dialog:"Öffnen", text:"Klicks: 2"), X,Y (a point in DIP). A label must match exactly one widget (plain text is ignored when a control with the same label exists; with matches in several windows the topmost window wins, then the topmost layer, so an ambiguous label resolves to the dialog or popup). A label is the record's whole text: a wrapped paragraph (a web page's) is one record and its selector the whole paragraph, as dump shows it (a script line holds up to 16 KiB, and so do the quoted strings of type and commit; dump writes up to 64 KiB of a label; apps/viewtest/tests/longtext.uis). Failed expectations print FAIL line N: <command> -> <detail> and the script goes on.

# apps/template/tests/smoke.uis
click "Klick mich"
click "Klick mich"
expect text:"Klicks: 2" exists
click "Zurücksetzen"
expect text:"Klicks: 0" exists
shot build/template.png
  • A first line #!args --open file.png adds program arguments when build_rs.py test runs the script (pass them yourself when you run it by hand). A line #!timeout 1800 among the first five sets the seconds it may take there (600 otherwise); a script that takes longer counts as failed and the others still run. A line #!only windows linux among the first five runs it on these systems only, under build_rs.py test as under cargo jflib test (the names below); on the other targets it is skipped and counted.
  • Lines for some systems: only OS...: COMMAND runs the command only on the systems it names, !OS on every system but that one (only windows: key ctrl+q, only !macos: expect "Beenden" exists, only linux macos: ...; blanks or commas between the names). The names are those of cargo jflib test's #!only line, which skips a whole script: windows, linux, macos, ios, android, wasm32. The app decides it where the script runs, so it works under build_rs.py test, cargo jflib test and by hand alike; an unknown name or a line without a command is a parse error (exit code 2). apps/viewtest/tests/onlyos.uis.
  • build_rs.py test runs the scripts side by side: --test-jobs N at a time (default half the logical CPUs, or jfgui_TEST_JOBS; --test-jobs 1 runs them one after the other in the old order), Windows and Linux together. An app's scripts keep their order and run one at a time, never while the same app runs on the other target (they share build/). Among a script's first five lines, #!lock desktop (real windows: gpu on, a swapchain, a window on the screen; one such script at a time per target) or #!lock audio (the real output device; one at a time on both targets, WSLg plays into Windows' mix) keeps it from running beside another script with the same lock; #!serial WHY runs it alone after the others (for what fails under their load, such as a time limit in ms; it leaves its app's order). apps/NAME/tests/jobs.txt holds the same for every script of an app (lock desktop, serial WHY), and independent for an app whose scripts share nothing: they run beside each other too, the same script on the two targets one after the other (its pictures); independent targets when they write no files at all (the GPU tests' --test runs). The checks after the scripts (gendoc, test_devkit, pkg_check, i18n_check, site) run beside them, and each job starts its Linux programs through one WSL process of its own (linux_task.py serve). At the end the suite prints the times of the build, the scripts and the checks and the slowest scripts and apps; build/test-report.json keeps every result with its start and end (which scripts ran together) and the end of a failed script's output, build/test-times.json each script's last duration, from which the next run starts the longest work first. A new script that opens a real window or plays sound needs its lock.
  • --dump / dump print the widget tree (kind, id, label, rect in DIP, states, value): use it to find ids and positions without looking at pixels. Prefer #id and labels over coordinates.
  • Popups may leave their window (§6): their dump rectangles can be negative or beyond the window; shot F desktop shows them. Secondary windows' popups use the main window's client area as the screen; screen X Y W H (DIP of the main window's client area) gives a virtual monitor work area to every window -- then the main window's popups leave it as well and flip at the screen's edges (apps/gallery/tests/popup_edges.uis); screen off goes back. Real windows: tools/wincheck.py popups|edges, tools/x11check.py popups|edges --backend x11|wayland, tools/wlproxy/popflip.py (a compositor that moves popups). UIC_EXIT is never sent in --script / --shot runs.
  • Input bursts on Linux: python tools/keyburst.py [--keys N] puts a proxy between linuxtest --test burst and WSLg's X server / compositor that writes N synthetic key presses in one go (while the backend waits for a reply, and while it waits for events); every key must arrive, in order.

Test commands, an app of your own:

cargo jflib test                    # build it, run every tests/*.uis with --script
cargo jflib test --release          # ... the release build
cargo jflib test --features engine --dir tests/engine
                                    # ... built with the feature engine, the scripts of tests/engine/
cargo jflib test --no-default-features   # ... without the default features (an app's mock build)

--features takes Cargo's forms (a,b, "a b", repeated), --dir DIR is relative to the package's folder; the scripts run in that folder, so their paths (shot build/x.png) stay the same.

In this repository:

python build_rs.py test --quick     # lint, build every app (both targets), every .uis script (side by side)
python build_rs.py test             # ... plus parity with the assembly reference
python build_rs.py test NAME        # one app: build it, run its tests/*.uis
python build_rs.py test --quick --test-jobs 1   # the scripts one after the other (section 12)
python build_rs.py check            # the rules lint, then Clippy over the library (below)
python build_rs.py check --quick    # the rules lint alone
python tools/gendoc.py --check      # docs/API.md matches the doc comments
python build_rs.py api-diff         # the public API since the last release (VERSIONING.md)
python build_rs.py i18n [APP]       # the catalogues: missing, untranslated, unused texts ("Languages")
  • Clippy: check runs cargo clippy over the library crates of each target (--target, default both on Windows and the machine's own elsewhere; Linux in both its builds), with only the groups correctness and suspicious on, as errors. Three lints that name an idiom of this code are off everywhere (CLIPPY_OFF in build_rs.py, each with its reason). A place that is right as it stands carries #[allow(clippy::NAME)] and a comment that says why. No build and no test runs it: the first run takes minutes per target, a later one seconds.
  • Run new scripts with --verify-dirty too (build_rs.py test does not add it): it reports missed pixels with their bounding box. Checked frames also take every scroll copy they can (§5), so a script that scrolls tests those; it renders after each input event (a view copies from the second frame that moves it) and bench N anim renders the frames of smooth scrolling.
  • Frame times: the moving forms of bench measure with the real clock; --verify-dirty compares each frame after the timed part, untimed. The median and up to three runs ride out a machine that builds other things meanwhile; give a frame budget as the limit (33000 for 30 fps) rather than today's times. Example: JFNetworker's tests/perf.uis (500 devices, 800 cables, 300 frames moving, pan, zoom and a drag at 1920 x 1080).
  • Presenting through the GPU (Windows, Linux and Android, by default, jfgui_GPU=0 turns it off, lib/ui/gpu_out.rs, GPU.md "Ausgabe der UI", "Ausgabe unter Linux"): the first frames, every frame of a resize and every window after a failure go the way below; otherwise the rectangles go into a texture and a swapchain shows it (Windows: on a child window; Linux: dma-bufs on the window itself, through JFLib's own Wayland and X11 code, no libwayland or libxcb), without ever waiting for the display. The layers above the base have textures of their own: a popup that closes or moves costs nothing of what lies below it. Big opaque draw_images that keep being redrawn become textures; Ui::fb() may lack their pixels then, Ui::gpu_settle() draws them (GPU.md "Ebenen und Bilder"). Popups outside the window stay below's way.
  • Presenting (plat::win_present(w, frame, rects), bench leaves it out): the frame's dirty rectangles are copied once toward the screen, straight from the framebuffer. Windows: into the window's kept copy, a DIB section, then BitBlt (batched, GdiFlush); WM_PAINT repaints its area from that copy. X11: into one of the window's two MIT-SHM segments, each a whole frame that knows where it is stale (the segment of the last put first), then ShmPutImage of the rectangles; Expose reads the segment of the last put. Wayland: into a free wl_shm buffer that waits for its commit (the frame callback). Only with every segment / buffer busy does the damage wait in a staging image. On these three a copy from 1 MB on runs in row bands on the worker pool, from 12 MB on (a 4K frame, 32 MB) with streaming stores past the caches (lib/plat/present_copy.rs, the thresholds of gfx::COPY_PAR_MIN / COPY_STREAM_MIN); smaller ones stay plain row copies on the UI thread. plattest --test present-bench [--size WxH] measures a 4K frame's presents in a real window (the whole frame, a caret, a line of text, 20 blocks, a band) and the copy alone. Browser and Android: the B, G, R, x of the frame becomes the window's R, G, B, A copy while it is copied in; one window over the whole canvas without popups is the canvas itself (no composition), and the host copies rows into one buffer per frame (the page's ImageData, Android's Bitmap). Pixels outside the rectangles must be what the last present of that window showed (the UI's dirty rectangles cover every change; --verify-dirty checks it). plat::present_time() sums the time spent there; linuxtest --test pbench [--size WxH] [--gap MS] prints it per frame (the whole frame, two boxes, a quarter, 40 rectangles) on Windows, X11 and Wayland; linuxtest --test pcheck reads the presented pixels back (the window's DC, GetImage, the committed wl_shm buffer) after partial presents, frames back to back, hide + show, minimize, WM_PAINT and a new size (Linux: jfgui_BACKEND=x11|wayland, jfgui_X11SHM=fd|sysv|off). node tools/tests/web_present.mjs BUILD [--base OLD] measures the browser worker and compares canvas and framebuffer in Chromium and Firefox; GalleryPresentInstrumentation (apps/androidGallery) measures Android's frames and compares partial frames with a full one.
  • Parity (apps that also exist in legacy/): python tools/parity.py app NAME runs the shot matrix (light / dark × 100 / 150 %, with dumps) and every script on the assembly reference and the Rust build and compares pixels, dumps, stdout and exit codes; apps/NAME/parity.txt can mark pending scripts or masked areas. The reference binaries live in build/rwref (jfgui_REF=<main checkout>/build/rwref from a worktree); parity.py ... --style S compares another style (STYLES.md).
  • Library check tools: tools/*_check.py run against the Rust build with --out build (codec, kernel and effect checks: codec_check, png_check, jxl_check, blend_check, fx_check, ...); python tools/diffcheck.py TOOL additionally compares every result byte for byte with the assembly build.

Source: docs/GUIDE.md in the JFLib repository.