coversSameAreaAs function

Matcher coversSameAreaAs (Path expectedPath, { @required Rect areaToCompare, int sampleSize: 20 })

Asserts that 2 paths cover the same area by sampling multiple points.

Samples at least sampleSize^2 points inside areaToCompare, and asserts that the Path.contains method returns the same value for each of the points for both paths.

When using this matcher you typically want to use a rectangle larger than the area you expect to paint in for areaToCompare to catch errors where the path draws outside the expected area.

Implementation

Matcher coversSameAreaAs(Path expectedPath, {@required Rect areaToCompare, int sampleSize = 20})
  => _CoversSameAreaAs(expectedPath, areaToCompare: areaToCompare, sampleSize: sampleSize);