Skip to content

Commit b11f6d0

Browse files
Re-run dart format with the SDK pinned by this branch's base commit
The previous formatting commit was produced with a stale Dart SDK from an older checkout, which reflowed untouched code (e.g. the `FormatEditUpdateCallback` typedef) into the wrong style. This re-formats with the SDK matching this branch's engine hash, so the diff is now limited to the unskipped tests. TAG=agy CONV=2ef6722f-0cc3-4e2c-bfe0-769079846fee
1 parent d9bfeb8 commit b11f6d0

2 files changed

Lines changed: 123 additions & 134 deletions

File tree

‎packages/flutter/test/cupertino/text_field_test.dart‎

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,8 +1978,7 @@ void main() {
19781978

19791979
testWidgets('Tapping on a collapsed selection toggles the toolbar', (WidgetTester tester) async {
19801980
final controller = TextEditingController(
1981-
text:
1982-
'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
1981+
text: 'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
19831982
);
19841983
addTearDown(controller.dispose);
19851984
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
@@ -2059,66 +2058,63 @@ void main() {
20592058
expectNoCupertinoToolbar();
20602059
}, variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}));
20612060

2062-
testWidgets('Tapping on a non-collapsed selection toggles the toolbar and retains the selection', (
2063-
WidgetTester tester,
2064-
) async {
2065-
final controller = TextEditingController(text: 'Atwater Peel Sherbrooke Bonaventure');
2066-
addTearDown(controller.dispose);
2067-
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
2068-
await tester.pumpWidget(
2069-
CupertinoApp(
2070-
home: Center(child: CupertinoTextField(controller: controller)),
2071-
),
2072-
);
2061+
testWidgets(
2062+
'Tapping on a non-collapsed selection toggles the toolbar and retains the selection',
2063+
(WidgetTester tester) async {
2064+
final controller = TextEditingController(text: 'Atwater Peel Sherbrooke Bonaventure');
2065+
addTearDown(controller.dispose);
2066+
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
2067+
await tester.pumpWidget(
2068+
CupertinoApp(
2069+
home: Center(child: CupertinoTextField(controller: controller)),
2070+
),
2071+
);
20732072

2074-
final Offset vPos = textOffsetToPosition(tester, 29); // Index of 'Bonav|enture'.
2075-
final Offset ePos =
2076-
textOffsetToPosition(tester, 35) +
2077-
const Offset(
2078-
7.0,
2079-
0.0,
2080-
); // Index of 'Bonaventure|' + Offset(7.0,0), which taps slightly to the right of the end of the text.
2081-
final Offset wPos = textOffsetToPosition(tester, 3); // Index of 'Atw|ater'.
2073+
final Offset vPos = textOffsetToPosition(tester, 29); // Index of 'Bonav|enture'.
2074+
final Offset ePos = textOffsetToPosition(tester, 35) + const Offset(7.0, 0.0); // Index of 'Bonaventure|' + Offset(7.0,0), which taps slightly to the right of the end of the text.
2075+
final Offset wPos = textOffsetToPosition(tester, 3); // Index of 'Atw|ater'.
20822076

2083-
// This tap just puts the cursor somewhere different than where the double
2084-
// tap will occur to test that the double tap moves the existing cursor first.
2085-
await tester.tapAt(wPos);
2086-
await tester.pump(const Duration(milliseconds: 500));
2077+
// This tap just puts the cursor somewhere different than where the double
2078+
// tap will occur to test that the double tap moves the existing cursor first.
2079+
await tester.tapAt(wPos);
2080+
await tester.pump(const Duration(milliseconds: 500));
20872081

2088-
await tester.tapAt(vPos);
2089-
await tester.pump(const Duration(milliseconds: 50));
2090-
// First tap moved the cursor.
2091-
expect(controller.selection.isCollapsed, true);
2092-
expect(controller.selection.baseOffset, 35);
2093-
await tester.tapAt(vPos);
2094-
await tester.pumpAndSettle(const Duration(milliseconds: 500));
2082+
await tester.tapAt(vPos);
2083+
await tester.pump(const Duration(milliseconds: 50));
2084+
// First tap moved the cursor.
2085+
expect(controller.selection.isCollapsed, true);
2086+
expect(controller.selection.baseOffset, 35);
2087+
await tester.tapAt(vPos);
2088+
await tester.pumpAndSettle(const Duration(milliseconds: 500));
20952089

2096-
// Second tap selects the word around the cursor.
2097-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
2090+
// Second tap selects the word around the cursor.
2091+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
20982092

2099-
expectCupertinoToolbarForPartialSelection();
2093+
expectCupertinoToolbarForPartialSelection();
21002094

2101-
// Tap the selected word to hide the toolbar and retain the selection.
2102-
await tester.tapAt(vPos);
2103-
await tester.pumpAndSettle();
2104-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
2105-
expect(find.byType(CupertinoButton), findsNothing);
2095+
// Tap the selected word to hide the toolbar and retain the selection.
2096+
await tester.tapAt(vPos);
2097+
await tester.pumpAndSettle();
2098+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
2099+
expect(find.byType(CupertinoButton), findsNothing);
21062100

2107-
// Tap the selected word to show the toolbar and retain the selection.
2108-
await tester.tapAt(vPos);
2109-
await tester.pumpAndSettle();
2110-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
2101+
// Tap the selected word to show the toolbar and retain the selection.
2102+
await tester.tapAt(vPos);
2103+
await tester.pumpAndSettle();
2104+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
21112105

2112-
expectCupertinoToolbarForPartialSelection();
2106+
expectCupertinoToolbarForPartialSelection();
21132107

2114-
// Tap past the selected word to move the cursor and hide the toolbar.
2115-
await tester.tapAt(ePos);
2116-
await tester.pumpAndSettle();
2117-
expect(controller.selection.isCollapsed, true);
2118-
expect(controller.selection.baseOffset, 35);
2108+
// Tap past the selected word to move the cursor and hide the toolbar.
2109+
await tester.tapAt(ePos);
2110+
await tester.pumpAndSettle();
2111+
expect(controller.selection.isCollapsed, true);
2112+
expect(controller.selection.baseOffset, 35);
21192113

2120-
expect(find.byType(CupertinoButton), findsNothing);
2121-
}, variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}));
2114+
expect(find.byType(CupertinoButton), findsNothing);
2115+
},
2116+
variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}),
2117+
);
21222118

