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
-
- Object
- PluginRegistry
- EventRegistry
- TestEvents
Constructors
- TestEvents()
- An empty bus.
Properties
-
companions
→ Iterable<
PluginRegistry> -
The registries that come with this one, found by
PluginHost.registryas 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
Tare published undername, so a tool can list them and two plugins cannot claim one name.override -
deliverStep(
BusEvent event, {int step = 0}) → void -
Hands
eventto every step subscriber of its type, as published instep. -
forPlugin(
PluginScope scope) → EventRegistry -
This registry as
scope's plugin sees it: everything registered through the result is tracked byscope, 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
handleronce a frame for everyTpublished 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
handleron the frame channel for everyTthat 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
handlerat the end of each step for everyTthe 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
eventto every subscriber of retractions of its type, as taken back fromstep. -
show(
BusEvent event, {int step = 0}) → void -
Hands
eventto every frame subscriber of its type, as shown forstep. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited