paints top-level property

PaintPattern get paints

Matches objects or functions that paint a display list that matches the canvas calls described by the pattern.

Specifically, this can be applied to RenderObjects, Finders that correspond to a single RenderObject, and functions that have either of the following signatures:

void exampleOne(PaintingContext context, Offset offset) { }
void exampleTwo(Canvas canvas) { }

In the case of functions that take a PaintingContext and an Offset, the paints matcher will always pass a zero offset.

To specify the pattern, call the methods on the returned object. For example:

expect(myRenderObject, paints..circle(radius: 10.0)..circle(radius: 20.0));

This particular pattern would verify that the render object myRenderObject paints, among other things, two circles of radius 10.0 and 20.0 (in that order).

See PaintPattern for a discussion of the semantics of paint patterns.

To match something which paints nothing, see paintsNothing.

To match something which asserts instead of painting, see paintsAssertion.

Implementation

PaintPattern get paints => _TestRecordingCanvasPatternMatcher();