WorldTesting extension

run, untilLoaded, tap and viewPoint on a World, for tests.

on

Methods

run(double seconds, {int fps = 60}) → void

Available on World, provided by the WorldTesting extension

Runs seconds of frames, fps a second: world.update(1 / fps) that many times.
tap(double x, double y) → void

Available on World, provided by the WorldTesting extension

A tap at (x, y) in the view's logical pixels, on the next frame: a finger down and up again, a new one each time. Throws a StateError while the input has no view size.
untilLoaded(GameObject object, {Duration timeout = const Duration(seconds: 30), int fps = 60}) → Future<void>

Available on World, provided by the WorldTesting extension

Waits for object to load (GameObject.loaded), running a frame each 5 ms of real time meanwhile, as the app would: for a game whose onLoad awaits a routine (a fade, wait, a tween), which goes on only in a frame, so a bare await game.loaded with no frames run would wait for ever. Throws what the load threw, or a TimeoutException after timeout of real time.
viewPoint(double x, double y) → ViewPoint

Available on World, provided by the WorldTesting extension

(x, y) in the view, as the input gives a finger's place: for camera.screenPointToRay and the like. Throws a StateError while the input has no view size.