Unverified Commit 4814303b authored by Vyacheslav Egorov's avatar Vyacheslav Egorov Committed by GitHub

Partially fix Dart 2 issues in animated_icons.test. (#14531)

Use mockito in the Dart 2 compliant way:

* use typed(...) in appropriate places to wrap matchers like any;
* don't pass matcher directly into the calls - use `argThat(matcher)`.

Also rename paintColorMatcher to hasColor to match how other similar
functions are named and how the code reads.
parent 0556e14f
......@@ -31,7 +31,7 @@ void main() {
final CustomPaint customPaint = tester.widget(find.byType(CustomPaint));
final MockCanvas canvas = new MockCanvas();
customPaint.painter.paint(canvas, const Size(48.0, 48.0));
verify(canvas.drawPath(any, paintColorMatcher(0xFF666666)));
verify(canvas.drawPath(typed(any), typed(argThat(hasColor(0xFF666666)))));
});
testWidgets('IconTheme opacity', (WidgetTester tester) async {
......@@ -53,7 +53,7 @@ void main() {
final CustomPaint customPaint = tester.widget(find.byType(CustomPaint));
final MockCanvas canvas = new MockCanvas();
customPaint.painter.paint(canvas, const Size(48.0, 48.0));
verify(canvas.drawPath(any, paintColorMatcher(0x80666666)));
verify(canvas.drawPath(typed(any), typed(argThat(hasColor(0x80666666)))));
});
testWidgets('color overrides IconTheme color', (WidgetTester tester) async {
......@@ -75,7 +75,7 @@ void main() {
final CustomPaint customPaint = tester.widget(find.byType(CustomPaint));
final MockCanvas canvas = new MockCanvas();
customPaint.painter.paint(canvas, const Size(48.0, 48.0));
verify(canvas.drawPath(any, paintColorMatcher(0xFF0000FF)));
verify(canvas.drawPath(typed(any), typed(argThat(hasColor(0xFF0000FF)))));
});
testWidgets('IconTheme size', (WidgetTester tester) async {
......@@ -185,8 +185,8 @@ void main() {
final CustomPaint customPaint = tester.widget(find.byType(CustomPaint));
final MockCanvas canvas = new MockCanvas();
customPaint.painter.paint(canvas, const Size(48.0, 48.0));
verifyNever(canvas.rotate(any));
verifyNever(canvas.translate(any, any));
verifyNever(canvas.rotate(typed(any)));
verifyNever(canvas.translate(typed(any), typed(any)));
});
testWidgets('Inherited text direction overridden', (WidgetTester tester) async {
......@@ -215,7 +215,7 @@ void main() {
});
}
dynamic paintColorMatcher(int color) {
PaintColorMatcher hasColor(int color) {
return new PaintColorMatcher(color);
}
......
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