Commit d0a72752 authored by Amir Hardon's avatar Amir Hardon Committed by amirh

update buttons_test to expect clipPath instead of clipRRect

parent c90983dd
......@@ -200,10 +200,19 @@ void main() {
await tester.pump(); // start gesture
await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way
final Rect expectedClipRect = new Rect.fromLTRB(356.0, 282.0, 444.0, 318.0);
final Path expectedClipPath = new Path()
..addRRect(new RRect.fromRectAndRadius(
expectedClipRect,
const Radius.circular(2.0),
));
expect(
Material.of(tester.element(find.byType(MaterialButton))),
paints
..clipRRect(rrect: new RRect.fromLTRBR(356.0, 282.0, 444.0, 318.0, const Radius.circular(2.0)))
..clipPath(pathMatcher: coversSameAreaAs(
expectedClipPath,
areaToCompare: expectedClipRect.inflate(10.0),
))
..circle(color: directSplashColor)
..rect(color: directHighlightColor)
);
......@@ -235,7 +244,10 @@ void main() {
expect(
Material.of(tester.element(find.byType(MaterialButton))),
paints
..clipRRect(rrect: new RRect.fromLTRBR(356.0, 282.0, 444.0, 318.0, const Radius.circular(2.0)))
..clipPath(pathMatcher: coversSameAreaAs(
expectedClipPath,
areaToCompare: expectedClipRect.inflate(10.0),
))
..circle(color: themeSplashColor1)
..rect(color: themeHighlightColor1)
);
......
......@@ -148,6 +148,18 @@ abstract class PaintPattern {
/// [Canvas.clipRect] call are ignored.
void clipRect({ Rect rect });
/// Indicates that a path clip is expected next.
///
/// The next path clip is examined.
/// The path that is passed to the actual [Canvas.clipPath] call is matched
/// using [pathMatcher].
///
/// If no call to [Canvas.clipPath] was made, then this results in failure.
///
/// Any calls made between the last matched call (if any) and the
/// [Canvas.clipPath] call are ignored.
void clipPath({Matcher pathMatcher});
/// Indicates that a rectangle is expected next.
///
/// The next rectangle is examined. Any arguments that are passed to this
......@@ -629,6 +641,11 @@ class _TestRecordingCanvasPatternMatcher extends _TestRecordingCanvasMatcher imp
_predicates.add(new _FunctionPaintPredicate(#clipRect, <dynamic>[rect]));
}
@override
void clipPath({Matcher pathMatcher}) {
_predicates.add(new _FunctionPaintPredicate(#clipPath, <dynamic>[pathMatcher]));
}
@override
void rect({ Rect rect, Color color, double strokeWidth, bool hasMaskFilter, PaintingStyle style }) {
_predicates.add(new _RectPaintPredicate(rect: rect, color: color, strokeWidth: strokeWidth, hasMaskFilter: hasMaskFilter, style: style));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment