Class AccessibleHarness
AccessibleComponentTestBase, without JUnit, so that a contract in these fixtures can run
over a widget from any module and, one day, from an application.
Time does not pass unless advanceTime(long, limn.scene.Widget<?>) says it does, for the reason that base gives: a
measurement that lands in the middle of a fade depends on the machine, not on the widget. The
scene's clock and the one the runtime's delayed tasks fall due on are one clock: the harness
hands the runtime its own as it is built, so a timer, or the arrival a fade that goes straight
there waits for under less motion, falls due as advanceTime passes it, as a fade that
moves arrives on the scene's frames. The last harness built on a runtime is the one whose time
its delayed tasks follow. A verb
is performed from a thread that is not the UI thread, which is the path a bridge takes, and the
host must return without blocking it. The scene is 400 by 300, the stub window's size; a subject
that wants a smaller box wraps its widget in a SizedBox.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe bridge, listening from the first frame, holding every tree and event published.Every change the scene announced since the lastclearObservations().static final floatfinal SceneThe scene the root is bound in.static final floatThe scene's width and height, which are the stub window's.final StubWindowThe window the scene is bound to; itsStubWindow.accessibilityis the bridge. -
Constructor Summary
ConstructorsConstructorDescriptionAccessibleHarness(UiRuntime runtime, Widget<?> root) Bindsrootand renders the first frame, so thattree()answers at once.AccessibleHarness(UiRuntime runtime, Widget<?> root, StubWindow window) Bindsrootinwindow: a stub that cannot position lets a popup open as an overlay of the scene, where the tree can see it, rather than as a window of its own. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceTime(long millis, @Nullable Widget<?> damage) Moves scene time forward in steps no longer than the scene's own tick, damagingdamagebefore each frame so that an animation on it advances: one turn of the loop, the queue drained and a frame rendered (frame()), for each step.voidForgets the events and changes seen so far; the trees stay.describe()voidGiveswidgetthe keyboard and renders a frame, so the cursor is published.voidframe()One turn of a backend's loop: the UI queue drained, then one frame rendered at the current scene time, so that what the toolkit leaves for the next turn (the end of a fade that goes straight there among it) is done before the frame shows the tree, as on a desktop.node(long id) The node with ididin the tree published last.The node namednamein the tree published last.booleanperform(long nodeId, Accessible.Action action, Accessible.Argument arg) Performs a verb the way a platform does: from another thread, through the host, then drains the runtime and renders a frame so the tree shows what the verb did.tree()
-
Field Details
-
WIDTH
public static final float WIDTHThe scene's width and height, which are the stub window's.- See Also:
-
HEIGHT
public static final float HEIGHT- See Also:
-
window
The window the scene is bound to; itsStubWindow.accessibilityis the bridge. -
bridge
The bridge, listening from the first frame, holding every tree and event published. -
scene
The scene the root is bound in. -
changes
Every change the scene announced since the lastclearObservations().
-
-
Constructor Details
-
AccessibleHarness
Bindsrootand renders the first frame, so thattree()answers at once.- Parameters:
runtime- the installed runtime, whose queue a performed verb is drained throughroot- what to bind; a widget, or a box around one
-
AccessibleHarness
Bindsrootinwindow: a stub that cannot position lets a popup open as an overlay of the scene, where the tree can see it, rather than as a window of its own.- Parameters:
runtime- the installed runtime, whose queue a performed verb is drained throughroot- what to bindwindow- the window to bind in; its accessibility bridge is replaced by this harness's
-
-
Method Details
-
frame
public void frame()One turn of a backend's loop: the UI queue drained, then one frame rendered at the current scene time, so that what the toolkit leaves for the next turn (the end of a fade that goes straight there among it) is done before the frame shows the tree, as on a desktop. -
advanceTime
Moves scene time forward in steps no longer than the scene's own tick, damagingdamagebefore each frame so that an animation on it advances: one turn of the loop, the queue drained and a frame rendered (frame()), for each step. The runtime's delayed tasks fall due on the same clock, so a timer and a fade's waiting arrival run as their time passes.- Parameters:
millis- how far to movedamage- the widget to invalidate each frame, or null
-
clearObservations
public void clearObservations()Forgets the events and changes seen so far; the trees stay. -
tree
- Returns:
- the tree published last
-
focus
Giveswidgetthe keyboard and renders a frame, so the cursor is published. -
perform
Performs a verb the way a platform does: from another thread, through the host, then drains the runtime and renders a frame so the tree shows what the verb did.- Parameters:
nodeId- the node addressedaction- the verbarg- its argument, orAccessible.Argument.NONE- Returns:
- what the host answered: whether the verb was accepted
-
node
The node namednamein the tree published last.- Throws:
AssertionError- with the whole tree when there is none
-
node
The node with ididin the tree published last.- Throws:
AssertionError- with the whole tree when there is none
-
describe
- Returns:
- the tree published last, one line per node, for a message
-