Skip to content

Commit cc54416

Browse files
authored
Make pumpWidget's arguments named (#141728)
Much nicer calling API and simplifies evolving this API in the future. I wish we could write a dart fix for this, but that's blocked on dart-lang/sdk#54668.
1 parent 9e024fd commit cc54416

20 files changed

+80
-97
lines changed

packages/flutter/test/cupertino/segmented_control_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ void main() {
11061106
);
11071107
},
11081108
),
1109-
const Duration(milliseconds: 40),
1109+
duration: const Duration(milliseconds: 40),
11101110
);
11111111
expect(getBackgroundColor(tester, 0), const Color(0xff3d9aff));
11121112
expect(getBackgroundColor(tester, 1), const Color(0x64007aff));
@@ -1127,7 +1127,7 @@ void main() {
11271127
);
11281128
},
11291129
),
1130-
const Duration(milliseconds: 40),
1130+
duration: const Duration(milliseconds: 40),
11311131
);
11321132
expect(getBackgroundColor(tester, 0), const Color(0xff7bbaff));
11331133
expect(getBackgroundColor(tester, 1), const Color(0x95007aff));
@@ -1148,7 +1148,7 @@ void main() {
11481148
);
11491149
},
11501150
),
1151-
const Duration(milliseconds: 40),
1151+
duration: const Duration(milliseconds: 40),
11521152
);
11531153
expect(getBackgroundColor(tester, 0), const Color(0xffb9daff));
11541154
expect(getBackgroundColor(tester, 1), const Color(0xc7007aff));
@@ -1169,7 +1169,7 @@ void main() {
11691169
);
11701170
},
11711171
),
1172-
const Duration(milliseconds: 40),
1172+
duration: const Duration(milliseconds: 40),
11731173
);
11741174
expect(getBackgroundColor(tester, 0), const Color(0xfff7faff));
11751175
expect(getBackgroundColor(tester, 1), const Color(0xf8007aff));
@@ -1190,7 +1190,7 @@ void main() {
11901190
);
11911191
},
11921192
),
1193-
const Duration(milliseconds: 40),
1193+
duration: const Duration(milliseconds: 40),
11941194
);
11951195
expect(getBackgroundColor(tester, 0), isSameColorAs(CupertinoColors.white));
11961196
expect(getBackgroundColor(tester, 1), CupertinoColors.activeBlue);

packages/flutter/test/material/button_bar_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ void main() {
631631
testWidgets('_RenderButtonBarRow.constraints does not work before layout', (WidgetTester tester) async {
632632
await tester.pumpWidget(
633633
const MaterialApp(home: ButtonBar()),
634-
Duration.zero,
635-
EnginePhase.build,
634+
duration: Duration.zero,
635+
phase: EnginePhase.build,
636636
);
637637

638638
final Finder buttonBar = find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_ButtonBarRow');

packages/flutter/test/material/input_decorator_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6570,8 +6570,7 @@ testWidgets('OutlineInputBorder with BorderRadius.zero should draw a rectangular
65706570
),
65716571
),
65726572
),
6573-
null,
6574-
EnginePhase.layout,
6573+
phase: EnginePhase.layout,
65756574
);
65766575
} finally {
65776576
FlutterError.onError = oldHandler;

packages/flutter/test/material/scaffold_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@ void main() {
441441

442442
await tester.pumpWidget(
443443
buildFrame(const EdgeInsets.only(bottom: 400)),
444-
null,
445-
EnginePhase.build,
444+
phase: EnginePhase.build,
446445
);
447446

448447
expect(renderBox.debugNeedsLayout, true);

packages/flutter/test/material/tabs_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void main() {
306306
indicatorPadding: indicatorPadding + const EdgeInsets.all(7.0),
307307
),
308308
),
309-
), Duration.zero, EnginePhase.build);
309+
), duration: Duration.zero, phase: EnginePhase.build);
310310

311311
expect(tester.renderObject(find.byType(CustomPaint)).debugNeedsPaint, true);
312312
});

packages/flutter/test/rendering/non_normalized_constraints_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Foo extends SingleChildRenderObjectWidget {
3232

3333
void main() {
3434
testWidgets('Stack parsing in non-normalized constraints error', (WidgetTester tester) async {
35-
await tester.pumpWidget(const Foo(child: Placeholder()), Duration.zero, EnginePhase.layout);
35+
await tester.pumpWidget(const Foo(child: Placeholder()), duration: Duration.zero, phase: EnginePhase.layout);
3636
final Object? exception = tester.takeException();
3737
final String text = exception.toString();
3838
expect(text, contains('BoxConstraints has non-normalized width constraints.'));

packages/flutter/test/semantics/semantics_update_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ void main() {
1818
await tester.pumpWidget(
1919
const Placeholder(),
2020
// Stops right after the warm up frame.
21-
null,
22-
EnginePhase.build,
21+
phase: EnginePhase.build,
2322
);
2423
// The warm up frame will send update for an empty semantics tree. We
2524
// ignore this one time update.
@@ -91,8 +90,7 @@ void main() {
9190
await tester.pumpWidget(
9291
const Placeholder(),
9392
// Stops right after the warm up frame.
94-
null,
95-
EnginePhase.build,
93+
phase: EnginePhase.build,
9694
);
9795
// The warm up frame will send update for an empty semantics tree. We
9896
// ignore this one time update.

packages/flutter/test/widgets/animated_size_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void main() {
378378
),
379379
),
380380
),
381-
duration,
381+
duration: duration,
382382
);
383383
}
384384

packages/flutter/test/widgets/async_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void main() {
202202
await tester.pumpWidget(FutureBuilder<String>(
203203
future: completer.future,
204204
builder: snapshotText,
205-
), const Duration(seconds: 1));
205+
), duration: const Duration(seconds: 1));
206206
completer.completeError('bad');
207207
}, (Object error, StackTrace stack) {
208208
expectSync(error, equals('bad'));

packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ void main() {
12481248
),
12491249
],
12501250
),
1251-
), null, EnginePhase.build);
1251+
), phase: EnginePhase.build);
12521252
expect(tester.takeException(), isAssertionError);
12531253
});
12541254

0 commit comments

Comments
 (0)