21232119
testWidgets(
21242120
'double tap selects word for non-Apple platforms',

‎packages/flutter/test/material/text_field_test.dart‎

Lines changed: 75 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,9 +1610,9 @@ void main() {
16101610
await tester.pump();
16111611

16121612
final double inputWidth = findRenderEditable(tester).size.width;
1613-
final Offset cursorOffsetSpaces = findRenderEditable(
1614-
tester,
1615-
).getLocalRectForCaret(const TextPosition(offset: testValueSpaces.length)).bottomRight;
1613+
final Offset cursorOffsetSpaces = findRenderEditable(tester)
1614+
.getLocalRectForCaret(const TextPosition(offset: testValueSpaces.length))
1615+
.bottomRight;
16161616

16171617
expect(cursorOffsetSpaces.dx, inputWidth - kCaretGap);
16181618
});
@@ -1634,9 +1634,9 @@ void main() {
16341634
await tester.tapAt(textOffsetToPosition(tester, testValueSpaces.length));
16351635
await tester.pump();
16361636

1637-
final Offset cursorOffsetSpaces = findRenderEditable(
1638-
tester,
1639-
).getLocalRectForCaret(const TextPosition(offset: testValueSpaces.length)).topLeft;
1637+
final Offset cursorOffsetSpaces = findRenderEditable(tester)
1638+
.getLocalRectForCaret(const TextPosition(offset: testValueSpaces.length))
1639+
.topLeft;
16401640

16411641
expect(cursorOffsetSpaces.dx >= 0, isTrue);
16421642
});
@@ -10237,8 +10237,7 @@ void main() {
1023710237

1023810238
testWidgets('Tapping on a collapsed selection toggles the toolbar', (WidgetTester tester) async {
1023910239
final TextEditingController controller = _textEditingController(
10240-
text:
10241-
'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
10240+
text: 'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
1024210241
);
1024310242
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
1024410243
await tester.pumpWidget(
@@ -10319,68 +10318,65 @@ void main() {
1031910318
expectNoCupertinoToolbar();
1032010319
}, variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}));
1032110320

10322-
testWidgets('Tapping on a non-collapsed selection toggles the toolbar and retains the selection', (
10323-
WidgetTester tester,
10324-
) async {
10325-
final TextEditingController controller = _textEditingController(
10326-
text: 'Atwater Peel Sherbrooke Bonaventure',
10327-
);
10328-
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
10329-
await tester.pumpWidget(
10330-
MaterialApp(
10331-
home: Material(
10332-
child: Center(child: TextField(controller: controller)),
10321+
testWidgets(
10322+
'Tapping on a non-collapsed selection toggles the toolbar and retains the selection',
10323+
(WidgetTester tester) async {
10324+
final TextEditingController controller = _textEditingController(
10325+
text: 'Atwater Peel Sherbrooke Bonaventure',
10326+
);
10327+
// On iOS/iPadOS, during a tap we select the edge of the word closest to the tap.
10328+
await tester.pumpWidget(
10329+
MaterialApp(
10330+
home: Material(
10331+
child: Center(child: TextField(controller: controller)),
10332+
),
1033310333
),
10334-
),
10335-
);
10334+
);
1033610335

10337-
final Offset vPos = textOffsetToPosition(tester, 29); // Index of 'Bonav|enture'.
10338-
final Offset ePos =
10339-
textOffsetToPosition(tester, 35) +
10340-
const Offset(
10341-
7.0,
10342-
0.0,
10343-
); // Index of 'Bonaventure|' + Offset(7.0,0), which taps slightly to the right of the end of the text.
10344-
final Offset wPos = textOffsetToPosition(tester, 3); // Index of 'Atw|ater'.
10336+
final Offset vPos = textOffsetToPosition(tester, 29); // Index of 'Bonav|enture'.
10337+
final Offset ePos = textOffsetToPosition(tester, 35) + const Offset(7.0, 0.0); // Index of 'Bonaventure|' + Offset(7.0,0), which taps slightly to the right of the end of the text.
10338+
final Offset wPos = textOffsetToPosition(tester, 3); // Index of 'Atw|ater'.
1034510339

10346-
// This tap just puts the cursor somewhere different than where the double
10347-
// tap will occur to test that the double tap moves the existing cursor first.
10348-
await tester.tapAt(wPos);
10349-
await tester.pump(const Duration(milliseconds: 500));
10340+
// This tap just puts the cursor somewhere different than where the double
10341+
// tap will occur to test that the double tap moves the existing cursor first.
10342+
await tester.tapAt(wPos);
10343+
await tester.pump(const Duration(milliseconds: 500));
1035010344

10351-
await tester.tapAt(vPos);
10352-
await tester.pump(const Duration(milliseconds: 50));
10353-
// First tap moved the cursor.
10354-
expect(controller.selection.isCollapsed, true);
10355-
expect(controller.selection.baseOffset, 35);
10356-
await tester.tapAt(vPos);
10357-
await tester.pumpAndSettle(const Duration(milliseconds: 500));
10345+
await tester.tapAt(vPos);
10346+
await tester.pump(const Duration(milliseconds: 50));
10347+
// First tap moved the cursor.
10348+
expect(controller.selection.isCollapsed, true);
10349+
expect(controller.selection.baseOffset, 35);
10350+
await tester.tapAt(vPos);
10351+
await tester.pumpAndSettle(const Duration(milliseconds: 500));
1035810352

10359-
// Second tap selects the word around the cursor.
10360-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
10353+
// Second tap selects the word around the cursor.
10354+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
1036110355

10362-
// The toolbar shows up.
10363-
expectCupertinoToolbarForPartialSelection();
10356+
// The toolbar shows up.
10357+
expectCupertinoToolbarForPartialSelection();
1036410358

10365-
// Tap the selected word to hide the toolbar and retain the selection.
10366-
await tester.tapAt(vPos);
10367-
await tester.pumpAndSettle();
10368-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
10369-
expectNoCupertinoToolbar();
10359+
// Tap the selected word to hide the toolbar and retain the selection.
10360+
await tester.tapAt(vPos);
10361+
await tester.pumpAndSettle();
10362+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
10363+
expectNoCupertinoToolbar();
1037010364

10371-
// Tap the selected word to show the toolbar and retain the selection.
10372-
await tester.tapAt(vPos);
10373-
await tester.pumpAndSettle();
10374-
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
10375-
expectCupertinoToolbarForPartialSelection();
10365+
// Tap the selected word to show the toolbar and retain the selection.
10366+
await tester.tapAt(vPos);
10367+
await tester.pumpAndSettle();
10368+
expect(controller.selection, const TextSelection(baseOffset: 24, extentOffset: 35));
10369+
expectCupertinoToolbarForPartialSelection();
1037610370

10377-
// Tap past the selected word to move the cursor and hide the toolbar.
10378-
await tester.tapAt(ePos);
10379-
await tester.pumpAndSettle();
10380-
expect(controller.selection.isCollapsed, true);
10381-
expect(controller.selection.baseOffset, 35);
10382-
expectNoCupertinoToolbar();
10383-
}, variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}));
10371+
// Tap past the selected word to move the cursor and hide the toolbar.
10372+
await tester.tapAt(ePos);
10373+
await tester.pumpAndSettle();
10374+
expect(controller.selection.isCollapsed, true);
10375+
expect(controller.selection.baseOffset, 35);
10376+
expectNoCupertinoToolbar();
10377+
},
10378+
variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.iOS}),
10379+
);
1038410380

