Unverified Commit 80dd6a40 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add missing trailing commas (#81080)

parent 3df0f931
...@@ -155,10 +155,8 @@ void main() { ...@@ -155,10 +155,8 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
final DefaultTextStyle titleStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, final DefaultTextStyle titleStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, 'Action Sheet'));
'Action Sheet')); final DefaultTextStyle messageStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, 'An action sheet'));
final DefaultTextStyle messageStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle,
'An action sheet'));
expect(titleStyle.style.fontWeight, FontWeight.w600); expect(titleStyle.style.fontWeight, FontWeight.w600);
expect(messageStyle.style.fontWeight, FontWeight.w400); expect(messageStyle.style.fontWeight, FontWeight.w400);
...@@ -176,8 +174,7 @@ void main() { ...@@ -176,8 +174,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
final DefaultTextStyle titleStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, final DefaultTextStyle titleStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, 'Action Sheet'));
'Action Sheet'));
expect(titleStyle.style.fontWeight, FontWeight.w400); expect(titleStyle.style.fontWeight, FontWeight.w400);
}); });
...@@ -194,8 +191,7 @@ void main() { ...@@ -194,8 +191,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
final DefaultTextStyle messageStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, final DefaultTextStyle messageStyle = tester.firstWidget(find.widgetWithText(DefaultTextStyle, 'An action sheet'));
'An action sheet'));
expect(messageStyle.style.fontWeight, FontWeight.w600); expect(messageStyle.style.fontWeight, FontWeight.w600);
}); });
...@@ -219,8 +215,10 @@ void main() { ...@@ -219,8 +215,10 @@ void main() {
// Content section should be at the bottom left of action sheet // Content section should be at the bottom left of action sheet
// (minus padding). // (minus padding).
expect(tester.getBottomLeft(find.byType(ClipRRect)), expect(
tester.getBottomLeft(find.byType(CupertinoActionSheet)) - const Offset(-8.0, 10.0)); tester.getBottomLeft(find.byType(ClipRRect)),
tester.getBottomLeft(find.byType(CupertinoActionSheet)) - const Offset(-8.0, 10.0),
);
// Check that the dialog size is the same as the content section size // Check that the dialog size is the same as the content section size
// (minus padding). // (minus padding).
...@@ -268,13 +266,19 @@ void main() { ...@@ -268,13 +266,19 @@ void main() {
// Check that the title/message section is not displayed (action section is // Check that the title/message section is not displayed (action section is
// at the top of the action sheet + padding). // at the top of the action sheet + padding).
expect(tester.getTopLeft(finder), expect(
tester.getTopLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, 10.0)); tester.getTopLeft(finder),
tester.getTopLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, 10.0),
);
expect(tester.getTopLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, 10.0), expect(
tester.getTopLeft(find.widgetWithText(CupertinoActionSheetAction, 'One'))); tester.getTopLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, 10.0),
expect(tester.getBottomLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, -10.0), tester.getTopLeft(find.widgetWithText(CupertinoActionSheetAction, 'One')),
tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Two'))); );
expect(
tester.getBottomLeft(find.byType(CupertinoActionSheet)) + const Offset(8.0, -10.0),
tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Two')),
);
}); });
testWidgets('Action section is scrollable', (WidgetTester tester) async { testWidgets('Action section is scrollable', (WidgetTester tester) async {
...@@ -474,8 +478,7 @@ void main() { ...@@ -474,8 +478,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
expect(tester.getSize(find.byType(CupertinoActionSheet)).height, expect(tester.getSize(find.byType(CupertinoActionSheet)).height, moreOrLessEquals(132.33333333333334));
moreOrLessEquals(132.33333333333334));
}); });
testWidgets('1 action button with cancel button', (WidgetTester tester) async { testWidgets('1 action button with cancel button', (WidgetTester tester) async {
...@@ -532,8 +535,7 @@ void main() { ...@@ -532,8 +535,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
expect(findScrollableActionsSectionRenderBox(tester).size.height, expect(findScrollableActionsSectionRenderBox(tester).size.height, moreOrLessEquals(112.33333333333331));
moreOrLessEquals(112.33333333333331));
}); });
testWidgets('3 action buttons with cancel button', (WidgetTester tester) async { testWidgets('3 action buttons with cancel button', (WidgetTester tester) async {
...@@ -567,8 +569,7 @@ void main() { ...@@ -567,8 +569,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
expect(findScrollableActionsSectionRenderBox(tester).size.height, expect(findScrollableActionsSectionRenderBox(tester).size.height, moreOrLessEquals(168.66666666666669));
moreOrLessEquals(168.66666666666669));
}); });
testWidgets('4+ action buttons with cancel button', (WidgetTester tester) async { testWidgets('4+ action buttons with cancel button', (WidgetTester tester) async {
...@@ -606,8 +607,7 @@ void main() { ...@@ -606,8 +607,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
expect(findScrollableActionsSectionRenderBox(tester).size.height, expect(findScrollableActionsSectionRenderBox(tester).size.height, moreOrLessEquals(84.33333333333337));
moreOrLessEquals(84.33333333333337));
}); });
testWidgets('1 action button without cancel button', (WidgetTester tester) async { testWidgets('1 action button without cancel button', (WidgetTester tester) async {
...@@ -655,8 +655,7 @@ void main() { ...@@ -655,8 +655,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
await tester.pump(); await tester.pump();
expect(findScrollableActionsSectionRenderBox(tester).size.height, expect(findScrollableActionsSectionRenderBox(tester).size.height, moreOrLessEquals(84.33333333333337));
moreOrLessEquals(84.33333333333337));
}); });
testWidgets('Action sheet with just cancel button is correct', (WidgetTester tester) async { testWidgets('Action sheet with just cancel button is correct', (WidgetTester tester) async {
...@@ -744,8 +743,10 @@ void main() { ...@@ -744,8 +743,10 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Cancel')).dy, 590.0); expect(tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Cancel')).dy, 590.0);
expect(tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'One')).dy, expect(
moreOrLessEquals(469.66666666666663)); tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'One')).dy,
moreOrLessEquals(469.66666666666663),
);
expect(tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Two')).dy, 526.0); expect(tester.getBottomLeft(find.widgetWithText(CupertinoActionSheetAction, 'Two')).dy, 526.0);
}); });
...@@ -978,7 +979,7 @@ void main() { ...@@ -978,7 +979,7 @@ void main() {
), ),
], ],
), ),
] ],
), ),
], ],
), ),
...@@ -995,8 +996,8 @@ void main() { ...@@ -995,8 +996,8 @@ void main() {
} }
RenderBox findScrollableActionsSectionRenderBox(WidgetTester tester) { RenderBox findScrollableActionsSectionRenderBox(WidgetTester tester) {
final RenderObject actionsSection = tester.renderObject(find.byElementPredicate( final RenderObject actionsSection = tester.renderObject(
(Element element) { find.byElementPredicate((Element element) {
return element.widget.runtimeType.toString() == '_CupertinoAlertActionSection'; return element.widget.runtimeType.toString() == '_CupertinoAlertActionSection';
}), }),
); );
......
...@@ -9,8 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -9,8 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Activity indicator animate property works', testWidgets('Activity indicator animate property works', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget(buildCupertinoActivityIndicator()); await tester.pumpWidget(buildCupertinoActivityIndicator());
expect(SchedulerBinding.instance!.transientCallbackCount, equals(1)); expect(SchedulerBinding.instance!.transientCallbackCount, equals(1));
...@@ -96,8 +95,7 @@ void main() { ...@@ -96,8 +95,7 @@ void main() {
); );
}); });
testWidgets('Activity indicator 30% in progress', testWidgets('Activity indicator 30% in progress', (WidgetTester tester) async {
(WidgetTester tester) async {
final Key key = UniqueKey(); final Key key = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
...@@ -119,8 +117,7 @@ void main() { ...@@ -119,8 +117,7 @@ void main() {
); );
}); });
testWidgets('Activity indicator 100% in progress', testWidgets('Activity indicator 100% in progress', (WidgetTester tester) async {
(WidgetTester tester) async {
final Key key = UniqueKey(); final Key key = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
......
...@@ -10,9 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -10,9 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Heroes work', (WidgetTester tester) async { testWidgets('Heroes work', (WidgetTester tester) async {
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(CupertinoApp(
home: home: ListView(children: <Widget>[
ListView(
children: <Widget>[
const Hero(tag: 'a', child: Text('foo')), const Hero(tag: 'a', child: Text('foo')),
Builder(builder: (BuildContext context) { Builder(builder: (BuildContext context) {
return CupertinoButton( return CupertinoButton(
...@@ -20,17 +18,14 @@ void main() { ...@@ -20,17 +18,14 @@ void main() {
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
CupertinoPageRoute<void>( CupertinoPageRoute<void>(builder: (BuildContext context) {
builder: (BuildContext context) {
return const Hero(tag: 'a', child: Text('foo')); return const Hero(tag: 'a', child: Text('foo'));
} }),
),
); );
}, },
); );
}), }),
], ]),
),
)); ));
await tester.tap(find.text('next')); await tester.tap(find.text('next'));
...@@ -99,17 +94,19 @@ void main() { ...@@ -99,17 +94,19 @@ void main() {
pageBuilder: ( pageBuilder: (
BuildContext context, BuildContext context,
Animation<double> animation, Animation<double> animation,
Animation<double> secondaryAnimation) { Animation<double> secondaryAnimation,
) {
return const Text('non-regular page one'); return const Text('non-regular page one');
} },
), ),
PageRouteBuilder<void>( PageRouteBuilder<void>(
pageBuilder: ( pageBuilder: (
BuildContext context, BuildContext context,
Animation<double> animation, Animation<double> animation,
Animation<double> secondaryAnimation) { Animation<double> secondaryAnimation,
) {
return const Text('non-regular page two'); return const Text('non-regular page two');
} },
), ),
]; ];
}, },
...@@ -118,7 +115,7 @@ void main() { ...@@ -118,7 +115,7 @@ void main() {
'/': (BuildContext context) => const Text('regular page one'), '/': (BuildContext context) => const Text('regular page one'),
'/abc': (BuildContext context) => const Text('regular page two'), '/abc': (BuildContext context) => const Text('regular page two'),
}, },
) ),
); );
expect(find.text('non-regular page two'), findsOneWidget); expect(find.text('non-regular page two'), findsOneWidget);
expect(find.text('non-regular page one'), findsNothing); expect(find.text('non-regular page one'), findsNothing);
...@@ -163,7 +160,7 @@ void main() { ...@@ -163,7 +160,7 @@ void main() {
location: 'popped', location: 'popped',
); );
return route.didPop(result); return route.didPop(result);
} },
); );
await tester.pumpWidget(CupertinoApp.router( await tester.pumpWidget(CupertinoApp.router(
routeInformationProvider: provider, routeInformationProvider: provider,
...@@ -280,7 +277,7 @@ class SimpleNavigatorRouterDelegate extends RouterDelegate<RouteInformation> wit ...@@ -280,7 +277,7 @@ class SimpleNavigatorRouterDelegate extends RouterDelegate<RouteInformation> wit
CupertinoPage<void>( CupertinoPage<void>(
key: ValueKey<String?>(routeInformation.location), key: ValueKey<String?>(routeInformation.location),
child: builder(context, routeInformation), child: builder(context, routeInformation),
) ),
], ],
); );
} }
......
...@@ -452,12 +452,14 @@ Future<void> main() async { ...@@ -452,12 +452,14 @@ Future<void> main() async {
], ],
onTap: (int index) => itemsTapped.add(index), onTap: (int index) => itemsTapped.add(index),
), ),
)); ),
);
expect(find.text('Tab 1'), findsOneWidget); expect(find.text('Tab 1'), findsOneWidget);
final Finder finder = find.byWidgetPredicate( final Finder finder = find.byWidgetPredicate(
(Widget widget) => widget is Image && widget.image == iconProvider); (Widget widget) => widget is Image && widget.image == iconProvider,
);
await tester.tap(finder); await tester.tap(finder);
expect(itemsTapped, <int>[1]); expect(itemsTapped, <int>[1]);
...@@ -484,7 +486,8 @@ Future<void> main() async { ...@@ -484,7 +486,8 @@ Future<void> main() async {
), ),
], ],
), ),
)); ),
);
final DecoratedBox decoratedBox = tester.widget(find.byType(DecoratedBox)); final DecoratedBox decoratedBox = tester.widget(find.byType(DecoratedBox));
final BoxDecoration boxDecoration = decoratedBox.decoration as BoxDecoration; final BoxDecoration boxDecoration = decoratedBox.decoration as BoxDecoration;
...@@ -512,7 +515,8 @@ Future<void> main() async { ...@@ -512,7 +515,8 @@ Future<void> main() async {
backgroundColor: const Color(0xFFFFFFFF), // Opaque white. backgroundColor: const Color(0xFFFFFFFF), // Opaque white.
border: null, border: null,
), ),
)); ),
);
final DecoratedBox decoratedBoxHiddenBorder = final DecoratedBox decoratedBoxHiddenBorder =
tester.widget(find.byType(DecoratedBox)); tester.widget(find.byType(DecoratedBox));
......
...@@ -274,7 +274,7 @@ void main() { ...@@ -274,7 +274,7 @@ void main() {
))); )));
BoxDecoration boxDecoration = tester.widget<DecoratedBox>( BoxDecoration boxDecoration = tester.widget<DecoratedBox>(
find.widgetWithText(DecoratedBox, 'Skeuomorph me') find.widgetWithText(DecoratedBox, 'Skeuomorph me'),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
expect(boxDecoration.color, const Color(0x000000FF)); expect(boxDecoration.color, const Color(0x000000FF));
...@@ -287,7 +287,7 @@ void main() { ...@@ -287,7 +287,7 @@ void main() {
))); )));
boxDecoration = tester.widget<DecoratedBox>( boxDecoration = tester.widget<DecoratedBox>(
find.widgetWithText(DecoratedBox, 'Skeuomorph me') find.widgetWithText(DecoratedBox, 'Skeuomorph me'),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
expect(boxDecoration.color, const Color(0x0000FF00)); expect(boxDecoration.color, const Color(0x0000FF00));
...@@ -317,7 +317,7 @@ void main() { ...@@ -317,7 +317,7 @@ void main() {
); );
BoxDecoration boxDecoration = tester.widget<DecoratedBox>( BoxDecoration boxDecoration = tester.widget<DecoratedBox>(
find.widgetWithText(DecoratedBox, 'Skeuomorph me') find.widgetWithText(DecoratedBox, 'Skeuomorph me'),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
expect(boxDecoration.color!.value, 0xFF654321); expect(boxDecoration.color!.value, 0xFF654321);
...@@ -335,7 +335,7 @@ void main() { ...@@ -335,7 +335,7 @@ void main() {
); );
boxDecoration = tester.widget<DecoratedBox>( boxDecoration = tester.widget<DecoratedBox>(
find.widgetWithText(DecoratedBox, 'Skeuomorph me') find.widgetWithText(DecoratedBox, 'Skeuomorph me'),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
// Disabled color. // Disabled color.
......
...@@ -202,13 +202,15 @@ void main() { ...@@ -202,13 +202,15 @@ void main() {
); );
}); });
testWidgets('Dynamic colors that are not actually dynamic should not claim dependencies', testWidgets(
'Dynamic colors that are not actually dynamic should not claim dependencies',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(const DependentWidget(color: notSoDynamicColor1)); await tester.pumpWidget(const DependentWidget(color: notSoDynamicColor1));
expect(tester.takeException(), null); expect(tester.takeException(), null);
expect(find.byType(DependentWidget), paints..rect(color: color0)); expect(find.byType(DependentWidget), paints..rect(color: color0));
}); },
);
testWidgets( testWidgets(
'Dynamic colors that are only dependent on vibrancy should not claim unnecessary dependencies, ' 'Dynamic colors that are only dependent on vibrancy should not claim unnecessary dependencies, '
...@@ -251,7 +253,8 @@ void main() { ...@@ -251,7 +253,8 @@ void main() {
expect(tester.takeException(), null); expect(tester.takeException(), null);
expect(find.byType(DependentWidget), paints..rect(color: color1)); expect(find.byType(DependentWidget), paints..rect(color: color1));
expect(find.byType(DependentWidget), isNot(paints..rect(color: color0))); expect(find.byType(DependentWidget), isNot(paints..rect(color: color0)));
}); },
);
testWidgets( testWidgets(
'Dynamic colors that are only dependent on accessibility contrast should not claim unnecessary dependencies, ' 'Dynamic colors that are only dependent on accessibility contrast should not claim unnecessary dependencies, '
...@@ -279,7 +282,8 @@ void main() { ...@@ -279,7 +282,8 @@ void main() {
expect(tester.takeException(), null); expect(tester.takeException(), null);
expect(find.byType(DependentWidget), paints..rect(color: color0)); expect(find.byType(DependentWidget), paints..rect(color: color0));
expect(find.byType(DependentWidget), isNot(paints..rect(color: color1))); expect(find.byType(DependentWidget), isNot(paints..rect(color: color1)));
}); },
);
testWidgets( testWidgets(
'Dynamic colors that are only dependent on elevation level should not claim unnecessary dependencies, ' 'Dynamic colors that are only dependent on elevation level should not claim unnecessary dependencies, '
...@@ -307,7 +311,8 @@ void main() { ...@@ -307,7 +311,8 @@ void main() {
expect(tester.takeException(), null); expect(tester.takeException(), null);
expect(find.byType(DependentWidget), paints..rect(color: color0)); expect(find.byType(DependentWidget), paints..rect(color: color0));
expect(find.byType(DependentWidget), isNot(paints..rect(color: color1))); expect(find.byType(DependentWidget), isNot(paints..rect(color: color1)));
}); },
);
testWidgets('Dynamic color with all 3 dependencies works', (WidgetTester tester) async { testWidgets('Dynamic color with all 3 dependencies works', (WidgetTester tester) async {
const Color dynamicRainbowColor1 = CupertinoDynamicColor( const Color dynamicRainbowColor1 = CupertinoDynamicColor(
...@@ -422,7 +427,7 @@ void main() { ...@@ -422,7 +427,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor; color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
); );
...@@ -440,7 +445,7 @@ void main() { ...@@ -440,7 +445,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor; color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
); );
...@@ -459,7 +464,7 @@ void main() { ...@@ -459,7 +464,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor; color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
...@@ -481,7 +486,7 @@ void main() { ...@@ -481,7 +486,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor; color = CupertinoTheme.of(context).primaryColor as CupertinoDynamicColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
...@@ -514,7 +519,7 @@ void main() { ...@@ -514,7 +519,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor; color = CupertinoTheme.of(context).primaryColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
...@@ -542,7 +547,7 @@ void main() { ...@@ -542,7 +547,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor; color = CupertinoTheme.of(context).primaryColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
...@@ -565,7 +570,7 @@ void main() { ...@@ -565,7 +570,7 @@ void main() {
builder: (BuildContext context) { builder: (BuildContext context) {
color = CupertinoTheme.of(context).primaryColor; color = CupertinoTheme.of(context).primaryColor;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
......
...@@ -211,9 +211,7 @@ void main() { ...@@ -211,9 +211,7 @@ void main() {
); );
// Distance between the first column and the last column. // Distance between the first column and the last column.
final double distance = tester.getCenter( final double distance = tester.getCenter(find.text('sec.')).dx - tester.getCenter(find.text('12')).dx;
find.text('sec.')).dx - tester.getCenter(find.text('12'),
).dx;
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
...@@ -693,7 +691,8 @@ void main() { ...@@ -693,7 +691,8 @@ void main() {
tester.widget<Text>(find.text('29')).style!.color, tester.widget<Text>(find.text('29')).style!.color,
isSameColorAs(CupertinoColors.inactiveGray.color), isSameColorAs(CupertinoColors.inactiveGray.color),
); );
}); },
);
testWidgets( testWidgets(
'dateTime picker automatically scrolls away from invalid date, ' 'dateTime picker automatically scrolls away from invalid date, '
...@@ -770,7 +769,8 @@ void main() { ...@@ -770,7 +769,8 @@ void main() {
date, date,
DateTime(2019, 11, 11, 3, 30), DateTime(2019, 11, 11, 3, 30),
); );
}); },
);
testWidgets( testWidgets(
'time picker automatically scrolls away from invalid date, ' 'time picker automatically scrolls away from invalid date, '
...@@ -847,7 +847,8 @@ void main() { ...@@ -847,7 +847,8 @@ void main() {
date, date,
DateTime(2019, 11, 11, 3, 30), DateTime(2019, 11, 11, 3, 30),
); );
}); },
);
testWidgets('picker automatically scrolls away from invalid date on day change', (WidgetTester tester) async { testWidgets('picker automatically scrolls away from invalid date on day change', (WidgetTester tester) async {
late DateTime date; late DateTime date;
...@@ -933,7 +934,8 @@ void main() { ...@@ -933,7 +934,8 @@ void main() {
expect(date.year, minDate.year); expect(date.year, minDate.year);
expect(date.month, minDate.month); expect(date.month, minDate.month);
expect(date.day, minDate.day); expect(date.day, minDate.day);
}); },
);
testWidgets('date picker does not display previous day of minimumDate if it is set at midnight', (WidgetTester tester) async { testWidgets('date picker does not display previous day of minimumDate if it is set at midnight', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/72932 // Regression test for https://github.com/flutter/flutter/issues/72932
......
...@@ -207,8 +207,8 @@ void main() { ...@@ -207,8 +207,8 @@ void main() {
), ),
], ],
), ),
] ],
) ),
], ],
), ),
], ],
...@@ -290,8 +290,8 @@ void main() { ...@@ -290,8 +290,8 @@ void main() {
scrollController: scrollController, scrollController: scrollController,
), ),
); );
} },
) ),
); );
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
...@@ -307,9 +307,7 @@ void main() { ...@@ -307,9 +307,7 @@ void main() {
// Expect the modal dialog box to take all available height. // Expect the modal dialog box to take all available height.
expect( expect(
tester.getSize( tester.getSize(find.byType(ClipRRect)),
find.byType(ClipRRect)
),
equals(const Size(310.0, 560.0 - 24.0 * 2)), equals(const Size(310.0, 560.0 - 24.0 * 2)),
); );
...@@ -399,8 +397,8 @@ void main() { ...@@ -399,8 +397,8 @@ void main() {
actionScrollController: actionScrollController, actionScrollController: actionScrollController,
), ),
); );
} },
) ),
); );
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
...@@ -448,7 +446,7 @@ void main() { ...@@ -448,7 +446,7 @@ void main() {
actionScrollController: actionScrollController, actionScrollController: actionScrollController,
), ),
); );
} },
), ),
); );
...@@ -475,8 +473,10 @@ void main() { ...@@ -475,8 +473,10 @@ void main() {
expect(tester.getTopLeft(find.widgetWithText(CupertinoDialogAction, 'One')).dy, equals(277.5)); expect(tester.getTopLeft(find.widgetWithText(CupertinoDialogAction, 'One')).dy, equals(277.5));
// Check that the button's vertical size is the same. // Check that the button's vertical size is the same.
expect(tester.getSize(find.widgetWithText(CupertinoDialogAction, 'One')).height, expect(
equals(tester.getSize(find.widgetWithText(CupertinoDialogAction, 'Two')).height)); tester.getSize(find.widgetWithText(CupertinoDialogAction, 'One')).height,
equals(tester.getSize(find.widgetWithText(CupertinoDialogAction, 'Two')).height),
);
}); });
testWidgets('Button section is empty, Title section is not empty.', (WidgetTester tester) async { testWidgets('Button section is empty, Title section is not empty.', (WidgetTester tester) async {
...@@ -1162,7 +1162,7 @@ void main() { ...@@ -1162,7 +1162,7 @@ void main() {
), ),
), ),
); );
} },
), ),
); );
...@@ -1252,17 +1252,15 @@ RenderBox findActionButtonRenderBoxByTitle(WidgetTester tester, String title) { ...@@ -1252,17 +1252,15 @@ RenderBox findActionButtonRenderBoxByTitle(WidgetTester tester, String title) {
} }
RenderBox findScrollableActionsSectionRenderBox(WidgetTester tester) { RenderBox findScrollableActionsSectionRenderBox(WidgetTester tester) {
final RenderObject actionsSection = tester.renderObject(find.byElementPredicate( final RenderObject actionsSection = tester.renderObject(find.byElementPredicate((Element element) {
(Element element) {
return element.widget.runtimeType.toString() == '_CupertinoAlertActionSection'; return element.widget.runtimeType.toString() == '_CupertinoAlertActionSection';
}), }));
);
assert(actionsSection is RenderBox); assert(actionsSection is RenderBox);
return actionsSection as RenderBox; return actionsSection as RenderBox;
} }
Widget createAppWithButtonThatLaunchesDialog({ Widget createAppWithButtonThatLaunchesDialog({
required WidgetBuilder dialogBuilder required WidgetBuilder dialogBuilder,
}) { }) {
return MaterialApp( return MaterialApp(
home: Material( home: Material(
...@@ -1296,10 +1294,10 @@ Widget createAppWithCenteredButton(Widget child) { ...@@ -1296,10 +1294,10 @@ Widget createAppWithCenteredButton(Widget child) {
child: Center( child: Center(
child: ElevatedButton( child: ElevatedButton(
onPressed: null, onPressed: null,
child: child child: child,
),
),
), ),
)
)
); );
} }
......
...@@ -57,10 +57,7 @@ void main() { ...@@ -57,10 +57,7 @@ void main() {
), ),
); );
expect( expect(tester.getTopLeft(find.byType(Text)).dx > tester.getTopLeft(find.byType(CupertinoTextField)).dx, true);
tester.getTopLeft(find.byType(Text)).dx >
tester.getTopLeft(find.byType(CupertinoTextField)).dx,
true);
}); });
testWidgets('LTR puts child after prefix', (WidgetTester tester) async { testWidgets('LTR puts child after prefix', (WidgetTester tester) async {
...@@ -81,10 +78,7 @@ void main() { ...@@ -81,10 +78,7 @@ void main() {
), ),
); );
expect( expect(tester.getTopLeft(find.byType(Text)).dx > tester.getTopLeft(find.byType(CupertinoTextField)).dx, false);
tester.getTopLeft(find.byType(Text)).dx >
tester.getTopLeft(find.byType(CupertinoTextField)).dx,
false);
}); });
testWidgets('Shows error widget', (WidgetTester tester) async { testWidgets('Shows error widget', (WidgetTester tester) async {
...@@ -121,8 +115,7 @@ void main() { ...@@ -121,8 +115,7 @@ void main() {
expect(helper, tester.widget(find.byType(Text))); expect(helper, tester.widget(find.byType(Text)));
}); });
testWidgets('Shows helper text above error text', testWidgets('Shows helper text above error text', (WidgetTester tester) async {
(WidgetTester tester) async {
const Widget helper = Text('Helper'); const Widget helper = Text('Helper');
const Widget error = CupertinoActivityIndicator(); const Widget error = CupertinoActivityIndicator();
...@@ -139,13 +132,12 @@ void main() { ...@@ -139,13 +132,12 @@ void main() {
); );
expect( expect(
tester.getTopLeft(find.byType(CupertinoActivityIndicator)).dy > tester.getTopLeft(find.byType(CupertinoActivityIndicator)).dy > tester.getTopLeft(find.byType(Text)).dy,
tester.getTopLeft(find.byType(Text)).dy, true,
true); );
}); });
testWidgets('Shows helper in label color and error text in red color', testWidgets('Shows helper in label color and error text in red color', (WidgetTester tester) async {
(WidgetTester tester) async {
const Widget helper = Text('Helper'); const Widget helper = Text('Helper');
const Widget error = Text('Error'); const Widget error = Text('Error');
......
...@@ -36,8 +36,7 @@ void main() { ...@@ -36,8 +36,7 @@ void main() {
expect(find.text('Footer'), findsOneWidget); expect(find.text('Footer'), findsOneWidget);
}); });
testWidgets('Shows long dividers in edge-to-edge section part 1', testWidgets('Shows long dividers in edge-to-edge section part 1', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -54,15 +53,14 @@ void main() { ...@@ -54,15 +53,14 @@ void main() {
expect(childrenColumn.children.length, 3); expect(childrenColumn.children.length, 3);
}); });
testWidgets('Shows long dividers in edge-to-edge section part 2', testWidgets('Shows long dividers in edge-to-edge section part 2', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
child: CupertinoFormSection( child: CupertinoFormSection(
children: <Widget>[ children: <Widget>[
CupertinoTextFormFieldRow(), CupertinoTextFormFieldRow(),
CupertinoTextFormFieldRow() CupertinoTextFormFieldRow(),
], ],
), ),
), ),
...@@ -76,8 +74,7 @@ void main() { ...@@ -76,8 +74,7 @@ void main() {
expect(childrenColumn.children.length, 5); expect(childrenColumn.children.length, 5);
}); });
testWidgets('Does not show long dividers in insetGrouped section part 1', testWidgets('Does not show long dividers in insetGrouped section part 1', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -95,8 +92,7 @@ void main() { ...@@ -95,8 +92,7 @@ void main() {
expect(childrenColumn.children.length, 1); expect(childrenColumn.children.length, 1);
}); });
testWidgets('Does not show long dividers in insetGrouped section part 2', testWidgets('Does not show long dividers in insetGrouped section part 2', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
restorationScopeId: 'App', restorationScopeId: 'App',
...@@ -104,7 +100,7 @@ void main() { ...@@ -104,7 +100,7 @@ void main() {
child: CupertinoFormSection.insetGrouped( child: CupertinoFormSection.insetGrouped(
children: <Widget>[ children: <Widget>[
CupertinoTextFormFieldRow(), CupertinoTextFormFieldRow(),
CupertinoTextFormFieldRow() CupertinoTextFormFieldRow(),
], ],
), ),
), ),
...@@ -141,8 +137,7 @@ void main() { ...@@ -141,8 +137,7 @@ void main() {
expect(boxDecoration.color, backgroundColor); expect(boxDecoration.color, backgroundColor);
}); });
testWidgets('Setting clipBehavior clips children section', testWidgets('Setting clipBehavior clips children section', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -157,8 +152,7 @@ void main() { ...@@ -157,8 +152,7 @@ void main() {
expect(find.byType(ClipRRect), findsOneWidget); expect(find.byType(ClipRRect), findsOneWidget);
}); });
testWidgets('Not setting clipBehavior does not clip children section', testWidgets('Not setting clipBehavior does not clip children section', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
IconTheme(data: data, child: Builder(builder: (BuildContext context) { IconTheme(data: data, child: Builder(builder: (BuildContext context) {
retrieved = IconTheme.of(context); retrieved = IconTheme.of(context);
return const SizedBox(); return const SizedBox();
})) })),
); );
expect(retrieved, data); expect(retrieved, data);
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
retrieved = IconTheme.of(context); retrieved = IconTheme.of(context);
return const SizedBox(); return const SizedBox();
}, },
) ),
), ),
), ),
); );
......
...@@ -200,7 +200,7 @@ void main() { ...@@ -200,7 +200,7 @@ void main() {
find.descendant( find.descendant(
of: find.byType(CupertinoTabScaffold), of: find.byType(CupertinoTabScaffold),
matching: find.byType(DecoratedBox), matching: find.byType(DecoratedBox),
) ),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
expect(tabDecoration.color!.value, backgroundColor.color.value); expect(tabDecoration.color!.value, backgroundColor.color.value);
...@@ -223,7 +223,7 @@ void main() { ...@@ -223,7 +223,7 @@ void main() {
find.descendant( find.descendant(
of: find.byType(CupertinoTabScaffold), of: find.byType(CupertinoTabScaffold),
matching: find.byType(DecoratedBox), matching: find.byType(DecoratedBox),
) ),
).decoration as BoxDecoration; ).decoration as BoxDecoration;
expect(tabDecoration.color!.value, backgroundColor.darkColor.value); expect(tabDecoration.color!.value, backgroundColor.darkColor.value);
......
...@@ -111,7 +111,7 @@ void main() { ...@@ -111,7 +111,7 @@ void main() {
return const CupertinoNavigationBar( return const CupertinoNavigationBar(
middle: Text('Page 2'), middle: Text('Page 2'),
); );
} },
)); ));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoNavigationBarBackButton), findsOneWidget); expect(find.byType(CupertinoNavigationBarBackButton), findsOneWidget);
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
largeTitle: Text('Title'), largeTitle: Text('Title'),
backgroundColor: Color(0xF0F9F9F9), backgroundColor: Color(0xF0F9F9F9),
brightness: Brightness.dark, brightness: Brightness.dark,
) ),
], ],
), ),
), ),
...@@ -225,7 +225,7 @@ void main() { ...@@ -225,7 +225,7 @@ void main() {
largeTitle: Text('Title'), largeTitle: Text('Title'),
backgroundColor: Color(0xF01D1D1D), backgroundColor: Color(0xF01D1D1D),
brightness: Brightness.light, brightness: Brightness.light,
) ),
], ],
), ),
), ),
...@@ -524,9 +524,7 @@ void main() { ...@@ -524,9 +524,7 @@ void main() {
expect(tester.getCenter(find.byKey(segmentedControlsKey)).dx, 400.0); expect(tester.getCenter(find.byKey(segmentedControlsKey)).dx, 400.0);
// The large title is invisible now. // The large title is invisible now.
expect( expect(
tester.renderObject<RenderAnimatedOpacity>( tester.renderObject<RenderAnimatedOpacity>(find.widgetWithText(AnimatedOpacity, 'Title')).opacity.value,
find.widgetWithText(AnimatedOpacity, 'Title')
).opacity.value,
0.0, 0.0,
); );
}); });
...@@ -666,8 +664,8 @@ void main() { ...@@ -666,8 +664,8 @@ void main() {
), ),
child: Placeholder(), child: Placeholder(),
); );
} },
) ),
); );
await tester.pump(); await tester.pump();
...@@ -684,8 +682,8 @@ void main() { ...@@ -684,8 +682,8 @@ void main() {
), ),
child: Placeholder(), child: Placeholder(),
); );
} },
) ),
); );
await tester.pump(); await tester.pump();
...@@ -997,9 +995,7 @@ void main() { ...@@ -997,9 +995,7 @@ void main() {
}); });
testWidgets('CupertinoNavigationBarBackButton shows an error when manually added outside a route', (WidgetTester tester) async { testWidgets('CupertinoNavigationBarBackButton shows an error when manually added outside a route', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(const CupertinoNavigationBarBackButton());
const CupertinoNavigationBarBackButton()
);
final dynamic exception = tester.takeException(); final dynamic exception = tester.takeException();
expect(exception, isAssertionError); expect(exception, isAssertionError);
...@@ -1254,7 +1250,7 @@ void main() { ...@@ -1254,7 +1250,7 @@ void main() {
expect( expect(
stretchedTrailingTextToLargeTitleOffset.dy.abs(), stretchedTrailingTextToLargeTitleOffset.dy.abs(),
greaterThan(initialTrailingTextToLargeTitleOffset.dy.abs()) greaterThan(initialTrailingTextToLargeTitleOffset.dy.abs()),
); );
// Ensure overscroll retracts to original size after releasing gesture // Ensure overscroll retracts to original size after releasing gesture
...@@ -1266,7 +1262,8 @@ void main() { ...@@ -1266,7 +1262,8 @@ void main() {
finalTrailingTextToLargeTitleOffset.dy.abs(), finalTrailingTextToLargeTitleOffset.dy.abs(),
initialTrailingTextToLargeTitleOffset.dy.abs(), initialTrailingTextToLargeTitleOffset.dy.abs(),
); );
}); },
);
testWidgets( testWidgets(
'CupertinoSliverNavigationBar does not stretch upon over-scroll if stretch parameter is false', 'CupertinoSliverNavigationBar does not stretch upon over-scroll if stretch parameter is false',
...@@ -1320,7 +1317,8 @@ void main() { ...@@ -1320,7 +1317,8 @@ void main() {
finalTrailingTextToLargeTitleOffset.dy.abs(), finalTrailingTextToLargeTitleOffset.dy.abs(),
initialTrailingTextToLargeTitleOffset.dy.abs(), initialTrailingTextToLargeTitleOffset.dy.abs(),
); );
}); },
);
testWidgets('Null NavigationBar border transition', (WidgetTester tester) async { testWidgets('Null NavigationBar border transition', (WidgetTester tester) async {
// This is a regression test for https://github.com/flutter/flutter/issues/71389 // This is a regression test for https://github.com/flutter/flutter/issues/71389
...@@ -1366,7 +1364,7 @@ void main() { ...@@ -1366,7 +1364,7 @@ void main() {
class _ExpectStyles extends StatelessWidget { class _ExpectStyles extends StatelessWidget {
const _ExpectStyles({ const _ExpectStyles({
required this.color, required this.color,
required this.index required this.index,
}); });
final Color color; final Color color;
......
...@@ -179,8 +179,7 @@ void main() { ...@@ -179,8 +179,7 @@ void main() {
expect(bottomMiddle.text.style!.fontFamily, '.SF Pro Text'); expect(bottomMiddle.text.style!.fontFamily, '.SF Pro Text');
expect(bottomMiddle.text.style!.letterSpacing, -0.41); expect(bottomMiddle.text.style!.letterSpacing, -0.41);
checkOpacity( checkOpacity(tester, flying(tester, find.text('Page 1')).first, 0.9004602432250977);
tester, flying(tester, find.text('Page 1')).first, 0.9004602432250977);
// The top back label is styled exactly the same way. But the opacity tweens // The top back label is styled exactly the same way. But the opacity tweens
// are flipped. // are flipped.
...@@ -207,8 +206,7 @@ void main() { ...@@ -207,8 +206,7 @@ void main() {
expect(topBackLabel.text.style!.fontFamily, '.SF Pro Text'); expect(topBackLabel.text.style!.fontFamily, '.SF Pro Text');
expect(topBackLabel.text.style!.letterSpacing, -0.41); expect(topBackLabel.text.style!.letterSpacing, -0.41);
checkOpacity( checkOpacity(tester, flying(tester, find.text('Page 1')).last, 0.7630139589309692);
tester, flying(tester, find.text('Page 1')).last, 0.7630139589309692);
}); });
testWidgets('Font transitions respect themes', (WidgetTester tester) async { testWidgets('Font transitions respect themes', (WidgetTester tester) async {
...@@ -589,8 +587,7 @@ void main() { ...@@ -589,8 +587,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
final Finder backChevron = flying(tester, final Finder backChevron = flying(tester, find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
expect( expect(
backChevron, backChevron,
...@@ -599,13 +596,11 @@ void main() { ...@@ -599,13 +596,11 @@ void main() {
); );
// Come in from the right and fade in. // Come in from the right and fade in.
checkOpacity(tester, backChevron, 0.0); checkOpacity(tester, backChevron, 0.0);
expect( expect(tester.getTopLeft(backChevron), const Offset(86.734375, 7.0));
tester.getTopLeft(backChevron), const Offset(86.734375, 7.0));
await tester.pump(const Duration(milliseconds: 150)); await tester.pump(const Duration(milliseconds: 150));
checkOpacity(tester, backChevron, 0.09497911669313908); checkOpacity(tester, backChevron, 0.09497911669313908);
expect( expect(tester.getTopLeft(backChevron), const Offset(31.055883467197418, 7.0));
tester.getTopLeft(backChevron), const Offset(31.055883467197418, 7.0));
}); });
testWidgets('First appearance of back chevron fades in from the left in RTL', (WidgetTester tester) async { testWidgets('First appearance of back chevron fades in from the left in RTL', (WidgetTester tester) async {
...@@ -631,8 +626,7 @@ void main() { ...@@ -631,8 +626,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
final Finder backChevron = flying(tester, final Finder backChevron = flying(tester, find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
expect( expect(
backChevron, backChevron,
...@@ -660,8 +654,7 @@ void main() { ...@@ -660,8 +654,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
final Finder backChevrons = flying(tester, final Finder backChevrons = flying(tester, find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
find.text(String.fromCharCode(CupertinoIcons.back.codePoint)));
expect( expect(
backChevrons, backChevrons,
...@@ -887,13 +880,11 @@ void main() { ...@@ -887,13 +880,11 @@ void main() {
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect( expect(flying(tester, find.text('A title too long to fit')), findsOneWidget);
flying(tester, find.text('A title too long to fit')), findsOneWidget);
// Automatically changed to the word 'Back' in the back label. // Automatically changed to the word 'Back' in the back label.
expect(flying(tester, find.text('Back')), findsOneWidget); expect(flying(tester, find.text('Back')), findsOneWidget);
checkOpacity(tester, flying(tester, find.text('A title too long to fit')), checkOpacity(tester, flying(tester, find.text('A title too long to fit')), 0.8833301812410355);
0.8833301812410355);
checkOpacity(tester, flying(tester, find.text('Back')), 0.0); checkOpacity(tester, flying(tester, find.text('Back')), 0.0);
expect( expect(
tester.getTopLeft(flying(tester, find.text('A title too long to fit'))), tester.getTopLeft(flying(tester, find.text('A title too long to fit'))),
......
...@@ -161,8 +161,7 @@ void main() { ...@@ -161,8 +161,7 @@ void main() {
itemExtent: 15.0, itemExtent: 15.0,
children: const <Widget>[Text('1'), Text('1')], children: const <Widget>[Text('1'), Text('1')],
onSelectedItemChanged: (int i) {}, onSelectedItemChanged: (int i) {},
selectionOverlay: const CupertinoPickerDefaultSelectionOverlay( selectionOverlay: const CupertinoPickerDefaultSelectionOverlay(background: Color(0x12345678)),
background: Color(0x12345678)),
), ),
), ),
), ),
...@@ -245,7 +244,9 @@ void main() { ...@@ -245,7 +244,9 @@ void main() {
arguments: 'HapticFeedbackType.selectionClick', arguments: 'HapticFeedbackType.selectionClick',
), ),
); );
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS)); },
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
);
testWidgets( testWidgets(
'do not trigger haptic effects on non-iOS devices', 'do not trigger haptic effects on non-iOS devices',
...@@ -279,7 +280,9 @@ void main() { ...@@ -279,7 +280,9 @@ void main() {
await tester.drag(find.text('0'), const Offset(0.0, -100.0), warnIfMissed: false); // has an IgnorePointer await tester.drag(find.text('0'), const Offset(0.0, -100.0), warnIfMissed: false); // has an IgnorePointer
expect(selectedItems, <int>[1]); expect(selectedItems, <int>[1]);
expect(systemCalls, isEmpty); expect(systemCalls, isEmpty);
}, variant: TargetPlatformVariant(TargetPlatform.values.where((TargetPlatform platform) => platform != TargetPlatform.iOS).toSet())); },
variant: TargetPlatformVariant(TargetPlatform.values.where((TargetPlatform platform) => platform != TargetPlatform.iOS).toSet()),
);
testWidgets('a drag in between items settles back', (WidgetTester tester) async { testWidgets('a drag in between items settles back', (WidgetTester tester) async {
final FixedExtentScrollController controller = final FixedExtentScrollController controller =
......
...@@ -118,7 +118,9 @@ void main() { ...@@ -118,7 +118,9 @@ void main() {
tester.getTopLeft(find.widgetWithText(SizedBox, '0')), tester.getTopLeft(find.widgetWithText(SizedBox, '0')),
Offset.zero, Offset.zero,
); );
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); },
variant: TargetPlatformVariant.only(TargetPlatform.android),
);
testWidgets('let the builder update as canceled drag scrolls away', (WidgetTester tester) async { testWidgets('let the builder update as canceled drag scrolls away', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -294,7 +296,9 @@ void main() { ...@@ -294,7 +296,9 @@ void main() {
refreshTriggerPullDistance: 100, // Default value. refreshTriggerPullDistance: 100, // Default value.
))); )));
expect(mockHelper.invocations, hasLength(5)); expect(mockHelper.invocations, hasLength(5));
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'refreshing task keeps the sliver expanded forever until completes with error', 'refreshing task keeps the sliver expanded forever until completes with error',
...@@ -373,7 +377,9 @@ void main() { ...@@ -373,7 +377,9 @@ void main() {
errorCount++; errorCount++;
}, },
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets('expanded refreshing sliver scrolls normally', (WidgetTester tester) async { testWidgets('expanded refreshing sliver scrolls normally', (WidgetTester tester) async {
mockHelper.refreshIndicator = const Center(child: Text('-1')); mockHelper.refreshIndicator = const Center(child: Text('-1'));
...@@ -674,7 +680,9 @@ void main() { ...@@ -674,7 +680,9 @@ void main() {
refreshTriggerPullDistance: 100, // default value. refreshTriggerPullDistance: 100, // default value.
refreshIndicatorExtent: 60, // default value. refreshIndicatorExtent: 60, // default value.
))); )));
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'sliver held in overscroll when task finishes completes normally', 'sliver held in overscroll when task finishes completes normally',
...@@ -724,7 +732,9 @@ void main() { ...@@ -724,7 +732,9 @@ void main() {
tester.getRect(find.widgetWithText(Center, '0')), tester.getRect(find.widgetWithText(Center, '0')),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0), const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'sliver scrolled away when task completes properly removes itself', 'sliver scrolled away when task completes properly removes itself',
...@@ -808,7 +818,9 @@ void main() { ...@@ -808,7 +818,9 @@ void main() {
tester.getRect(find.widgetWithText(Center, '0')), tester.getRect(find.widgetWithText(Center, '0')),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0), const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
"don't do anything unless it can be overscrolled at the start of the list", "don't do anything unless it can be overscrolled at the start of the list",
...@@ -834,7 +846,9 @@ void main() { ...@@ -834,7 +846,9 @@ void main() {
await tester.fling(find.byType(SizedBox).first, const Offset(0.0, -200.0), 3000.0, warnIfMissed: false); // IgnorePointer is enabled while scroll is ballistic. await tester.fling(find.byType(SizedBox).first, const Offset(0.0, -200.0), 3000.0, warnIfMissed: false); // IgnorePointer is enabled while scroll is ballistic.
expect(mockHelper.invocations, isEmpty); expect(mockHelper.invocations, isEmpty);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'without an onRefresh, builder is called with arm for one frame then sliver goes away', 'without an onRefresh, builder is called with arm for one frame then sliver goes away',
...@@ -879,7 +893,9 @@ void main() { ...@@ -879,7 +893,9 @@ void main() {
tester.getRect(find.widgetWithText(Center, '0')), tester.getRect(find.widgetWithText(Center, '0')),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0), const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets('Should not crash when dragged', (WidgetTester tester) async { testWidgets('Should not crash when dragged', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -941,9 +957,11 @@ void main() { ...@@ -941,9 +957,11 @@ void main() {
expect( expect(
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy, tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
initialFirstCellY + 50 initialFirstCellY + 50,
);
},
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
} }
void stateMachineTestGroup() { void stateMachineTestGroup() {
...@@ -1065,7 +1083,9 @@ void main() { ...@@ -1065,7 +1083,9 @@ void main() {
CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))), CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))),
RefreshIndicatorMode.refresh, RefreshIndicatorMode.refresh,
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'goes to done internally as soon as the task finishes', 'goes to done internally as soon as the task finishes',
...@@ -1111,7 +1131,9 @@ void main() { ...@@ -1111,7 +1131,9 @@ void main() {
CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))), CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))),
RefreshIndicatorMode.done, RefreshIndicatorMode.done,
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'goes back to inactive when retracting back past 10% of arming distance', 'goes back to inactive when retracting back past 10% of arming distance',
...@@ -1168,7 +1190,9 @@ void main() { ...@@ -1168,7 +1190,9 @@ void main() {
CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))), CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder))),
RefreshIndicatorMode.inactive, RefreshIndicatorMode.inactive,
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
'goes back to inactive if already scrolled away when task completes', 'goes back to inactive if already scrolled away when task completes',
...@@ -1226,7 +1250,9 @@ void main() { ...@@ -1226,7 +1250,9 @@ void main() {
tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy, tester.getTopLeft(find.widgetWithText(SizedBox, '0')).dy,
moreOrLessEquals(-145.0332383665717), moreOrLessEquals(-145.0332383665717),
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets( testWidgets(
"don't have to build any indicators or occupy space during refresh", "don't have to build any indicators or occupy space during refresh",
...@@ -1274,7 +1300,9 @@ void main() { ...@@ -1274,7 +1300,9 @@ void main() {
CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder, skipOffstage: false))), CupertinoSliverRefreshControl.state(tester.element(find.byType(LayoutBuilder, skipOffstage: false))),
RefreshIndicatorMode.inactive, RefreshIndicatorMode.inactive,
); );
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); },
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }),
);
testWidgets('buildRefreshIndicator progress', (WidgetTester tester) async { testWidgets('buildRefreshIndicator progress', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -1386,7 +1414,8 @@ void main() { ...@@ -1386,7 +1414,8 @@ void main() {
await tester.pump(); await tester.pump();
expect(tester.takeException(), isNull); expect(tester.takeException(), isNull);
}); },
);
} }
class FakeBuilder { class FakeBuilder {
...@@ -1411,14 +1440,12 @@ class FakeBuilder { ...@@ -1411,14 +1440,12 @@ class FakeBuilder {
if (refreshIndicatorExtent < 0.0) { if (refreshIndicatorExtent < 0.0) {
throw TestFailure('The refreshIndicatorExtent should never be less than 0.0'); throw TestFailure('The refreshIndicatorExtent should never be less than 0.0');
} }
invocations.add( invocations.add(BuilderInvocation(
BuilderInvocation(
refreshState: refreshState, refreshState: refreshState,
pulledExtent: pulledExtent, pulledExtent: pulledExtent,
refreshTriggerPullDistance: refreshTriggerPullDistance, refreshTriggerPullDistance: refreshTriggerPullDistance,
refreshIndicatorExtent: refreshIndicatorExtent, refreshIndicatorExtent: refreshIndicatorExtent,
) ));
);
return refreshIndicator; return refreshIndicator;
} }
......
...@@ -87,7 +87,7 @@ void main() { ...@@ -87,7 +87,7 @@ void main() {
final RenderParagraph aParagraph = a.renderObject! as RenderParagraph; final RenderParagraph aParagraph = a.renderObject! as RenderParagraph;
final RenderParagraph bParagraph = b.renderObject! as RenderParagraph; final RenderParagraph bParagraph = b.renderObject! as RenderParagraph;
return aParagraph.text.style!.fontSize!.compareTo( return aParagraph.text.style!.fontSize!.compareTo(
bParagraph.text.style!.fontSize! bParagraph.text.style!.fontSize!,
); );
}); });
...@@ -397,7 +397,7 @@ void main() { ...@@ -397,7 +397,7 @@ void main() {
)); ));
}, },
); );
} },
), ),
), ),
); );
...@@ -501,7 +501,7 @@ void main() { ...@@ -501,7 +501,7 @@ void main() {
), ),
], ],
); );
} },
), ),
), ),
); );
...@@ -590,7 +590,7 @@ void main() { ...@@ -590,7 +590,7 @@ void main() {
), ),
], ],
); );
} },
), ),
), ),
); );
...@@ -664,7 +664,7 @@ void main() { ...@@ -664,7 +664,7 @@ void main() {
return const CupertinoPageScaffold( return const CupertinoPageScaffold(
child: Text('2'), child: Text('2'),
); );
} },
); );
tester.state<NavigatorState>(find.byType(Navigator)).push(route2); tester.state<NavigatorState>(find.byType(Navigator)).push(route2);
...@@ -716,7 +716,7 @@ void main() { ...@@ -716,7 +716,7 @@ void main() {
return const CupertinoPageScaffold( return const CupertinoPageScaffold(
child: Text('2'), child: Text('2'),
); );
} },
); );
tester.state<NavigatorState>(find.byType(Navigator)).push(route2); tester.state<NavigatorState>(find.byType(Navigator)).push(route2);
...@@ -762,7 +762,7 @@ void main() { ...@@ -762,7 +762,7 @@ void main() {
return const CupertinoPageScaffold( return const CupertinoPageScaffold(
child: Text('2'), child: Text('2'),
); );
} },
); );
tester.state<NavigatorState>(find.byType(Navigator)).push(route2); tester.state<NavigatorState>(find.byType(Navigator)).push(route2);
...@@ -812,7 +812,7 @@ void main() { ...@@ -812,7 +812,7 @@ void main() {
return const CupertinoPageScaffold( return const CupertinoPageScaffold(
child: Text('2'), child: Text('2'),
); );
} },
); );
navigatorKey.currentState!.push(route2); navigatorKey.currentState!.push(route2);
...@@ -1025,7 +1025,7 @@ void main() { ...@@ -1025,7 +1025,7 @@ void main() {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
homeTapCount += 1; homeTapCount += 1;
} },
), ),
), ),
), ),
...@@ -1044,7 +1044,7 @@ void main() { ...@@ -1044,7 +1044,7 @@ void main() {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
pageTapCount += 1; pageTapCount += 1;
} },
), ),
), ),
); );
...@@ -1118,9 +1118,9 @@ void main() { ...@@ -1118,9 +1118,9 @@ void main() {
child: Hero( child: Hero(
tag: 'tag', tag: 'tag',
transitionOnUserGestures: true, transitionOnUserGestures: true,
child: SizedBox(key: container, height: 150.0, width: 150.0) child: SizedBox(key: container, height: 150.0, width: 150.0),
),
), ),
)
); );
}, },
'/page2': (BuildContext context) { '/page2': (BuildContext context) {
...@@ -1131,12 +1131,12 @@ void main() { ...@@ -1131,12 +1131,12 @@ void main() {
child: Hero( child: Hero(
tag: 'tag', tag: 'tag',
transitionOnUserGestures: true, transitionOnUserGestures: true,
child: SizedBox(key: container, height: 150.0, width: 150.0) child: SizedBox(key: container, height: 150.0, width: 150.0),
) ),
),
), ),
)
); );
} },
}, },
)); ));
...@@ -1354,8 +1354,7 @@ void main() { ...@@ -1354,8 +1354,7 @@ void main() {
home: Navigator( home: Navigator(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
return PageRouteBuilder<dynamic>( return PageRouteBuilder<dynamic>(
pageBuilder: (BuildContext context, Animation<double> _, pageBuilder: (BuildContext context, Animation<double> _, Animation<double> __) {
Animation<double> __) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
await showCupertinoModalPopup<void>( await showCupertinoModalPopup<void>(
...@@ -1445,7 +1444,8 @@ void main() { ...@@ -1445,7 +1444,8 @@ void main() {
await showCupertinoModalPopup<void>( await showCupertinoModalPopup<void>(
context: context, context: context,
builder: (BuildContext context) => const SizedBox(), builder: (BuildContext context) => const SizedBox(),
barrierColor: customColor); barrierColor: customColor,
);
}, },
child: const Text('tap'), child: const Text('tap'),
); );
...@@ -1468,7 +1468,8 @@ void main() { ...@@ -1468,7 +1468,8 @@ void main() {
await showCupertinoModalPopup<void>( await showCupertinoModalPopup<void>(
context: context, context: context,
builder: (BuildContext context) => const Text('Visible'), builder: (BuildContext context) => const Text('Visible'),
barrierDismissible: true); barrierDismissible: true,
);
}, },
child: const Text('tap'), child: const Text('tap'),
); );
...@@ -1493,7 +1494,8 @@ void main() { ...@@ -1493,7 +1494,8 @@ void main() {
await showCupertinoModalPopup<void>( await showCupertinoModalPopup<void>(
context: context, context: context,
builder: (BuildContext context) => const Text('Visible'), builder: (BuildContext context) => const Text('Visible'),
barrierDismissible: false); barrierDismissible: false,
);
}, },
child: const Text('tap'), child: const Text('tap'),
); );
...@@ -1530,7 +1532,7 @@ void main() { ...@@ -1530,7 +1532,7 @@ void main() {
return true; return true;
}, },
transitionDelegate: detector, transitionDelegate: detector,
) ),
); );
expect(detector.hasTransition, isFalse); expect(detector.hasTransition, isFalse);
...@@ -1556,7 +1558,7 @@ void main() { ...@@ -1556,7 +1558,7 @@ void main() {
return true; return true;
}, },
transitionDelegate: detector, transitionDelegate: detector,
) ),
); );
// There should be no transition because the page has the same key. // There should be no transition because the page has the same key.
...@@ -1584,7 +1586,7 @@ void main() { ...@@ -1584,7 +1586,7 @@ void main() {
return true; return true;
}, },
transitionDelegate: detector, transitionDelegate: detector,
) ),
); );
expect(detector.hasTransition, isFalse); expect(detector.hasTransition, isFalse);
...@@ -1605,7 +1607,7 @@ void main() { ...@@ -1605,7 +1607,7 @@ void main() {
return true; return true;
}, },
transitionDelegate: detector, transitionDelegate: detector,
) ),
); );
// There should be no transition because the page has the same key. // There should be no transition because the page has the same key.
expect(detector.hasTransition, isFalse); expect(detector.hasTransition, isFalse);
...@@ -1795,7 +1797,7 @@ class TransitionDetector extends DefaultTransitionDelegate<void> { ...@@ -1795,7 +1797,7 @@ class TransitionDetector extends DefaultTransitionDelegate<void> {
return super.resolve( return super.resolve(
newPageRouteHistory: newPageRouteHistory, newPageRouteHistory: newPageRouteHistory,
locationToExitingPageRoute: locationToExitingPageRoute, locationToExitingPageRoute: locationToExitingPageRoute,
pageRouteToPagelessRoutes: pageRouteToPagelessRoutes pageRouteToPagelessRoutes: pageRouteToPagelessRoutes,
); );
} }
} }
...@@ -1804,7 +1806,7 @@ Widget buildNavigator({ ...@@ -1804,7 +1806,7 @@ Widget buildNavigator({
required List<Page<dynamic>> pages, required List<Page<dynamic>> pages,
PopPageCallback? onPopPage, PopPageCallback? onPopPage,
GlobalKey<NavigatorState>? key, GlobalKey<NavigatorState>? key,
TransitionDelegate<dynamic>? transitionDelegate TransitionDelegate<dynamic>? transitionDelegate,
}) { }) {
return MediaQuery( return MediaQuery(
data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window), data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window),
...@@ -1812,7 +1814,7 @@ Widget buildNavigator({ ...@@ -1812,7 +1814,7 @@ Widget buildNavigator({
locale: const Locale('en', 'US'), locale: const Locale('en', 'US'),
delegates: const <LocalizationsDelegate<dynamic>>[ delegates: const <LocalizationsDelegate<dynamic>>[
DefaultCupertinoLocalizations.delegate, DefaultCupertinoLocalizations.delegate,
DefaultWidgetsLocalizations.delegate DefaultWidgetsLocalizations.delegate,
], ],
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
), ),
child: CupertinoScrollbar( child: CupertinoScrollbar(
child: ListView( child: ListView(
children: const <Widget> [SizedBox(width: 4000, height: 4000)] children: const <Widget>[SizedBox(width: 4000, height: 4000)],
), ),
), ),
), ),
......
...@@ -264,7 +264,8 @@ void main() { ...@@ -264,7 +264,8 @@ void main() {
await tester.pump(_kScrollbarFadeDuration); await tester.pump(_kScrollbarFadeDuration);
}); });
testWidgets('When isAlwaysShown is true, must pass a controller or find PrimaryScrollController', testWidgets(
'When isAlwaysShown is true, must pass a controller or find PrimaryScrollController',
(WidgetTester tester) async { (WidgetTester tester) async {
Widget viewWithScroll() { Widget viewWithScroll() {
return const Directionality( return const Directionality(
...@@ -287,9 +288,12 @@ void main() { ...@@ -287,9 +288,12 @@ void main() {
await tester.pumpWidget(viewWithScroll()); await tester.pumpWidget(viewWithScroll());
final dynamic exception = tester.takeException(); final dynamic exception = tester.takeException();
expect(exception, isAssertionError); expect(exception, isAssertionError);
}); },
);
testWidgets('When isAlwaysShown is true, must pass a controller or find PrimarySCrollController that is attached to a scroll view', testWidgets(
'When isAlwaysShown is true, '
'must pass a controller or find PrimarySCrollController that is attached to a scroll view',
(WidgetTester tester) async { (WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
Widget viewWithScroll() { Widget viewWithScroll() {
...@@ -314,9 +318,12 @@ void main() { ...@@ -314,9 +318,12 @@ void main() {
await tester.pumpWidget(viewWithScroll()); await tester.pumpWidget(viewWithScroll());
final dynamic exception = tester.takeException(); final dynamic exception = tester.takeException();
expect(exception, isAssertionError); expect(exception, isAssertionError);
}); },
);
testWidgets('On first render with isAlwaysShown: true, the thumb shows with PrimaryScrollController', (WidgetTester tester) async { testWidgets(
'On first render with isAlwaysShown: true, the thumb shows with PrimaryScrollController',
(WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
Widget viewWithScroll() { Widget viewWithScroll() {
return Directionality( return Directionality(
...@@ -347,10 +354,10 @@ void main() { ...@@ -347,10 +354,10 @@ void main() {
await tester.pumpWidget(viewWithScroll()); await tester.pumpWidget(viewWithScroll());
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoScrollbar), paints..rect()); expect(find.byType(CupertinoScrollbar), paints..rect());
}); },
);
testWidgets('On first render with isAlwaysShown: true, the thumb shows', testWidgets('On first render with isAlwaysShown: true, the thumb shows', (WidgetTester tester) async {
(WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
Widget viewWithScroll() { Widget viewWithScroll() {
return Directionality( return Directionality(
...@@ -383,8 +390,7 @@ void main() { ...@@ -383,8 +390,7 @@ void main() {
expect(find.byType(CupertinoScrollbar), paints..rrect()); expect(find.byType(CupertinoScrollbar), paints..rrect());
}); });
testWidgets('On first render with isAlwaysShown: false, the thumb is hidden', testWidgets('On first render with isAlwaysShown: false, the thumb is hidden', (WidgetTester tester) async {
(WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
Widget viewWithScroll() { Widget viewWithScroll() {
return Directionality( return Directionality(
...@@ -448,7 +454,7 @@ void main() { ...@@ -448,7 +454,7 @@ void main() {
}, },
child: const Text('change isAlwaysShown'), child: const Text('change isAlwaysShown'),
), ),
) ),
], ],
), ),
), ),
...@@ -469,7 +475,8 @@ void main() { ...@@ -469,7 +475,8 @@ void main() {
await tester.tap(find.byType(CupertinoButton)); await tester.tap(find.byType(CupertinoButton));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoScrollbar), isNot(paints..rrect())); expect(find.byType(CupertinoScrollbar), isNot(paints..rrect()));
}); },
);
testWidgets( testWidgets(
'With isAlwaysShown: false, set isAlwaysShown: true. The thumb should be always shown directly', 'With isAlwaysShown: false, set isAlwaysShown: true. The thumb should be always shown directly',
...@@ -506,7 +513,7 @@ void main() { ...@@ -506,7 +513,7 @@ void main() {
}, },
child: const Text('change isAlwaysShown'), child: const Text('change isAlwaysShown'),
), ),
) ),
], ],
), ),
), ),
...@@ -522,10 +529,12 @@ void main() { ...@@ -522,10 +529,12 @@ void main() {
await tester.tap(find.byType(CupertinoButton)); await tester.tap(find.byType(CupertinoButton));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoScrollbar), paints..rrect()); expect(find.byType(CupertinoScrollbar), paints..rrect());
}); },
);
testWidgets( testWidgets(
'With isAlwaysShown: false, fling a scroll. While it is still scrolling, set isAlwaysShown: true. The thumb should not fade even after the scrolling stops', 'With isAlwaysShown: false, fling a scroll. While it is still scrolling, set isAlwaysShown: true. '
'The thumb should not fade even after the scrolling stops',
(WidgetTester tester) async { (WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
bool isAlwaysShown = false; bool isAlwaysShown = false;
...@@ -559,7 +568,7 @@ void main() { ...@@ -559,7 +568,7 @@ void main() {
}, },
child: const Text('change isAlwaysShown'), child: const Text('change isAlwaysShown'),
), ),
) ),
], ],
), ),
), ),
...@@ -587,10 +596,12 @@ void main() { ...@@ -587,10 +596,12 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Scrollbar thumb is showing after scroll finishes and timer ends. // Scrollbar thumb is showing after scroll finishes and timer ends.
expect(find.byType(CupertinoScrollbar), paints..rrect()); expect(find.byType(CupertinoScrollbar), paints..rrect());
}); },
);
testWidgets( testWidgets(
'Toggling isAlwaysShown while not scrolling fades the thumb in/out. This works even when you have never scrolled at all yet', 'Toggling isAlwaysShown while not scrolling fades the thumb in/out. '
'This works even when you have never scrolled at all yet',
(WidgetTester tester) async { (WidgetTester tester) async {
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
bool isAlwaysShown = true; bool isAlwaysShown = true;
...@@ -624,7 +635,7 @@ void main() { ...@@ -624,7 +635,7 @@ void main() {
}, },
child: const Text('change isAlwaysShown'), child: const Text('change isAlwaysShown'),
), ),
) ),
], ],
), ),
), ),
...@@ -640,7 +651,8 @@ void main() { ...@@ -640,7 +651,8 @@ void main() {
await tester.tap(find.byType(CupertinoButton)); await tester.tap(find.byType(CupertinoButton));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoScrollbar), isNot(paints..rrect())); expect(find.byType(CupertinoScrollbar), isNot(paints..rrect()));
}); },
);
testWidgets('Scrollbar thumb can be dragged with long press - horizontal axis', (WidgetTester tester) async { testWidgets('Scrollbar thumb can be dragged with long press - horizontal axis', (WidgetTester tester) async {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
...@@ -741,7 +753,7 @@ void main() { ...@@ -741,7 +753,7 @@ void main() {
paints..rrect( paints..rrect(
color: _kScrollbarColor.color, color: _kScrollbarColor.color,
rrect: RRect.fromLTRBR(794.0, 3.0, 797.0, 359.4, const Radius.circular(1.5)), rrect: RRect.fromLTRBR(794.0, 3.0, 797.0, 359.4, const Radius.circular(1.5)),
) ),
); );
// Tap on the track area below the thumb. // Tap on the track area below the thumb.
...@@ -757,7 +769,7 @@ void main() { ...@@ -757,7 +769,7 @@ void main() {
const Rect.fromLTRB(794.0, 240.6, 797.0, 597.0), const Rect.fromLTRB(794.0, 240.6, 797.0, 597.0),
const Radius.circular(1.5), const Radius.circular(1.5),
), ),
) ),
); );
// Tap on the track area above the thumb. // Tap on the track area above the thumb.
...@@ -770,7 +782,7 @@ void main() { ...@@ -770,7 +782,7 @@ void main() {
paints..rrect( paints..rrect(
color: _kScrollbarColor.color, color: _kScrollbarColor.color,
rrect: RRect.fromLTRBR(794.0, 3.0, 797.0, 359.4, const Radius.circular(1.5)), rrect: RRect.fromLTRBR(794.0, 3.0, 797.0, 359.4, const Radius.circular(1.5)),
) ),
); );
}); });
...@@ -785,7 +797,7 @@ void main() { ...@@ -785,7 +797,7 @@ void main() {
isAlwaysShown: true, isAlwaysShown: true,
controller: scrollController, controller: scrollController,
child: const SingleChildScrollView( child: const SingleChildScrollView(
child: SizedBox(width: 4000.0, height: 4000.0) child: SizedBox(width: 4000.0, height: 4000.0),
), ),
), ),
), ),
......
...@@ -150,8 +150,7 @@ void main() { ...@@ -150,8 +150,7 @@ void main() {
); );
Text placeholder = tester.widget(find.text('Search')); Text placeholder = tester.widget(find.text('Search'));
expect(placeholder.style!.color!.value, expect(placeholder.style!.color!.value, CupertinoColors.systemGrey.darkColor.value);
CupertinoColors.systemGrey.darkColor.value);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -165,8 +164,7 @@ void main() { ...@@ -165,8 +164,7 @@ void main() {
); );
placeholder = tester.widget(find.text('Search')); placeholder = tester.widget(find.text('Search'));
expect(placeholder.style!.color!.value, expect(placeholder.style!.color!.value, CupertinoColors.systemGrey.color.value);
CupertinoColors.systemGrey.color.value);
}); });
testWidgets( testWidgets(
...@@ -274,8 +272,7 @@ void main() { ...@@ -274,8 +272,7 @@ void main() {
expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsOneWidget); expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsOneWidget);
await tester.enterText( await tester.enterText(find.byType(CupertinoSearchTextField), 'text input');
find.byType(CupertinoSearchTextField), 'text input');
await tester.pump(); await tester.pump();
expect(find.text('text input'), findsOneWidget); expect(find.text('text input'), findsOneWidget);
...@@ -300,8 +297,7 @@ void main() { ...@@ -300,8 +297,7 @@ void main() {
expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsNothing); expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsNothing);
await tester.enterText( await tester.enterText(find.byType(CupertinoSearchTextField), 'text input');
find.byType(CupertinoSearchTextField), 'text input');
await tester.pump(); await tester.pump();
expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsOneWidget); expect(find.byIcon(CupertinoIcons.xmark_circle_fill), findsOneWidget);
...@@ -443,8 +439,7 @@ void main() { ...@@ -443,8 +439,7 @@ void main() {
testWidgets( testWidgets(
'custom suffix onTap overrides default clearing behavior', 'custom suffix onTap overrides default clearing behavior',
(WidgetTester tester) async { (WidgetTester tester) async {
final TextEditingController controller = final TextEditingController controller = TextEditingController(text: 'Text');
TextEditingController(text: 'Text');
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -466,8 +461,7 @@ void main() { ...@@ -466,8 +461,7 @@ void main() {
}, },
); );
testWidgets('onTap is properly forwarded to the inner text field', testWidgets('onTap is properly forwarded to the inner text field', (WidgetTester tester) async {
(WidgetTester tester) async {
int onTapCallCount = 0; int onTapCallCount = 0;
// onTap can be null. // onTap can be null.
...@@ -497,9 +491,7 @@ void main() { ...@@ -497,9 +491,7 @@ void main() {
expect(onTapCallCount, 1); expect(onTapCallCount, 1);
}); });
testWidgets('autocorrect is properly forwarded to the inner text field', testWidgets('autocorrect is properly forwarded to the inner text field', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const CupertinoApp( const CupertinoApp(
home: Center( home: Center(
...@@ -514,9 +506,7 @@ void main() { ...@@ -514,9 +506,7 @@ void main() {
expect(textField.autocorrect, false); expect(textField.autocorrect, false);
}); });
testWidgets('enabled is properly forwarded to the inner text field', testWidgets('enabled is properly forwarded to the inner text field', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const CupertinoApp( const CupertinoApp(
home: Center( home: Center(
......
...@@ -218,8 +218,10 @@ void main() { ...@@ -218,8 +218,10 @@ void main() {
), ),
), ),
); );
fail('Should not be possible to create segmented control in which ' fail(
'value is not the key of one of the children widgets'); 'Should not be possible to create segmented control in which '
'value is not the key of one of the children widgets',
);
} on AssertionError catch (e) { } on AssertionError catch (e) {
expect(e.toString(), contains('children')); expect(e.toString(), contains('children'));
} }
...@@ -605,8 +607,7 @@ void main() { ...@@ -605,8 +607,7 @@ void main() {
), ),
); );
final RenderBox buttonBox = tester.renderObject( final RenderBox buttonBox = tester.renderObject(find.byKey(const ValueKey<String>('Segmented Control')));
find.byKey(const ValueKey<String>('Segmented Control')));
expect(buttonBox.size.height, 400.0); expect(buttonBox.size.height, 400.0);
}); });
...@@ -637,8 +638,7 @@ void main() { ...@@ -637,8 +638,7 @@ void main() {
), ),
); );
final RenderBox segmentedControl = tester.renderObject( final RenderBox segmentedControl = tester.renderObject(find.byKey(const ValueKey<String>('Segmented Control')));
find.byKey(const ValueKey<String>('Segmented Control')));
// Subtract the 16.0px from each side. Remaining width should be allocated // Subtract the 16.0px from each side. Remaining width should be allocated
// to each child equally. // to each child equally.
...@@ -646,12 +646,9 @@ void main() { ...@@ -646,12 +646,9 @@ void main() {
expect(childWidth, 200.0); expect(childWidth, 200.0);
expect(childWidth, expect(childWidth, getRenderSegmentedControl(tester).getChildrenAsList()[0].parentData.surroundingRect.width);
getRenderSegmentedControl(tester).getChildrenAsList()[0].parentData.surroundingRect.width); expect(childWidth, getRenderSegmentedControl(tester).getChildrenAsList()[1].parentData.surroundingRect.width);
expect(childWidth, expect(childWidth, getRenderSegmentedControl(tester).getChildrenAsList()[2].parentData.surroundingRect.width);
getRenderSegmentedControl(tester).getChildrenAsList()[1].parentData.surroundingRect.width);
expect(childWidth,
getRenderSegmentedControl(tester).getChildrenAsList()[2].parentData.surroundingRect.width);
}); });
testWidgets('Width is finite in unbounded space', (WidgetTester tester) async { testWidgets('Width is finite in unbounded space', (WidgetTester tester) async {
...@@ -677,8 +674,7 @@ void main() { ...@@ -677,8 +674,7 @@ void main() {
), ),
); );
final RenderBox segmentedControl = tester.renderObject( final RenderBox segmentedControl = tester.renderObject(find.byKey(const ValueKey<String>('Segmented Control')));
find.byKey(const ValueKey<String>('Segmented Control')));
expect(segmentedControl.size.width.isFinite, isTrue); expect(segmentedControl.size.width.isFinite, isTrue);
}); });
...@@ -700,8 +696,7 @@ void main() { ...@@ -700,8 +696,7 @@ void main() {
), ),
); );
expect(tester.getTopRight(find.text('Child 1')).dx > expect(tester.getTopRight(find.text('Child 1')).dx > tester.getTopRight(find.text('Child 2')).dx, isTrue);
tester.getTopRight(find.text('Child 2')).dx, isTrue);
}); });
testWidgets('Correct initial selection and toggling behavior - RTL', (WidgetTester tester) async { testWidgets('Correct initial selection and toggling behavior - RTL', (WidgetTester tester) async {
...@@ -844,7 +839,8 @@ void main() { ...@@ -844,7 +839,8 @@ void main() {
ignoreId: true, ignoreId: true,
ignoreRect: true, ignoreRect: true,
ignoreTransform: true, ignoreTransform: true,
)); ),
);
semantics.dispose(); semantics.dispose();
}); });
...@@ -967,7 +963,8 @@ void main() { ...@@ -967,7 +963,8 @@ void main() {
await tester.tapAt(centerOfTwo + const Offset(10, 0)); await tester.tapAt(centerOfTwo + const Offset(10, 0));
expect(sharedValue, 1); expect(sharedValue, 1);
}); },
);
testWidgets('Animation is correct when the selected segment changes', (WidgetTester tester) async { testWidgets('Animation is correct when the selected segment changes', (WidgetTester tester) async {
await tester.pumpWidget(setupSimpleSegmentedControl()); await tester.pumpWidget(setupSimpleSegmentedControl());
......
...@@ -347,7 +347,7 @@ void main() { ...@@ -347,7 +347,7 @@ void main() {
TestSemantics( TestSemantics(
id: 1, id: 1,
flags: <SemanticsFlag>[SemanticsFlag.isSlider], flags: <SemanticsFlag>[SemanticsFlag.isSlider],
) ),
], ],
), ),
ignoreRect: true, ignoreRect: true,
...@@ -587,7 +587,7 @@ void main() { ...@@ -587,7 +587,7 @@ void main() {
..rrect() ..rrect()
..rrect() ..rrect()
..rrect() ..rrect()
..rrect(color: CupertinoColors.systemPurple.color) ..rrect(color: CupertinoColors.systemPurple.color),
); );
await tester.pumpWidget( await tester.pumpWidget(
...@@ -610,7 +610,7 @@ void main() { ...@@ -610,7 +610,7 @@ void main() {
..rrect() ..rrect()
..rrect() ..rrect()
..rrect() ..rrect()
..rrect(color: CupertinoColors.activeOrange.color) ..rrect(color: CupertinoColors.activeOrange.color),
); );
}); });
} }
...@@ -573,8 +573,7 @@ void main() { ...@@ -573,8 +573,7 @@ void main() {
), ),
); );
expect(tester.getTopRight(find.text('Child 1')).dx > expect(tester.getTopRight(find.text('Child 1')).dx > tester.getTopRight(find.text('Child 2')).dx, isTrue);
tester.getTopRight(find.text('Child 2')).dx, isTrue);
}); });
testWidgets('Correct initial selection and toggling behavior - RTL', (WidgetTester tester) async { testWidgets('Correct initial selection and toggling behavior - RTL', (WidgetTester tester) async {
...@@ -701,7 +700,8 @@ void main() { ...@@ -701,7 +700,8 @@ void main() {
ignoreId: true, ignoreId: true,
ignoreRect: true, ignoreRect: true,
ignoreTransform: true, ignoreTransform: true,
)); ),
);
semantics.dispose(); semantics.dispose();
}); });
...@@ -901,7 +901,8 @@ void main() { ...@@ -901,7 +901,8 @@ void main() {
// are to account for the thumb's vertical EdgeInsets. // are to account for the thumb's vertical EdgeInsets.
expect(segmentedControlOrigin.dx - 1, lessThanOrEqualTo(thumbRect.left)); expect(segmentedControlOrigin.dx - 1, lessThanOrEqualTo(thumbRect.left));
expect(segmentedControlOrigin.dx + renderSegmentedControl.size.width + 1, greaterThanOrEqualTo(thumbRect.right)); expect(segmentedControlOrigin.dx + renderSegmentedControl.size.width + 1, greaterThanOrEqualTo(thumbRect.right));
}); },
);
testWidgets('Transition is triggered while a transition is already occurring', (WidgetTester tester) async { testWidgets('Transition is triggered while a transition is already occurring', (WidgetTester tester) async {
const Map<int, Widget> children = <int, Widget>{ const Map<int, Widget> children = <int, Widget>{
......
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -250,7 +250,7 @@ void main() { ...@@ -250,7 +250,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -286,7 +286,7 @@ void main() { ...@@ -286,7 +286,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -305,7 +305,7 @@ void main() { ...@@ -305,7 +305,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -504,7 +504,7 @@ void main() { ...@@ -504,7 +504,7 @@ void main() {
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
contentPadding = MediaQuery.of(context).padding; contentPadding = MediaQuery.of(context).padding;
return const Placeholder(); return const Placeholder();
} },
), ),
), ),
), ),
...@@ -514,7 +514,8 @@ void main() { ...@@ -514,7 +514,8 @@ void main() {
expect(await getContentPaddingWithTabBarColor(const Color(0xAAFFFFFF)), isNot(EdgeInsets.zero)); expect(await getContentPaddingWithTabBarColor(const Color(0xAAFFFFFF)), isNot(EdgeInsets.zero));
expect(await getContentPaddingWithTabBarColor(const Color(0xFFFFFFFF)), EdgeInsets.zero); expect(await getContentPaddingWithTabBarColor(const Color(0xFFFFFFFF)), EdgeInsets.zero);
}); },
);
testWidgets('Tab and page scaffolds do not double stack view insets', (WidgetTester tester) async { testWidgets('Tab and page scaffolds do not double stack view insets', (WidgetTester tester) async {
late BuildContext innerContext; late BuildContext innerContext;
...@@ -631,7 +632,7 @@ void main() { ...@@ -631,7 +632,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -653,7 +654,7 @@ void main() { ...@@ -653,7 +654,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -670,7 +671,8 @@ void main() { ...@@ -670,7 +671,8 @@ void main() {
expect(tabsPainted, const <int>[0, 0, 18]); expect(tabsPainted, const <int>[0, 0, 18]);
}); });
testWidgets('If a controller is initially provided then the parent stops doing so for rebuilds, ' testWidgets(
'If a controller is initially provided then the parent stops doing so for rebuilds, '
'a new instance of CupertinoTabController should be created and used by the widget, ' 'a new instance of CupertinoTabController should be created and used by the widget, '
"while preserving the previous controller's tab index", "while preserving the previous controller's tab index",
(WidgetTester tester) async { (WidgetTester tester) async {
...@@ -688,7 +690,7 @@ void main() { ...@@ -688,7 +690,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -710,7 +712,7 @@ void main() { ...@@ -710,7 +712,7 @@ void main() {
return CustomPaint( return CustomPaint(
child: Text('Page ${index + 1}'), child: Text('Page ${index + 1}'),
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () { tabsPainted.add(index); } onPaint: () { tabsPainted.add(index); },
), ),
); );
}, },
...@@ -731,9 +733,11 @@ void main() { ...@@ -731,9 +733,11 @@ void main() {
// Changing [index] of the oldController should not work. // Changing [index] of the oldController should not work.
expect(tabsPainted, const <int> [0, 0, 1]); expect(tabsPainted, const <int> [0, 0, 1]);
}); },
);
testWidgets('Do not call dispose on a controller that we do not own ' testWidgets(
'Do not call dispose on a controller that we do not own '
'but do remove from its listeners when done listening to it', 'but do remove from its listeners when done listening to it',
(WidgetTester tester) async { (WidgetTester tester) async {
final MockCupertinoTabController mockController = MockCupertinoTabController(initialIndex: 0); final MockCupertinoTabController mockController = MockCupertinoTabController(initialIndex: 0);
...@@ -767,7 +771,8 @@ void main() { ...@@ -767,7 +771,8 @@ void main() {
expect(mockController.numOfListeners, 0); expect(mockController.numOfListeners, 0);
expect(mockController.isDisposed, isFalse); expect(mockController.isDisposed, isFalse);
}); },
);
testWidgets('The owner can dispose the old controller', (WidgetTester tester) async { testWidgets('The owner can dispose the old controller', (WidgetTester tester) async {
CupertinoTabController controller = CupertinoTabController(initialIndex: 2); CupertinoTabController controller = CupertinoTabController(initialIndex: 2);
...@@ -827,7 +832,7 @@ void main() { ...@@ -827,7 +832,7 @@ void main() {
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
return CustomPaint( return CustomPaint(
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () => tabsPainted0.add(index) onPaint: () => tabsPainted0.add(index),
), ),
); );
}, },
...@@ -840,7 +845,7 @@ void main() { ...@@ -840,7 +845,7 @@ void main() {
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
return CustomPaint( return CustomPaint(
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () => tabsPainted1.add(index) onPaint: () => tabsPainted1.add(index),
), ),
); );
}, },
...@@ -874,7 +879,7 @@ void main() { ...@@ -874,7 +879,7 @@ void main() {
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
return CustomPaint( return CustomPaint(
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () => tabsPainted0.add(index) onPaint: () => tabsPainted0.add(index),
), ),
); );
}, },
...@@ -904,8 +909,8 @@ void main() { ...@@ -904,8 +909,8 @@ void main() {
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
return CustomPaint( return CustomPaint(
painter: TestCallbackPainter( painter: TestCallbackPainter(
onPaint: () => tabsPainted0.add(index) onPaint: () => tabsPainted0.add(index),
) ),
); );
}, },
), ),
...@@ -917,7 +922,8 @@ void main() { ...@@ -917,7 +922,8 @@ void main() {
expect(tabsPainted0, const <int>[2, 0, 1, 2]); expect(tabsPainted0, const <int>[2, 0, 1, 2]);
expect(tabsPainted1, const <int>[2, 0]); expect(tabsPainted1, const <int>[2, 0]);
expect(controller.numOfListeners, 1); expect(controller.numOfListeners, 1);
}); },
);
testWidgets('Assert when current tab index >= number of tabs', (WidgetTester tester) async { testWidgets('Assert when current tab index >= number of tabs', (WidgetTester tester) async {
final CupertinoTabController controller = CupertinoTabController(initialIndex: 2); final CupertinoTabController controller = CupertinoTabController(initialIndex: 2);
......
...@@ -172,8 +172,7 @@ void main() { ...@@ -172,8 +172,7 @@ void main() {
expect(find.text('second route'), findsNothing); expect(find.text('second route'), findsNothing);
}); });
testWidgets('Throws FlutterError when onUnknownRoute is null', ( testWidgets('Throws FlutterError when onUnknownRoute is null', (WidgetTester tester) async {
WidgetTester tester) async {
final GlobalKey<NavigatorState> key = GlobalKey(); final GlobalKey<NavigatorState> key = GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
...@@ -191,7 +190,9 @@ void main() { ...@@ -191,7 +190,9 @@ void main() {
error = e; error = e;
} }
expect(error, isNotNull); expect(error, isNotNull);
expect(error.toStringDeep(), equalsIgnoringHashCodes( expect(
error.toStringDeep(),
equalsIgnoringHashCodes(
'FlutterError\n' 'FlutterError\n'
' Could not find a generator for route RouteSettings("/2", null) in\n' ' Could not find a generator for route RouteSettings("/2", null) in\n'
' the _CupertinoTabViewState.\n' ' the _CupertinoTabViewState.\n'
...@@ -204,12 +205,12 @@ void main() { ...@@ -204,12 +205,12 @@ void main() {
' non-null value for any valid route not handled by "builder" and\n' ' non-null value for any valid route not handled by "builder" and\n'
' "routes".\n' ' "routes".\n'
' 4. Finally if all else fails onUnknownRoute is called.\n' ' 4. Finally if all else fails onUnknownRoute is called.\n'
' Unfortunately, onUnknownRoute was not set.\n' ' Unfortunately, onUnknownRoute was not set.\n',
)); ),
);
}); });
testWidgets('Throws FlutterError when onUnknownRoute returns null', ( testWidgets('Throws FlutterError when onUnknownRoute returns null', (WidgetTester tester) async {
WidgetTester tester) async {
final GlobalKey<NavigatorState> key = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> key = GlobalKey<NavigatorState>();
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
...@@ -227,13 +228,16 @@ void main() { ...@@ -227,13 +228,16 @@ void main() {
error = e; error = e;
} }
expect(error, isNotNull); expect(error, isNotNull);
expect(error.toStringDeep(), equalsIgnoringHashCodes( expect(
error.toStringDeep(),
equalsIgnoringHashCodes(
'FlutterError\n' 'FlutterError\n'
' The onUnknownRoute callback returned null.\n' ' The onUnknownRoute callback returned null.\n'
' When the _CupertinoTabViewState requested the route\n' ' When the _CupertinoTabViewState requested the route\n'
' RouteSettings("/2", null) from its onUnknownRoute callback, the\n' ' RouteSettings("/2", null) from its onUnknownRoute callback, the\n'
' callback returned null. Such callbacks must never return null.\n' ' callback returned null. Such callbacks must never return null.\n',
)); ),
);
}); });
testWidgets('Navigator of CupertinoTabView restores state', (WidgetTester tester) async { testWidgets('Navigator of CupertinoTabView restores state', (WidgetTester tester) async {
...@@ -250,7 +254,7 @@ void main() { ...@@ -250,7 +254,7 @@ void main() {
), ),
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
'/2' : (BuildContext context) => const Text('second route'), '/2' : (BuildContext context) => const Text('second route'),
} },
), ),
), ),
); );
......
...@@ -35,8 +35,7 @@ class MockClipboard { ...@@ -35,8 +35,7 @@ class MockClipboard {
class MockTextSelectionControls extends TextSelectionControls { class MockTextSelectionControls extends TextSelectionControls {
@override @override
Widget buildHandle(BuildContext context, TextSelectionHandleType type, Widget buildHandle(BuildContext context, TextSelectionHandleType type, double textLineHeight) {
double textLineHeight) {
throw UnimplementedError(); throw UnimplementedError();
} }
...@@ -107,7 +106,7 @@ class PathBoundsMatcher extends Matcher { ...@@ -107,7 +106,7 @@ class PathBoundsMatcher extends Matcher {
final Map<Matcher, dynamic> map = matchState['failedMatcher'] as Map<Matcher, dynamic>; final Map<Matcher, dynamic> map = matchState['failedMatcher'] as Map<Matcher, dynamic>;
final Iterable<String> descriptions = map.entries final Iterable<String> descriptions = map.entries
.map<String>( .map<String>(
(MapEntry<Matcher, dynamic> entry) => entry.key.describeMismatch(entry.value, StringDescription(), matchState, verbose).toString() (MapEntry<Matcher, dynamic> entry) => entry.key.describeMismatch(entry.value, StringDescription(), matchState, verbose).toString(),
); );
// description is guaranteed to be non-null. // description is guaranteed to be non-null.
...@@ -292,7 +291,7 @@ void main() { ...@@ -292,7 +291,7 @@ void main() {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: CupertinoTextField(focusNode: focusNode) home: CupertinoTextField(focusNode: focusNode),
), ),
); );
expect(semantics, hasSemantics( expect(semantics, hasSemantics(
...@@ -312,9 +311,9 @@ void main() { ...@@ -312,9 +311,9 @@ void main() {
TestSemantics( TestSemantics(
id: 4, id: 4,
flags: <SemanticsFlag>[SemanticsFlag.isTextField, flags: <SemanticsFlag>[SemanticsFlag.isTextField,
SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled], SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled,],
actions: <SemanticsAction>[SemanticsAction.tap, actions: <SemanticsAction>[SemanticsAction.tap,
SemanticsAction.didGainAccessibilityFocus], SemanticsAction.didGainAccessibilityFocus,],
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
], ],
...@@ -1442,7 +1441,7 @@ void main() { ...@@ -1442,7 +1441,7 @@ void main() {
); );
await tester.longPressAt( await tester.longPressAt(
tester.getTopRight(find.text("j'aime la poutine")) tester.getTopRight(find.text("j'aime la poutine")),
); );
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 200)); await tester.pump(const Duration(milliseconds: 200));
...@@ -1473,7 +1472,7 @@ void main() { ...@@ -1473,7 +1472,7 @@ void main() {
); );
await tester.longPressAt( await tester.longPressAt(
tester.getTopRight(find.text("j'aime la poutine")) tester.getTopRight(find.text("j'aime la poutine")),
); );
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 200)); await tester.pump(const Duration(milliseconds: 200));
...@@ -1549,7 +1548,7 @@ void main() { ...@@ -1549,7 +1548,7 @@ void main() {
expect(tester.testTextInput.hasAnyClients, false); expect(tester.testTextInput.hasAnyClients, false);
await tester.longPressAt( await tester.longPressAt(
tester.getTopRight(find.text('readonly')) tester.getTopRight(find.text('readonly')),
); );
await tester.pump(); await tester.pump();
...@@ -1590,7 +1589,7 @@ void main() { ...@@ -1590,7 +1589,7 @@ void main() {
// Tap an area inside the EditableText but with no text. // Tap an area inside the EditableText but with no text.
await tester.longPressAt( await tester.longPressAt(
tester.getTopRight(find.text("j'aime la poutine")) tester.getTopRight(find.text("j'aime la poutine")),
); );
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 200)); await tester.pump(const Duration(milliseconds: 200));
...@@ -2348,7 +2347,7 @@ void main() { ...@@ -2348,7 +2347,7 @@ void main() {
); );
final RenderEditable renderEditable = tester.renderObject<RenderEditable>( final RenderEditable renderEditable = tester.renderObject<RenderEditable>(
find.byElementPredicate((Element element) => element.renderObject is RenderEditable) find.byElementPredicate((Element element) => element.renderObject is RenderEditable),
); );
List<TextSelectionPoint> lastCharEndpoint = renderEditable.getEndpointsForSelection( List<TextSelectionPoint> lastCharEndpoint = renderEditable.getEndpointsForSelection(
...@@ -3024,7 +3023,8 @@ void main() { ...@@ -3024,7 +3023,8 @@ void main() {
expect(tapCount, 2); expect(tapCount, 2);
}); });
testWidgets('onTap does not work when the text field is disabled', testWidgets(
'onTap does not work when the text field is disabled',
(WidgetTester tester) async { (WidgetTester tester) async {
int tapCount = 0; int tapCount = 0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -3077,7 +3077,8 @@ void main() { ...@@ -3077,7 +3077,8 @@ void main() {
await tester.tap(find.byType(CupertinoTextField), warnIfMissed: false); // disabled await tester.tap(find.byType(CupertinoTextField), warnIfMissed: false); // disabled
await tester.pump(); await tester.pump();
expect(tapCount, 1); expect(tapCount, 1);
}); },
);
testWidgets('Focus test when the text field is disabled', (WidgetTester tester) async { testWidgets('Focus test when the text field is disabled', (WidgetTester tester) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
...@@ -3147,7 +3148,7 @@ void main() { ...@@ -3147,7 +3148,7 @@ void main() {
expect( expect(
tester.renderObject<RenderEditable>( tester.renderObject<RenderEditable>(
find.byElementPredicate((Element element) => element.renderObject is RenderEditable) find.byElementPredicate((Element element) => element.renderObject is RenderEditable),
).text!.style!.color, ).text!.style!.color,
isSameColorAs(CupertinoColors.white), isSameColorAs(CupertinoColors.white),
); );
...@@ -4533,7 +4534,7 @@ void main() { ...@@ -4533,7 +4534,7 @@ void main() {
CupertinoApp( CupertinoApp(
home: Center( home: Center(
child: CupertinoTextField( child: CupertinoTextField(
selectionControls: selectionControl selectionControls: selectionControl,
), ),
), ),
), ),
...@@ -4549,7 +4550,7 @@ void main() { ...@@ -4549,7 +4550,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: CupertinoTextField(maxLength: 5, inputFormatters: formatters), home: CupertinoTextField(maxLength: 5, inputFormatters: formatters),
) ),
); );
expect(formatters.isEmpty, isTrue); expect(formatters.isEmpty, isTrue);
...@@ -4677,8 +4678,7 @@ void main() { ...@@ -4677,8 +4678,7 @@ void main() {
}); });
}); });
testWidgets('disabled widget changes background color', testWidgets('disabled widget changes background color', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const CupertinoApp( const CupertinoApp(
home: Center( home: Center(
...@@ -4777,5 +4777,6 @@ void main() { ...@@ -4777,5 +4777,6 @@ void main() {
), ),
).color; ).color;
expect(disabledColor, isSameColorAs(const Color(0xFFFAFAFA))); expect(disabledColor, isSameColorAs(const Color(0xFFFAFAFA)));
}); },
);
} }
...@@ -9,8 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -9,8 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Passes textAlign to underlying CupertinoTextField', testWidgets('Passes textAlign to underlying CupertinoTextField', (WidgetTester tester) async {
(WidgetTester tester) async {
const TextAlign alignment = TextAlign.center; const TextAlign alignment = TextAlign.center;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -30,8 +29,7 @@ void main() { ...@@ -30,8 +29,7 @@ void main() {
expect(textFieldWidget.textAlign, alignment); expect(textFieldWidget.textAlign, alignment);
}); });
testWidgets('Passes scrollPhysics to underlying TextField', testWidgets('Passes scrollPhysics to underlying TextField', (WidgetTester tester) async {
(WidgetTester tester) async {
const ScrollPhysics scrollPhysics = ScrollPhysics(); const ScrollPhysics scrollPhysics = ScrollPhysics();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -51,8 +49,7 @@ void main() { ...@@ -51,8 +49,7 @@ void main() {
expect(textFieldWidget.scrollPhysics, scrollPhysics); expect(textFieldWidget.scrollPhysics, scrollPhysics);
}); });
testWidgets('Passes textAlignVertical to underlying CupertinoTextField', testWidgets('Passes textAlignVertical to underlying CupertinoTextField', (WidgetTester tester) async {
(WidgetTester tester) async {
const TextAlignVertical textAlignVertical = TextAlignVertical.bottom; const TextAlignVertical textAlignVertical = TextAlignVertical.bottom;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -72,8 +69,7 @@ void main() { ...@@ -72,8 +69,7 @@ void main() {
expect(textFieldWidget.textAlignVertical, textAlignVertical); expect(textFieldWidget.textAlignVertical, textAlignVertical);
}); });
testWidgets('Passes textInputAction to underlying CupertinoTextField', testWidgets('Passes textInputAction to underlying CupertinoTextField', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -91,8 +87,7 @@ void main() { ...@@ -91,8 +87,7 @@ void main() {
expect(textFieldWidget.textInputAction, TextInputAction.next); expect(textFieldWidget.textInputAction, TextInputAction.next);
}); });
testWidgets('Passes onEditingComplete to underlying CupertinoTextField', testWidgets('Passes onEditingComplete to underlying CupertinoTextField', (WidgetTester tester) async {
(WidgetTester tester) async {
void onEditingComplete() {} void onEditingComplete() {}
await tester.pumpWidget( await tester.pumpWidget(
...@@ -112,8 +107,7 @@ void main() { ...@@ -112,8 +107,7 @@ void main() {
expect(textFieldWidget.onEditingComplete, onEditingComplete); expect(textFieldWidget.onEditingComplete, onEditingComplete);
}); });
testWidgets('Passes cursor attributes to underlying CupertinoTextField', testWidgets('Passes cursor attributes to underlying CupertinoTextField', (WidgetTester tester) async {
(WidgetTester tester) async {
const double cursorWidth = 3.14; const double cursorWidth = 3.14;
const double cursorHeight = 6.28; const double cursorHeight = 6.28;
const Radius cursorRadius = Radius.circular(2); const Radius cursorRadius = Radius.circular(2);
...@@ -141,8 +135,7 @@ void main() { ...@@ -141,8 +135,7 @@ void main() {
expect(textFieldWidget.cursorColor, cursorColor); expect(textFieldWidget.cursorColor, cursorColor);
}); });
testWidgets('onFieldSubmit callbacks are called', testWidgets('onFieldSubmit callbacks are called', (WidgetTester tester) async {
(WidgetTester tester) async {
bool _called = false; bool _called = false;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -183,8 +176,7 @@ void main() { ...@@ -183,8 +176,7 @@ void main() {
expect(_value, 'Soup'); expect(_value, 'Soup');
}); });
testWidgets('autovalidateMode is passed to super', testWidgets('autovalidateMode is passed to super', (WidgetTester tester) async {
(WidgetTester tester) async {
int _validateCalled = 0; int _validateCalled = 0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -207,8 +199,7 @@ void main() { ...@@ -207,8 +199,7 @@ void main() {
expect(_validateCalled, 2); expect(_validateCalled, 2);
}); });
testWidgets('validate is called if widget is enabled', testWidgets('validate is called if widget is enabled', (WidgetTester tester) async {
(WidgetTester tester) async {
int _validateCalled = 0; int _validateCalled = 0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -232,8 +223,7 @@ void main() { ...@@ -232,8 +223,7 @@ void main() {
expect(_validateCalled, 2); expect(_validateCalled, 2);
}); });
testWidgets('readonly text form field will hide cursor by default', testWidgets('readonly text form field will hide cursor by default', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -300,8 +290,7 @@ void main() { ...@@ -300,8 +290,7 @@ void main() {
}); });
// Regression test for https://github.com/flutter/flutter/issues/54472. // Regression test for https://github.com/flutter/flutter/issues/54472.
testWidgets('reset resets the text fields value to the initialValue', testWidgets('reset resets the text fields value to the initialValue', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(CupertinoApp(
home: Center( home: Center(
child: CupertinoTextFormFieldRow( child: CupertinoTextFormFieldRow(
...@@ -310,11 +299,9 @@ void main() { ...@@ -310,11 +299,9 @@ void main() {
), ),
)); ));
await tester.enterText( await tester.enterText(find.byType(CupertinoTextFormFieldRow), 'changedValue');
find.byType(CupertinoTextFormFieldRow), 'changedValue');
final FormFieldState<String> state = tester final FormFieldState<String> state = tester.state<FormFieldState<String>>(find.byType(CupertinoTextFormFieldRow));
.state<FormFieldState<String>>(find.byType(CupertinoTextFormFieldRow));
state.reset(); state.reset();
expect(find.text('changedValue'), findsNothing); expect(find.text('changedValue'), findsNothing);
...@@ -322,8 +309,7 @@ void main() { ...@@ -322,8 +309,7 @@ void main() {
}); });
// Regression test for https://github.com/flutter/flutter/issues/54472. // Regression test for https://github.com/flutter/flutter/issues/54472.
testWidgets('didChange changes text fields value', testWidgets('didChange changes text fields value', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(CupertinoApp(
home: Center( home: Center(
child: CupertinoTextFormFieldRow( child: CupertinoTextFormFieldRow(
...@@ -342,8 +328,7 @@ void main() { ...@@ -342,8 +328,7 @@ void main() {
expect(find.text('changedValue'), findsOneWidget); expect(find.text('changedValue'), findsOneWidget);
}); });
testWidgets('onChanged callbacks value and FormFieldState.value are sync', testWidgets('onChanged callbacks value and FormFieldState.value are sync', (WidgetTester tester) async {
(WidgetTester tester) async {
bool _called = false; bool _called = false;
late FormFieldState<String> state; late FormFieldState<String> state;
...@@ -382,12 +367,10 @@ void main() { ...@@ -382,12 +367,10 @@ void main() {
final CupertinoTextField widget = final CupertinoTextField widget =
tester.widget(find.byType(CupertinoTextField)); tester.widget(find.byType(CupertinoTextField));
expect(widget.autofillHints, expect(widget.autofillHints, equals(const <String>[AutofillHints.countryName]));
equals(const <String>[AutofillHints.countryName]));
}); });
testWidgets('autovalidateMode is passed to super', testWidgets('autovalidateMode is passed to super', (WidgetTester tester) async {
(WidgetTester tester) async {
int _validateCalled = 0; int _validateCalled = 0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -410,8 +393,7 @@ void main() { ...@@ -410,8 +393,7 @@ void main() {
expect(_validateCalled, 1); expect(_validateCalled, 1);
}); });
testWidgets('AutovalidateMode.always mode shows error from the start', testWidgets('AutovalidateMode.always mode shows error from the start', (WidgetTester tester) async {
(WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
home: Center( home: Center(
...@@ -431,8 +413,7 @@ void main() { ...@@ -431,8 +413,7 @@ void main() {
expect(errorText.data, 'Error'); expect(errorText.data, 'Error');
}); });
testWidgets('Shows error text upon invalid input', testWidgets('Shows error text upon invalid input', (WidgetTester tester) async {
(WidgetTester tester) async {
final TextEditingController controller = TextEditingController(text: ''); final TextEditingController controller = TextEditingController(text: '');
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -175,7 +175,8 @@ void main() { ...@@ -175,7 +175,8 @@ void main() {
expect( expect(
setEquals( setEquals(
description, description,
<String>{ 'brightness', <String>{
'brightness',
'primaryColor', 'primaryColor',
'primaryContrastingColor', 'primaryContrastingColor',
'barBackgroundColor', 'barBackgroundColor',
...@@ -188,7 +189,7 @@ void main() { ...@@ -188,7 +189,7 @@ void main() {
'navActionTextStyle', 'navActionTextStyle',
'pickerTextStyle', 'pickerTextStyle',
'dateTimePickerTextStyle', 'dateTimePickerTextStyle',
} },
), ),
isTrue, isTrue,
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment