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
@@ -5,5 +5,5 @@
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
test('trivial', () { });
|
||||
test('trivial', () {});
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
test('trivial', () { });
|
||||
test('trivial', () {});
|
||||
}
|
||||
|
||||
@@ -14,26 +14,91 @@ import 'package:platform/platform.dart';
|
||||
|
||||
// 1x1 colored pixel
|
||||
const List<int> _kFailPngBytes = <int>[
|
||||
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0,
|
||||
13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, 196, 137,
|
||||
0, 0, 0, 13, 73, 68, 65, 84, 120, 1, 99, 249, 207, 240, 255, 63, 0, 7, 18, 3,
|
||||
2, 164, 147, 160, 197, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130,
|
||||
137,
|
||||
80,
|
||||
78,
|
||||
71,
|
||||
13,
|
||||
10,
|
||||
26,
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
13,
|
||||
73,
|
||||
72,
|
||||
68,
|
||||
82,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
8,
|
||||
6,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
31,
|
||||
21,
|
||||
196,
|
||||
137,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
13,
|
||||
73,
|
||||
68,
|
||||
65,
|
||||
84,
|
||||
120,
|
||||
1,
|
||||
99,
|
||||
249,
|
||||
207,
|
||||
240,
|
||||
255,
|
||||
63,
|
||||
0,
|
||||
7,
|
||||
18,
|
||||
3,
|
||||
2,
|
||||
164,
|
||||
147,
|
||||
160,
|
||||
197,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
73,
|
||||
69,
|
||||
78,
|
||||
68,
|
||||
174,
|
||||
66,
|
||||
96,
|
||||
130,
|
||||
];
|
||||
|
||||
void main() {
|
||||
final List<String> log = <String>[];
|
||||
final MemoryFileSystem fs = MemoryFileSystem();
|
||||
final Directory basedir = fs.directory('flutter/test/library/')
|
||||
..createSync(recursive: true);
|
||||
final FakeSkiaGoldClient fakeSkiaClient = FakeSkiaGoldClient()
|
||||
..expectationForTestValues['flutter.new_golden_test.1'] = '';
|
||||
final Directory basedir = fs.directory('flutter/test/library/')..createSync(recursive: true);
|
||||
final FakeSkiaGoldClient fakeSkiaClient =
|
||||
FakeSkiaGoldClient()..expectationForTestValues['flutter.new_golden_test.1'] = '';
|
||||
final FlutterLocalFileComparator comparator = FlutterLocalFileComparator(
|
||||
basedir.uri,
|
||||
fakeSkiaClient,
|
||||
fs: fs,
|
||||
platform: FakePlatform(
|
||||
environment: <String, String>{'FLUTTER_ROOT': '/flutter'},
|
||||
operatingSystem: 'macos'
|
||||
operatingSystem: 'macos',
|
||||
),
|
||||
log: log.add,
|
||||
);
|
||||
@@ -48,9 +113,9 @@ void main() {
|
||||
isTrue,
|
||||
);
|
||||
const String expectation =
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.1.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.1.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
expect(log, const <String>[expectation]);
|
||||
});
|
||||
|
||||
@@ -64,9 +129,9 @@ void main() {
|
||||
isTrue,
|
||||
);
|
||||
const String expectation =
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.2.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.2.png. '
|
||||
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.\n'
|
||||
'Validate image output found at flutter/test/library/';
|
||||
expect(log, const <String>[expectation]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,12 +8,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
testWidgets('Rendering Error', (WidgetTester tester) async {
|
||||
// Assets can load with its package name.
|
||||
await tester.pumpWidget(
|
||||
Image.asset('icon/test.png',
|
||||
width: 54,
|
||||
height: 54,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(Image.asset('icon/test.png', width: 54, height: 54, fit: BoxFit.none));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,9 +12,7 @@ void main() {
|
||||
MaterialApp(
|
||||
theme: ThemeData(useMaterial3: false),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('RenderFlex OverFlow'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('RenderFlex OverFlow')),
|
||||
body: const SizedBox(
|
||||
width: 400.0,
|
||||
child: Row(
|
||||
@@ -30,7 +28,7 @@ void main() {
|
||||
'do eiusmod tempor incididunt ut labore et dolore magna '
|
||||
'aliqua. Ut enim ad minim veniam, quis nostrud '
|
||||
'exercitation ullamco laboris nisi ut aliquip ex ea '
|
||||
'commodo consequat.'
|
||||
'commodo consequat.',
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -38,7 +36,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ void main() {
|
||||
testWidgets('Rendering Error', (WidgetTester tester) async {
|
||||
// this should fail
|
||||
await tester.pumpWidget(
|
||||
CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: Container()),
|
||||
],
|
||||
)
|
||||
CustomScrollView(slivers: <Widget>[SliverToBoxAdapter(child: Container())]),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ void main() {
|
||||
testWidgets('Rendering Error', (WidgetTester tester) async {
|
||||
// this should fail
|
||||
await tester.pumpWidget(
|
||||
CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(child: Container()),
|
||||
],
|
||||
)
|
||||
CustomScrollView(slivers: <Widget>[SliverToBoxAdapter(child: Container())]),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
|
||||
@override
|
||||
DebugPrintCallback get debugPrintOverride => testPrint;
|
||||
static void testPrint(String? message, { int? wrapWidth }) { print(message); }
|
||||
static void testPrint(String? message, {int? wrapWidth}) {
|
||||
print(message);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> guardedHelper(WidgetTester tester) {
|
||||
|
||||
@@ -8,7 +8,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
|
||||
@override
|
||||
DebugPrintCallback get debugPrintOverride => testPrint;
|
||||
static void testPrint(String? message, { int? wrapWidth }) { print(message); }
|
||||
static void testPrint(String? message, {int? wrapWidth}) {
|
||||
print(message);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> helperFunction(WidgetTester tester) async {
|
||||
@@ -17,7 +19,9 @@ Future<void> helperFunction(WidgetTester tester) async {
|
||||
|
||||
void main() {
|
||||
TestTestBinding();
|
||||
testWidgets('TestAsyncUtils - handling unguarded async helper functions', (WidgetTester tester) async {
|
||||
testWidgets('TestAsyncUtils - handling unguarded async helper functions', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
helperFunction(tester);
|
||||
helperFunction(tester);
|
||||
// this should fail
|
||||
|
||||
@@ -8,9 +8,13 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Does flutter_test catch leaking tickers?', (WidgetTester tester) async {
|
||||
Ticker((Duration duration) { }).start();
|
||||
Ticker((Duration duration) {}).start();
|
||||
|
||||
final ByteData? message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
||||
await tester.binding.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
||||
await tester.binding.defaultBinaryMessenger.handlePlatformMessage(
|
||||
'flutter/lifecycle',
|
||||
message,
|
||||
(_) {},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
test('trivial', () { });
|
||||
test('trivial', () {});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ void main() {
|
||||
test('test smoke test -- this test should fail', () async {
|
||||
if (system.Process.killPid(system.pid, system.ProcessSignal.sigsegv)) {
|
||||
print('system.Process.killPid returned before the process ended!');
|
||||
print('Sleeping for a few seconds just in case signal delivery is delayed or our signal handler is being slow...');
|
||||
print(
|
||||
'Sleeping for a few seconds just in case signal delivery is delayed or our signal handler is being slow...',
|
||||
);
|
||||
system.sleep(const Duration(seconds: 10)); // don't sleep too much, we must not time out
|
||||
} else {
|
||||
print('system.Process.killPid reports that the SIGSEGV signal was not delivered!');
|
||||
|
||||
Reference in New Issue
Block a user