Unverified Commit 38d155a4 authored by liyuqian's avatar liyuqian Committed by GitHub

Add default-no-clip tests to more buttons (#21012)

Note that such tests already exist for RaisedButton and MaterialButton
parent 688d96b6
...@@ -520,4 +520,22 @@ void main() { ...@@ -520,4 +520,22 @@ void main() {
expect(tester.getSize(find.byKey(key2)), const Size(88.0, 36.0)); expect(tester.getSize(find.byKey(key2)), const Size(88.0, 36.0));
}); });
testWidgets('RaisedButton has no clip by default', (WidgetTester tester) async{
await tester.pumpWidget(
new Directionality(
textDirection: TextDirection.ltr,
child: new Material(
child: new RaisedButton(
onPressed: () { /* to make sure the button is enabled */ },
),
)
),
);
expect(
tester.renderObject(find.byType(RaisedButton)),
paintsExactlyCountTimes(#clipPath, 0)
);
});
} }
...@@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; ...@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('FlatButton implements debugFillDescription', (WidgetTester tester) async { testWidgets('FlatButton implements debugFillDescription', (WidgetTester tester) async {
final DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder(); final DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder();
...@@ -29,4 +31,23 @@ void main() { ...@@ -29,4 +31,23 @@ void main() {
'splashColor: Color(0xff9e9e9e)', 'splashColor: Color(0xff9e9e9e)',
]); ]);
}); });
testWidgets('FlatButton has no clip by default', (WidgetTester tester) async{
await tester.pumpWidget(
new Directionality(
textDirection: TextDirection.ltr,
child: new Material(
child: new FlatButton(
child: new Container(),
onPressed: () { /* to make sure the button is enabled */ },
),
)
),
);
expect(
tester.renderObject(find.byType(FlatButton)),
paintsExactlyCountTimes(#clipPath, 0)
);
});
} }
...@@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; ...@@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart';
import '../widgets/semantics_tester.dart'; import '../widgets/semantics_tester.dart';
void main() { void main() {
...@@ -438,4 +439,22 @@ void main() { ...@@ -438,4 +439,22 @@ void main() {
skip: !Platform.isLinux, skip: !Platform.isLinux,
); );
}); });
testWidgets('Floating Action Button has no clip by default', (WidgetTester tester) async{
await tester.pumpWidget(
new Directionality(
textDirection: TextDirection.ltr,
child: new Material(
child: new FloatingActionButton(
onPressed: () { /* to make sure the button is enabled */ },
),
)
),
);
expect(
tester.renderObject(find.byType(FloatingActionButton)),
paintsExactlyCountTimes(#clipPath, 0)
);
});
} }
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