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
@@ -8,9 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can open menu and show message', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuApp());
|
||||
|
||||
await tester.tap(find.byType(TextButton));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -29,9 +27,7 @@ void main() {
|
||||
const double safeAreaPadding = 100.0;
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(
|
||||
padding: EdgeInsets.symmetric(vertical: safeAreaPadding),
|
||||
),
|
||||
data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)),
|
||||
child: example.MenuApp(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -11,10 +11,7 @@ void main() {
|
||||
testWidgets('Can open menu', (WidgetTester tester) async {
|
||||
Finder findMenu(String label) {
|
||||
return find
|
||||
.ancestor(
|
||||
of: find.text(label, findRichText: true),
|
||||
matching: find.byType(FocusScope),
|
||||
)
|
||||
.ancestor(of: find.text(label, findRichText: true), matching: find.byType(FocusScope))
|
||||
.first;
|
||||
}
|
||||
|
||||
@@ -57,9 +54,7 @@ void main() {
|
||||
const double safeAreaPadding = 100.0;
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(
|
||||
padding: EdgeInsets.symmetric(vertical: safeAreaPadding),
|
||||
),
|
||||
data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)),
|
||||
child: example.MenuAcceleratorApp(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -9,9 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can open menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuApp());
|
||||
|
||||
await tester.tap(find.byType(TextButton));
|
||||
await tester.pump();
|
||||
@@ -51,9 +49,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Shortcuts work', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuApp());
|
||||
|
||||
// Open the menu so we can watch state changes resulting from the shortcuts
|
||||
// firing.
|
||||
@@ -112,9 +108,7 @@ void main() {
|
||||
const double safeAreaPadding = 100.0;
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(
|
||||
padding: EdgeInsets.symmetric(vertical: safeAreaPadding),
|
||||
),
|
||||
data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)),
|
||||
child: example.MenuApp(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -11,10 +11,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('Can open menu', (WidgetTester tester) async {
|
||||
Finder findMenu() {
|
||||
return find.ancestor(
|
||||
of: find.text(example.MenuEntry.about.label),
|
||||
matching: find.byType(FocusScope),
|
||||
).first;
|
||||
return find
|
||||
.ancestor(of: find.text(example.MenuEntry.about.label), matching: find.byType(FocusScope))
|
||||
.first;
|
||||
}
|
||||
|
||||
await tester.pumpWidget(const example.ContextMenuApp());
|
||||
@@ -78,9 +77,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Shortcuts work', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ContextMenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ContextMenuApp());
|
||||
|
||||
// Open the menu so we can look for state changes reflected in the menu.
|
||||
await tester.tapAt(const Offset(100, 200), buttons: kSecondaryButton);
|
||||
|
||||
@@ -8,13 +8,14 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('The menu should display three items', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuAnchorApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuAnchorApp());
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'MenuAnchorButton'), findsOne);
|
||||
expect(
|
||||
find.descendant(of: find.byType(MenuAnchor), matching: find.widgetWithIcon(IconButton, Icons.more_horiz)),
|
||||
find.descendant(
|
||||
of: find.byType(MenuAnchor),
|
||||
matching: find.widgetWithIcon(IconButton, Icons.more_horiz),
|
||||
),
|
||||
findsOne,
|
||||
);
|
||||
|
||||
|
||||
@@ -7,30 +7,30 @@ import 'package:flutter_api_samples/material/menu_anchor/menu_anchor.3.dart' as
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Menu button opens and closes the menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.SimpleCascadingMenuApp());
|
||||
testWidgets('Menu button opens and closes the menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.SimpleCascadingMenuApp());
|
||||
|
||||
// Find the menu button.
|
||||
final Finder menuButton = find.byType(IconButton);
|
||||
expect(menuButton, findsOneWidget);
|
||||
// Find the menu button.
|
||||
final Finder menuButton = find.byType(IconButton);
|
||||
expect(menuButton, findsOneWidget);
|
||||
|
||||
// Tap the menu button to open the menu.
|
||||
await tester.tap(menuButton);
|
||||
await tester.pumpAndSettle();
|
||||
// Tap the menu button to open the menu.
|
||||
await tester.tap(menuButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify that the menu is open.
|
||||
expect(find.text('Revert'), findsOneWidget);
|
||||
// Verify that the menu is open.
|
||||
expect(find.text('Revert'), findsOneWidget);
|
||||
|
||||
// Tap the menu button again to close the menu.
|
||||
await tester.tap(menuButton);
|
||||
await tester.pumpAndSettle();
|
||||
// Tap the menu button again to close the menu.
|
||||
await tester.tap(menuButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Verify that the menu is closed.
|
||||
expect(find.text('Revert'), findsNothing);
|
||||
});
|
||||
// Verify that the menu is closed.
|
||||
expect(find.text('Revert'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('Does not show debug banner', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.SimpleCascadingMenuApp());
|
||||
expect(find.byType(CheckedModeBanner), findsNothing);
|
||||
});
|
||||
testWidgets('Does not show debug banner', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.SimpleCascadingMenuApp());
|
||||
expect(find.byType(CheckedModeBanner), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can open menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuBarApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuBarApp());
|
||||
|
||||
final Finder menuBarFinder = find.byType(MenuBar);
|
||||
final MenuBar menuBar = tester.widget<MenuBar>(menuBarFinder);
|
||||
@@ -53,9 +51,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Shortcuts work', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuBarApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuBarApp());
|
||||
|
||||
expect(find.text(example.MenuBarApp.kMessage), findsNothing);
|
||||
|
||||
@@ -97,9 +93,7 @@ void main() {
|
||||
const double safeAreaPadding = 100.0;
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(
|
||||
padding: EdgeInsets.symmetric(vertical: safeAreaPadding),
|
||||
),
|
||||
data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)),
|
||||
child: example.MenuBarApp(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -9,9 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can open menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuApp());
|
||||
|
||||
await tester.tap(find.byType(TextButton));
|
||||
await tester.pump();
|
||||
@@ -30,9 +28,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Shortcuts work', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.MenuApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.MenuApp());
|
||||
|
||||
// Open the menu so we can watch state changes resulting from the shortcuts
|
||||
// firing.
|
||||
@@ -53,7 +49,17 @@ void main() {
|
||||
// update the overlay entry.
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.widget<Radio<Color>>(find.descendant(of: find.byType(RadioMenuButton<Color>).at(0), matching: find.byType(Radio<Color>))).groupValue, equals(Colors.green));
|
||||
expect(
|
||||
tester
|
||||
.widget<Radio<Color>>(
|
||||
find.descendant(
|
||||
of: find.byType(RadioMenuButton<Color>).at(0),
|
||||
matching: find.byType(Radio<Color>),
|
||||
),
|
||||
)
|
||||
.groupValue,
|
||||
equals(Colors.green),
|
||||
);
|
||||
expect(tester.widget<Container>(find.byType(Container)).color, equals(Colors.green));
|
||||
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||
@@ -62,7 +68,17 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.widget<Radio<Color>>(find.descendant(of: find.byType(RadioMenuButton<Color>).at(1), matching: find.byType(Radio<Color>))).groupValue, equals(Colors.red));
|
||||
expect(
|
||||
tester
|
||||
.widget<Radio<Color>>(
|
||||
find.descendant(
|
||||
of: find.byType(RadioMenuButton<Color>).at(1),
|
||||
matching: find.byType(Radio<Color>),
|
||||
),
|
||||
)
|
||||
.groupValue,
|
||||
equals(Colors.red),
|
||||
);
|
||||
expect(tester.widget<Container>(find.byType(Container)).color, equals(Colors.red));
|
||||
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||
@@ -71,7 +87,17 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.widget<Radio<Color>>(find.descendant(of: find.byType(RadioMenuButton<Color>).at(2), matching: find.byType(Radio<Color>))).groupValue, equals(Colors.blue));
|
||||
expect(
|
||||
tester
|
||||
.widget<Radio<Color>>(
|
||||
find.descendant(
|
||||
of: find.byType(RadioMenuButton<Color>).at(2),
|
||||
matching: find.byType(Radio<Color>),
|
||||
),
|
||||
)
|
||||
.groupValue,
|
||||
equals(Colors.blue),
|
||||
);
|
||||
expect(tester.widget<Container>(find.byType(Container)).color, equals(Colors.blue));
|
||||
});
|
||||
|
||||
@@ -79,9 +105,7 @@ void main() {
|
||||
const double safeAreaPadding = 100.0;
|
||||
await tester.pumpWidget(
|
||||
const MediaQuery(
|
||||
data: MediaQueryData(
|
||||
padding: EdgeInsets.symmetric(vertical: safeAreaPadding),
|
||||
),
|
||||
data: MediaQueryData(padding: EdgeInsets.symmetric(vertical: safeAreaPadding)),
|
||||
child: example.MenuApp(),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user