Package limn.testing


@NullMarked package limn.testing
Testing a Limn UI with no display.

HeadlessUi installs the UI runtime on the test's own thread, and SceneDriver drives a scene the way a window would: a click, typed text, a key, a scroll, or any raw window input, dispatched when its batch ends. TestRulers measures text without fonts, so a layout comes out the same on every machine, and HeadlessBackend gives a dialog, a menu or a popup a window to open in. AccessibleHarness binds a widget to a scene whose accessibility bridge records every tree it is handed, and AccessibleInvariants holds a tree to the rules every published tree keeps.

Nothing here depends on a test framework: a contract case throws AssertionError and AccessibleInvariants returns its violations as text, and any framework can report either.

  • Classes
    Class
    Description
    A widget bound to a headless scene whose window hands out a bridge that keeps what it is given: what a per-shape contract needs to read the tree a real widget publishes and to drive a verb into it the way a platform does.
    The four invariants every published tree holds, whatever is in it: no node has role UNKNOWN; a focusable node has a name; no two nodes share an id; and a node that says it is showing has a box, lies inside the scene, and overlaps every showing ancestor up to the root of the popup it is in, if any.
    Reading a published tree in a test: one node by name, every node in a state, and the whole tree as text for the message of an assertion that failed.
    Measures what a stretch of work allocates on the calling thread, for every claim in this repository that a steady-state loop allocates nothing at all: a converter's, a clock's, a describe hook's, a decoder's.
    A backend that mints HeadlessWindows and remembers them, so that a dialog, a menu or a popup which opens as a window of its own opens somewhere a test can read.
    A UiRuntime bound to the calling thread for the life of a test, so that the thread confinement every widget asserts holds on the JUnit thread, and the worker pool and queue behind Ui exist to be drained.
    A window with no platform behind it, whose accessibility bridge keeps the last tree it was handed: what a scene is bound to so that its accessible tree can be read with no GL, no fonts and no desktop.
    A bridge that listens, keeps the newest tree and every event it was handed, and does nothing else.
    A fixed-size canvas that draws nothing, so a full frame can run with no GL.
    A bridge that keeps what it is handed instead of talking to a platform: the double every headless accessibility test is written against.
    Drives a scene as a window would: pointer, keys, text, focus, fullscreen, resizes and the close, delivered to the input the scene hands its window and dispatched when the batch ends.
    A NativeWindow that does nothing except answer questions: enough of a window for the components that ask one whether they may open a window of their own, without a backend, a display server or GL.
    The system's preferences as a test puts them in place: a dark appearance, less motion, more contrast, access keys underlined at all times.
    The text rulers headless tests lay out against, so that a layout measured on one machine is the layout measured on every other.