Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -12,12 +12,12 @@ void main() {
|
||||
final _MockClipboard mockClipboard = _MockClipboard();
|
||||
|
||||
testWidgets('Copies text on Ctrl-C', (WidgetTester tester) async {
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, mockClipboard.handleMethodCall);
|
||||
await tester.pumpWidget(const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(child: example.VerificationCodeGenerator()),
|
||||
),
|
||||
),
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
SystemChannels.platform,
|
||||
mockClipboard.handleMethodCall,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: Scaffold(body: Center(child: example.VerificationCodeGenerator()))),
|
||||
);
|
||||
|
||||
expect(primaryFocus, isNotNull);
|
||||
|
||||
@@ -8,7 +8,9 @@ import 'package:flutter_api_samples/widgets/actions/action_listener.0.dart' as e
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ActionListener can be enabled, triggered, and disabled', (WidgetTester tester) async {
|
||||
testWidgets('ActionListener can be enabled, triggered, and disabled', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
final List<String?> log = <String?>[];
|
||||
|
||||
final DebugPrintCallback originalDebugPrint = debugPrint;
|
||||
@@ -16,9 +18,7 @@ void main() {
|
||||
log.add(message);
|
||||
};
|
||||
try {
|
||||
await tester.pumpWidget(
|
||||
const example.ActionListenerExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ActionListenerExampleApp());
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'ActionListener Sample'), findsOne);
|
||||
expect(find.widgetWithText(OutlinedButton, 'Enable'), findsOne);
|
||||
@@ -39,10 +39,7 @@ void main() {
|
||||
await tester.pump();
|
||||
|
||||
expect(find.widgetWithText(OutlinedButton, 'Enable'), findsOne);
|
||||
expect(
|
||||
log,
|
||||
const <String?>['Action Listener was added', 'Action Listener was removed'],
|
||||
);
|
||||
expect(log, const <String?>['Action Listener was added', 'Action Listener was removed']);
|
||||
} finally {
|
||||
debugPrint = originalDebugPrint;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,7 @@ void main() {
|
||||
final ButtonStyleButton button = tester.widget<ButtonStyleButton>(
|
||||
find.descendant(
|
||||
of: find.byType(example.SaveButton),
|
||||
matching: find.byWidgetPredicate(
|
||||
(Widget widget) => widget is TextButton,
|
||||
),
|
||||
matching: find.byWidgetPredicate((Widget widget) => widget is TextButton),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -22,9 +20,7 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets('Increments and decrements value', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ActionsExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ActionsExampleApp());
|
||||
|
||||
int value = 0;
|
||||
|
||||
@@ -50,9 +46,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('SaveButton indicates dirty status', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ActionsExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ActionsExampleApp());
|
||||
|
||||
// Verify that initial color is green, as the value is not marked as dirty.
|
||||
Color? saveButtonColor = getSaveButtonColor(tester);
|
||||
@@ -85,18 +79,13 @@ void main() {
|
||||
log.add(message);
|
||||
};
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ActionsExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ActionsExampleApp());
|
||||
|
||||
// Verify that value is not marked as dirty.
|
||||
Color? saveButtonColor = getSaveButtonColor(tester);
|
||||
expect(saveButtonColor, equals(Colors.green));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(example.SaveButton),
|
||||
matching: find.text('0'),
|
||||
),
|
||||
find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
@@ -109,10 +98,7 @@ void main() {
|
||||
saveButtonColor = getSaveButtonColor(tester);
|
||||
expect(saveButtonColor, equals(Colors.red));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(example.SaveButton),
|
||||
matching: find.text('0'),
|
||||
),
|
||||
find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
@@ -128,10 +114,7 @@ void main() {
|
||||
saveButtonColor = getSaveButtonColor(tester);
|
||||
expect(saveButtonColor, equals(Colors.green));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(example.SaveButton),
|
||||
matching: find.text('-1'),
|
||||
),
|
||||
find.descendant(of: find.byType(example.SaveButton), matching: find.text('-1')),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ void main() {
|
||||
);
|
||||
|
||||
testWidgets('Taps on the "And me" button toggle the red box', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.FocusableActionDetectorExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.FocusableActionDetectorExampleApp());
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne);
|
||||
|
||||
@@ -32,10 +30,10 @@ void main() {
|
||||
expect(redContainerFinder, findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('Hits on the X key when "And me" is focused toggle the red box', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.FocusableActionDetectorExampleApp(),
|
||||
);
|
||||
testWidgets('Hits on the X key when "And me" is focused toggle the red box', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.FocusableActionDetectorExampleApp());
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user