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:
Michael Goderbauer
2024-12-19 12:06:21 -08:00
committed by GitHub
parent 8e0993eda8
commit 5491c8c146
4411 changed files with 455108 additions and 415991 deletions

View File

@@ -28,21 +28,25 @@ void main() {
test('waitForAbsent should time out waiting for text "present" to disappear', () async {
await expectLater(
() => driver.waitForAbsent(presentText, timeout: const Duration(seconds: 1)),
throwsA(isA<DriverError>().having(
(DriverError error) => error.message,
'message',
contains('Timeout while executing waitForAbsent'),
)),
throwsA(
isA<DriverError>().having(
(DriverError error) => error.message,
'message',
contains('Timeout while executing waitForAbsent'),
),
),
);
}, timeout: Timeout.none);
test('waitForAbsent should resolve when text "present" disappears', () async {
// Begin waiting for it to disappear
final Completer<void> whenWaitForAbsentResolves = Completer<void>();
driver.waitForAbsent(presentText).then(
whenWaitForAbsentResolves.complete,
onError: whenWaitForAbsentResolves.completeError,
);
driver
.waitForAbsent(presentText)
.then(
whenWaitForAbsentResolves.complete,
onError: whenWaitForAbsentResolves.completeError,
);
// Wait 1 second then make it disappear
await Future<void>.delayed(const Duration(seconds: 1));
@@ -55,21 +59,22 @@ void main() {
test('waitFor times out waiting for "present" to reappear', () async {
await expectLater(
() => driver.waitFor(presentText, timeout: const Duration(seconds: 1)),
throwsA(isA<DriverError>().having(
(DriverError error) => error.message,
'message',
contains('Timeout while executing waitFor'),
)),
throwsA(
isA<DriverError>().having(
(DriverError error) => error.message,
'message',
contains('Timeout while executing waitFor'),
),
),
);
}, timeout: Timeout.none);
test('waitFor should resolve when text "present" reappears', () async {
// Begin waiting for it to reappear
final Completer<void> whenWaitForResolves = Completer<void>();
driver.waitFor(presentText).then(
whenWaitForResolves.complete,
onError: whenWaitForResolves.completeError,
);
driver
.waitFor(presentText)
.then(whenWaitForResolves.complete, onError: whenWaitForResolves.completeError);
// Wait 1 second then make it appear
await Future<void>.delayed(const Duration(seconds: 1));

View File

@@ -23,12 +23,8 @@ void main() {
});
test('minFrameNumber is numeric', () async {
final SerializableFinder minFrameNumberFinder =
find.byValueKey('minFrameNumber');
await driver.waitFor(
minFrameNumberFinder,
timeout: const Duration(seconds: 5),
);
final SerializableFinder minFrameNumberFinder = find.byValueKey('minFrameNumber');
await driver.waitFor(minFrameNumberFinder, timeout: const Duration(seconds: 5));
final String minFrameNumber = await driver.getText(minFrameNumberFinder);
// TODO(iskakaushik): enable the stronger check of _minFrameNumber == '1',
// once this is fixed. https://github.com/flutter/flutter/issues/86487

View File

@@ -24,7 +24,9 @@ void main() {
final SerializableFinder listViewFinder = find.byValueKey(keys.kListView);
final SerializableFinder textFieldFinder = find.byValueKey(keys.kDefaultTextField);
final SerializableFinder offsetFinder = find.byValueKey(keys.kOffsetText);
final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey(keys.kKeyboardVisibleView);
final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey(
keys.kKeyboardVisibleView,
);
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
await driver.waitForAbsent(textFieldFinder);

View File

@@ -17,7 +17,8 @@ void main() {
test('Can render solid red', () async {
// RGBA Encoded Bytes.
final Uint8List data = (await driver.screenshot(format: ScreenshotFormat.rawStraightRgba)) as Uint8List;
final Uint8List data =
(await driver.screenshot(format: ScreenshotFormat.rawStraightRgba)) as Uint8List;
expect(data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3], 0xFF0000FF);
}, timeout: Timeout.none);