1038510381
testWidgets('double tap selects word and first tap of double tap moves cursor (iOS)', (
1038610382
WidgetTester tester,
@@ -13223,8 +13219,7 @@ void main() {
1322313219
'long press drag can edge scroll vertically',
1322413220
(WidgetTester tester) async {
1322513221
final TextEditingController controller = _textEditingController(
13226-
text:
13227-
'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
13222+
text: 'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neigse Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
1322813223
);
1322913224
await tester.pumpWidget(
1323013225
MaterialApp(
@@ -13299,8 +13294,7 @@ void main() {
1329913294
'keyboard selection change scrolls the field vertically',
1330013295
(WidgetTester tester) async {
1330113296
final TextEditingController controller = _textEditingController(
13302-
text:
13303-
'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
13297+
text: 'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
1330413298
);
1330513299
await tester.pumpWidget(
1330613300
MaterialApp(
@@ -13361,8 +13355,7 @@ void main() {
1336113355

1336213356
testWidgets('mouse click and drag can edge scroll vertically', (WidgetTester tester) async {
1336313357
final TextEditingController controller = _textEditingController(
13364-
text:
13365-
'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
13358+
text: 'Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges Atwater Peel Sherbrooke Bonaventure Angrignon Peel Côte-des-Neiges',
1336613359
);
1336713360
await tester.pumpWidget(
1336813361
MaterialApp(
@@ -15123,13 +15116,12 @@ void main() {
1512315116
TextField(
1512415117
key: textField2Key,
1512515118
maxLength: 1,
15126-
buildCounter:
15127-
(
15128-
BuildContext context, {
15129-
required int currentLength,
15130-
required bool isFocused,
15131-
int? maxLength,
15132-
}) => null,
15119+
buildCounter: (
15120+
BuildContext context, {
15121+
required int currentLength,
15122+
required bool isFocused,
15123+
int? maxLength,
15124+
}) => null,
1513315125
),
1513415126
],
1513515127
),
@@ -17302,12 +17294,11 @@ void main() {
1730217294
final Widget customMagnifier = Container(key: UniqueKey());
1730317295
final textField = TextField(
1730417296
magnifierConfiguration: TextMagnifierConfiguration(
17305-
magnifierBuilder:
17306-
(
17307-
BuildContext context,
17308-
MagnifierController controller,
17309-
ValueNotifier<MagnifierInfo>? info,
17310-
) => customMagnifier,
17297+
magnifierBuilder: (
17298+
BuildContext context,
17299+
MagnifierController controller,
17300+
ValueNotifier<MagnifierInfo>? info,
17301+
) => customMagnifier,
1731117302
),
1731217303
);
1731317304

@@ -19347,8 +19338,10 @@ class _ObscureTextTestWidgetState extends State<_ObscureTextTestWidget> {
1934719338
}
1934819339
}
1934919340

19350-
typedef FormatEditUpdateCallback =
19351-
void Function(TextEditingValue oldValue, TextEditingValue newValue);
19341+
typedef FormatEditUpdateCallback = void Function(
19342+
TextEditingValue oldValue,
19343+
TextEditingValue newValue,
19344+
);
1935219345

1935319346
// On web, key events in text fields are handled by the browser.
1935419347
const bool areKeyEventsHandledByPlatform = isBrowser;

0 commit comments

Comments
 (0)