TestEvents class final

A bus that writes down what is declared, subscribed and published, and delivers only what a test hands it (show, deliverStep).

It refuses a declared name already taken (NameTakenException) and, through a plugin's view, one outside the plugin's namespace (PluginException), as the engine's bus does.

Inheritance

Constructors

TestEvents()
An empty bus.

Properties

companions → Iterable<PluginRegistry>
The registries that come with this one, found by PluginHost.registry as if each had been handed to the host itself.
no setterinherited
declared → List<EventDeclaration>
Every declared event type, in declaration order.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
published → List<BusEvent>
Everything published, in the order it was.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subscriptions → List<TestSubscription>
Every subscription made and not cancelled, in the order it was made.
no setter

Methods

codecFor(String name) → EventCodec<BusEvent>?
The codec declared for events named name; null when the name was declared without one, or not declared (absent).
inherited
declare<T extends BusEvent>(String name, {BusChannel channel = BusChannel.step, String? description, EventCodec<T>? codec}) → Registration
Says that events of type T are published under name, so a tool can list them and two plugins cannot claim one name.
override
deliverStep(BusEvent event, {int step = 0}) → void
Hands event to every step subscriber of its type, as published in step.
forPlugin(PluginScope scope) → EventRegistry
This registry as scope's plugin sees it: everything registered through the result is tracked by scope, ranked by it, and checked against its manifest. Must return the same type the registry is looked up by.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFrame<T extends BusEvent>(String label, EventHandler<T> handler) → Registration
Calls handler once a frame for every T published since the last, steps' events first in step order, then the frame's own.
override
onRetracted<T extends BusEvent>(String label, EventHandler<T> handler) → Registration
Calls handler on the frame channel for every T that was shown for a step and not produced when the step was run again — a rollback took it back. A frame subscriber that started something for it (a sound, a burst of particles) may stop it here.
override
onStep<T extends BusEvent>(String label, EventHandler<T> handler) → Registration
Calls handler at the end of each step for every T the step published. Inside the step: a handler may change the world, and is run again on a rollback.
override
publish(BusEvent event) → void
Publishes event: onto the step channel while a step is running, onto the frame channel otherwise.
override
retract(BusEvent event, {int step = 0}) → void
Hands event to every subscriber of retractions of its type, as taken back from step.
show(BusEvent event, {int step = 0}) → void
Hands event to every frame subscriber of its type, as shown for step.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited