Format controller.dart of flutter_test (#159667)

Format controller.dart of flutter_test

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
Flop 2024-12-04 14:07:11 +08:00 committed by GitHub
parent 628ab7f493
commit 74757b3a04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -381,7 +381,7 @@ class SemanticsController {
finders.FinderBase<SemanticsNode> finder,
SemanticsAction action, {
Object? args,
bool checkForAction = true
bool checkForAction = true,
}) {
final SemanticsNode node = finder.evaluate().single;
if (checkForAction && !node.getSemanticsData().hasAction(action)) {
@ -515,12 +515,12 @@ class SemanticsController {
/// [SemanticsAction.moveCursorForwardByCharacter].
void moveCursorForwardByCharacter(
finders.FinderBase<SemanticsNode> finder, {
bool shouldModifySelection = false
bool shouldModifySelection = false,
}) {
performAction(
finder,
SemanticsAction.moveCursorForwardByCharacter,
args: shouldModifySelection
args: shouldModifySelection,
);
}
@ -533,12 +533,12 @@ class SemanticsController {
/// [SemanticsAction.moveCursorForwardByWord].
void moveCursorForwardByWord(
finders.FinderBase<SemanticsNode> finder, {
bool shouldModifySelection = false
bool shouldModifySelection = false,
}) {
performAction(
finder,
SemanticsAction.moveCursorForwardByWord,
args: shouldModifySelection
args: shouldModifySelection,
);
}
@ -554,12 +554,12 @@ class SemanticsController {
/// [SemanticsAction.moveCursorBackwardByCharacter].
void moveCursorBackwardByCharacter(
finders.FinderBase<SemanticsNode> finder, {
bool shouldModifySelection = false
bool shouldModifySelection = false,
}) {
performAction(
finder,
SemanticsAction.moveCursorBackwardByCharacter,
args: shouldModifySelection
args: shouldModifySelection,
);
}
@ -572,12 +572,12 @@ class SemanticsController {
/// [SemanticsAction.moveCursorBackwardByWord].
void moveCursorBackwardByWord(
finders.FinderBase<SemanticsNode> finder, {
bool shouldModifySelection = false
bool shouldModifySelection = false,
}) {
performAction(
finder,
SemanticsAction.moveCursorBackwardByWord,
args: shouldModifySelection
args: shouldModifySelection,
);
}
@ -606,7 +606,7 @@ class SemanticsController {
void setSelection(
finders.FinderBase<SemanticsNode> finder, {
required int base,
required int extent
required int extent,
}) {
performAction(
finder,
@ -681,7 +681,7 @@ class SemanticsController {
performAction(
finder,
SemanticsAction.customAction,
args: CustomSemanticsAction.getIdentifier(action)
args: CustomSemanticsAction.getIdentifier(action),
);
}
@ -1000,6 +1000,7 @@ abstract class WidgetController {
..._walkLayers(renderView.debugLayer!)
];
}
Iterable<Layer> _walkLayers(Layer layer) sync* {
TestAsyncUtils.guardSync();
yield layer;
@ -1078,8 +1079,7 @@ abstract class WidgetController {
ErrorDescription('Found a matching substring in a static text widget, within ${found.textRange}.'),
ErrorDescription('But the "tapOnText" method could not find a hit-testable Offset with in that text range.'),
found.renderObject.toDiagnosticsNode(name: 'The RenderBox of that static text widget was', style: DiagnosticsTreeStyle.shallow),
]
);
]);
}
return tapAt(tapLocation, pointer: pointer, buttons: buttons);
}
@ -1993,7 +1993,7 @@ abstract class WidgetController {
LogicalKeyboardKey key, {
String? platform,
String? character,
PhysicalKeyboardKey? physicalKey
PhysicalKeyboardKey? physicalKey,
}) async {
final bool handled = await simulateKeyDownEvent(key, platform: platform, character: character, physicalKey: physicalKey);
// Internally wrapped in async guard.
@ -2032,7 +2032,7 @@ abstract class WidgetController {
LogicalKeyboardKey key, {
String? platform,
String? character,
PhysicalKeyboardKey? physicalKey
PhysicalKeyboardKey? physicalKey,
}) async {
// Internally wrapped in async guard.
return simulateKeyDownEvent(key, platform: platform, character: character, physicalKey: physicalKey);
@ -2062,7 +2062,7 @@ abstract class WidgetController {
Future<bool> sendKeyUpEvent(
LogicalKeyboardKey key, {
String? platform,
PhysicalKeyboardKey? physicalKey
PhysicalKeyboardKey? physicalKey,
}) async {
// Internally wrapped in async guard.
return simulateKeyUpEvent(key, platform: platform, physicalKey: physicalKey);
@ -2099,7 +2099,7 @@ abstract class WidgetController {
LogicalKeyboardKey key, {
String? platform,
String? character,
PhysicalKeyboardKey? physicalKey
PhysicalKeyboardKey? physicalKey,
}) async {
// Internally wrapped in async guard.
return simulateKeyRepeatEvent(key, platform: platform, character: character, physicalKey: physicalKey);
@ -2178,8 +2178,7 @@ abstract class WidgetController {
finders.FinderBase<Element>? scrollable,
int maxScrolls = 50,
Duration duration = const Duration(milliseconds: 50),
}
) {
}) {
assert(maxScrolls > 0);
scrollable ??= finders.find.byType(Scrollable);
return TestAsyncUtils.guard<void>(() async {