# Testing & Verification Default Cargo features enable `preview`, `layer-shell`, and `wallpaper`. Run `cargo test --locked` for the full default suite. Both Slint entry points are AOT-compiled; debug builds include element metadata used by geometry tests. ## Test suites - `tests/interaction.rs` — headless tests for `ui/preview.slint`: keyboard/pointer activation, physical-pixel frame snapping across 1×–2×, settings navigation and focus return, independent mute/volume, and tile editing/countdown/battery states. - `tests/layer_ui.rs` — headless tests for `ui/live.slint` (`layer-shell` feature): clock/popup geometry, tooltip hit testing, rail scrolling, audio/power-profile controls, keep-awake, Bluetooth progress, weather location search/Escape/selection, and workspace start tiles/launch waves. - Binary unit tests alongside `src/`: service reducers, battery discovery and power history, Open-Meteo forecast/geocoding/config persistence, tile layout/persistence, and workspace watcher decisions (`cargo test --bin luminis-bar`, `cargo test --bin luminis-workspace-search`). ## Writing headless Slint tests - Initialize once per test with `i_slint_backend_testing::init_no_event_loop();` and call `.show().unwrap()` before querying geometry or dispatching events. - When advancing timers (`TooltipSession`, `PowerMeter` tooltips, launch waves), call `slint::platform::update_timers_and_animations()` **before and after** `i_slint_backend_testing::mock_elapsed_time(...)` so newly armed timers record their start timestamp before time advances. - Send key events with `window().dispatch_event(slint::platform::WindowEvent::KeyPressed { text: slint::platform::Key::Escape.into() })`. - Query interactive controls by `accessible-label` (`ElementHandle::find_by_accessible_label`) and layout/pixel-snapping targets by explicit element ID (`ComponentName::id`). - `i_slint_backend_testing` runs without FemtoVG — headless geometry assertions verify coordinates, not GPU rasterization or Wayland compositor placement. ## Live compositor & placement checks When changes touch `luminis-bar`, `ui/live.slint`, `TooltipSession`/timers, or `src/live/shm_wayland.rs`, also verify in a real niri Wayland session (stop any running `luminis-bar` first because of the single-instance lock): ```sh # 7-stage automated live smoke test (ungrabbed popup, captures captures/live-{bar,panel,panel-rolling}.png) cargo run --features layer-shell --bin luminis-bar -- --smoke-test # Verify actual compositor popup placement (bottom edge) cargo build --release --no-default-features --features layer-shell --bin luminis-bar env WAYLAND_DEBUG=client target/release/luminis-bar --bottom --smoke-test 2> /tmp/luminis-popup-trace.log python3 scripts/check-popup-placement.py /tmp/luminis-popup-trace.log ``` - `scripts/check-popup-placement.py` parses `xdg_popup.configure(x, y, width, height)` events from the Wayland client trace and asserts `y + height <= -8` (at least an 8px gap above the bottom bar). - Manual checks not covered by `--smoke-test`: real grabbed pointer outside-click dismissal (`--smoke-test` disables grab), output hotplug / multi-output behavior, and suspend/resume wake handling. ## Workspace Start integration For changes spanning the tile surface, watcher, and Vicinae, build both binaries and run `scripts/sandbox-workspace-start.sh`: ```sh cargo build --release --no-default-features --features layer-shell \ --bin luminis-bar --bin luminis-workspace-search scripts/sandbox-workspace-start.sh ``` It starts a private niri session on Xvfb at 1.25× inside Bubblewrap with a disposable home and D-Bus session (requires `bwrap`, `Xvfb`, `niri`, `wtype`, `libXtst`, `ffmpeg`, `zenity`, and the Vicinae fork; override binaries with `XVFB_BIN`, `LUMINIS_BAR_BIN`, `LUMINIS_WATCHER_BIN`, `VICINAE_SERVER_BIN`, or `LUMINIS_TEST_WALLPAPER`).