From d36d5ae35d49f3a3fa03899d9d98c631b459b270 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Fri, 23 Apr 2021 04:39:02 +0200 Subject: [PATCH] add missing trailing commas (#80995) --- .../flutter/test/painting/alignment_test.dart | 18 ++-- .../beveled_rectangle_border_test.dart | 2 +- .../flutter/test/painting/binding_test.dart | 7 +- .../test/painting/border_rtl_test.dart | 2 +- .../test/painting/box_painter_test.dart | 6 +- .../flutter/test/painting/colors_test.dart | 11 ++- .../continuous_rectangle_border_test.dart | 2 +- .../test/painting/decoration_test.dart | 19 +++-- .../test/painting/edge_insets_test.dart | 30 ++++--- .../test/painting/flutter_logo_test.dart | 2 +- .../flutter/test/painting/gradient_test.dart | 2 +- .../painting/image_cache_clearing_test.dart | 2 +- .../image_provider_resize_image_test.dart | 6 +- .../test/painting/image_resolution_test.dart | 40 ++++----- .../test/painting/mocks_for_image_cache.dart | 2 +- .../rounded_rectangle_border_test.dart | 42 ++++++---- .../test/painting/stadium_border_test.dart | 84 ++++++++++++------- .../flutter/test/painting/text_span_test.dart | 8 +- .../flutter/test/physics/newton_test.dart | 58 +++++++++---- .../test/scheduler/benchmarks_test.dart | 46 +++++----- .../test/semantics/semantics_test.dart | 31 +++---- .../test/semantics/semantics_update_test.dart | 2 +- 22 files changed, 252 insertions(+), 170 deletions(-) diff --git a/packages/flutter/test/painting/alignment_test.dart b/packages/flutter/test/painting/alignment_test.dart index ed1c7525e9..b12e9c4e23 100644 --- a/packages/flutter/test/painting/alignment_test.dart +++ b/packages/flutter/test/painting/alignment_test.dart @@ -94,12 +94,18 @@ void main() { expect(AlignmentDirectional.bottomEnd.resolve(TextDirection.rtl), Alignment.bottomLeft); expect(AlignmentDirectional(nonconst(1.0), 2.0), AlignmentDirectional(nonconst(1.0), 2.0)); expect(const AlignmentDirectional(1.0, 2.0), isNot(const AlignmentDirectional(2.0, 1.0))); - expect(AlignmentDirectional.centerStart.resolve(TextDirection.ltr), - AlignmentDirectional.centerEnd.resolve(TextDirection.rtl)); - expect(AlignmentDirectional.centerStart.resolve(TextDirection.ltr), - isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr))); - expect(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr), - isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.rtl))); + expect( + AlignmentDirectional.centerStart.resolve(TextDirection.ltr), + AlignmentDirectional.centerEnd.resolve(TextDirection.rtl), + ); + expect( + AlignmentDirectional.centerStart.resolve(TextDirection.ltr), + isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.ltr)), + ); + expect( + AlignmentDirectional.centerEnd.resolve(TextDirection.ltr), + isNot(AlignmentDirectional.centerEnd.resolve(TextDirection.rtl)), + ); }); test('AlignmentGeometry.lerp ad hoc tests', () { diff --git a/packages/flutter/test/painting/beveled_rectangle_border_test.dart b/packages/flutter/test/painting/beveled_rectangle_border_test.dart index 2413c35d6a..a8fdcb971d 100644 --- a/packages/flutter/test/painting/beveled_rectangle_border_test.dart +++ b/packages/flutter/test/painting/beveled_rectangle_border_test.dart @@ -68,7 +68,7 @@ void main() { excludes: const [ Offset(10.0, 20.0), Offset(30.0, 40.0) ], ); const BeveledRectangleBorder border = BeveledRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(5.0)) + borderRadius: BorderRadius.all(Radius.circular(5.0)), ); expect(border.getOuterPath(rect), looksLikeRect); expect(border.getInnerPath(rect), looksLikeRect); diff --git a/packages/flutter/test/painting/binding_test.dart b/packages/flutter/test/painting/binding_test.dart index a72dbc8a06..3c3f0fa918 100644 --- a/packages/flutter/test/painting/binding_test.dart +++ b/packages/flutter/test/painting/binding_test.dart @@ -19,13 +19,12 @@ Future main() async { Future.value(ImageInfo( image: image, scale: 1.0, - ), - ))); + )), + )); await tester.idle(); expect(imageCache!.currentSize, 1); - final ByteData message = const JSONMessageCodec().encodeMessage( - {'type': 'memoryPressure'})!; + final ByteData message = const JSONMessageCodec().encodeMessage({'type': 'memoryPressure'})!; await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/system', message, (_) { }); expect(imageCache!.currentSize, 0); }); diff --git a/packages/flutter/test/painting/border_rtl_test.dart b/packages/flutter/test/painting/border_rtl_test.dart index 5cd0711a72..fac5316db5 100644 --- a/packages/flutter/test/painting/border_rtl_test.dart +++ b/packages/flutter/test/painting/border_rtl_test.dart @@ -145,7 +145,7 @@ void main() { ' However, only Border and BorderDirectional classes are supported\n' ' by this method.\n' ' For a more general interpolation method, consider using\n' - ' ShapeBorder.lerp instead.\n' + ' ShapeBorder.lerp instead.\n', )); }); diff --git a/packages/flutter/test/painting/box_painter_test.dart b/packages/flutter/test/painting/box_painter_test.dart index a448b4dc95..74ef5c8c0d 100644 --- a/packages/flutter/test/painting/box_painter_test.dart +++ b/packages/flutter/test/painting/box_painter_test.dart @@ -101,11 +101,9 @@ void main() { final BoxShadow shadow4 = BoxShadow.lerp(shadow2, shadow3, 0.5)!; expect(shadow4.blurRadius, equals(2.0)); - List shadowList = BoxShadow.lerpList( - [shadow2, shadow1], [shadow3], 0.5)!; + List shadowList = BoxShadow.lerpList([shadow2, shadow1], [shadow3], 0.5)!; expect(shadowList, equals([shadow4, shadow1.scale(0.5)])); - shadowList = BoxShadow.lerpList( - [shadow2], [shadow3, shadow1], 0.5)!; + shadowList = BoxShadow.lerpList([shadow2], [shadow3, shadow1], 0.5)!; expect(shadowList, equals([shadow4, shadow1.scale(0.5)])); }); diff --git a/packages/flutter/test/painting/colors_test.dart b/packages/flutter/test/painting/colors_test.dart index abeda3663a..82c01274c7 100644 --- a/packages/flutter/test/painting/colors_test.dart +++ b/packages/flutter/test/painting/colors_test.dart @@ -447,12 +447,11 @@ void main() { }; const MaterialColor first = MaterialColor(0, sampleMap); const MaterialColor second = MaterialColor(0, sampleMap); - const MaterialColor third = MaterialColor( - 0, { - 0: Colors.lightBlue, - 1: Colors.deepOrange, - 2: Colors.blueGrey, - }); + const MaterialColor third = MaterialColor(0, { + 0: Colors.lightBlue, + 1: Colors.deepOrange, + 2: Colors.blueGrey, + }); expect(first == second, true); expect(first == third, true); }); diff --git a/packages/flutter/test/painting/continuous_rectangle_border_test.dart b/packages/flutter/test/painting/continuous_rectangle_border_test.dart index 3838916610..37be39a7da 100644 --- a/packages/flutter/test/painting/continuous_rectangle_border_test.dart +++ b/packages/flutter/test/painting/continuous_rectangle_border_test.dart @@ -67,7 +67,7 @@ void main() { excludes: const [ Offset(10.0, 20.0), Offset(30.0, 40.0) ], ); const ContinuousRectangleBorder border = ContinuousRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(5.0)) + borderRadius: BorderRadius.all(Radius.circular(5.0)), ); expect(border.getOuterPath(rect), looksLikeRect); expect(border.getInnerPath(rect), looksLikeRect); diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart index d62d0b7377..f4aa35460f 100644 --- a/packages/flutter/test/painting/decoration_test.dart +++ b/packages/flutter/test/painting/decoration_test.dart @@ -37,7 +37,7 @@ class SynchronousTestImageProvider extends ImageProvider { @override ImageStreamCompleter load(int key, DecoderCallback decode) { return OneFrameImageStreamCompleter( - SynchronousFuture(TestImageInfo(key, image: image, scale: 1.0)) + SynchronousFuture(TestImageInfo(key, image: image, scale: 1.0)), ); } } @@ -71,7 +71,7 @@ class AsyncTestImageProvider extends ImageProvider { @override ImageStreamCompleter load(int key, DecoderCallback decode) { return OneFrameImageStreamCompleter( - Future.value(TestImageInfo(key, image: image)) + Future.value(TestImageInfo(key, image: image)), ); } } @@ -254,7 +254,7 @@ void main() { final TestCanvas canvas = TestCanvas(); const ImageConfiguration imageConfiguration = ImageConfiguration( - size: Size(100.0, 100.0) + size: Size(100.0, 100.0), ); bool onChangedCalled = false; final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { @@ -327,8 +327,7 @@ void main() { image: SynchronousTestImageProvider(image), matchTextDirection: true, ); - final BoxDecoration boxDecoration = BoxDecoration( - image: backgroundImage); + final BoxDecoration boxDecoration = BoxDecoration(image: backgroundImage); final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { assert(false); }); @@ -336,7 +335,9 @@ void main() { late FlutterError error; try { boxPainter.paint(canvas, Offset.zero, const ImageConfiguration( - size: Size(100.0, 100.0), textDirection: null)); + size: Size(100.0, 100.0), + textDirection: null, + )); } on FlutterError catch (e) { error = e; } @@ -354,7 +355,7 @@ void main() { ' DecorationImage(SynchronousTestImageProvider(),\n' ' Alignment.center, match text direction, scale: 1.0)\n' ' The ImageConfiguration was:\n' - ' ImageConfiguration(size: Size(100.0, 100.0))\n' + ' ImageConfiguration(size: Size(100.0, 100.0))\n', ); }, skip: kIsWeb); @@ -364,7 +365,7 @@ void main() { image: const SynchronousErrorTestImageProvider('threw'), onError: (dynamic error, StackTrace? stackTrace) { exception = error as String; - } + }, ); backgroundImage.createPainter(() { }).paint( @@ -662,7 +663,7 @@ void main() { final DecorationImage backgroundImage = DecorationImage( image: SynchronousTestImageProvider(image), scale: 4, - alignment: Alignment.topLeft + alignment: Alignment.topLeft, ); final BoxDecoration boxDecoration = BoxDecoration(image: backgroundImage); diff --git a/packages/flutter/test/painting/edge_insets_test.dart b/packages/flutter/test/painting/edge_insets_test.dart index 95223974c5..525ac56691 100644 --- a/packages/flutter/test/painting/edge_insets_test.dart +++ b/packages/flutter/test/painting/edge_insets_test.dart @@ -23,11 +23,15 @@ void main() { expect(insets.along(Axis.horizontal), equals(16.0)); expect(insets.along(Axis.vertical), equals(20.0)); - expect(insets.inflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), - const Rect.fromLTRB(18.0, 25.0, 135.0, 156.0)); + expect( + insets.inflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), + const Rect.fromLTRB(18.0, 25.0, 135.0, 156.0), + ); - expect(insets.deflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), - const Rect.fromLTRB(28.0, 39.0, 113.0, 130.0)); + expect( + insets.deflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)), + const Rect.fromLTRB(28.0, 39.0, 113.0, 130.0), + ); expect(insets.inflateSize(const Size(100.0, 125.0)), const Size(116.0, 145.0)); expect(insets.deflateSize(const Size(100.0, 125.0)), const Size(84.0, 105.0)); @@ -66,12 +70,18 @@ void main() { expect(const EdgeInsetsDirectional.only(bottom: 963.25).resolve(TextDirection.rtl), const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 963.25)); expect(EdgeInsetsDirectional.only(), EdgeInsetsDirectional.only()); // ignore: prefer_const_constructors expect(const EdgeInsetsDirectional.only(top: 1.0), isNot(const EdgeInsetsDirectional.only(bottom: 1.0))); - expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), - const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.rtl)); - expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), - isNot(const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.ltr))); - expect(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), - isNot(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.rtl))); + expect( + const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), + const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.rtl), + ); + expect( + const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), + isNot(const EdgeInsetsDirectional.fromSTEB(30.0, 20.0, 10.0, 40.0).resolve(TextDirection.ltr)), + ); + expect( + const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.ltr), + isNot(const EdgeInsetsDirectional.fromSTEB(10.0, 20.0, 30.0, 40.0).resolve(TextDirection.rtl)), + ); }); test('EdgeInsets equality', () { diff --git a/packages/flutter/test/painting/flutter_logo_test.dart b/packages/flutter/test/painting/flutter_logo_test.dart index ca91dab0ad..ae210b6851 100644 --- a/packages/flutter/test/painting/flutter_logo_test.dart +++ b/packages/flutter/test/painting/flutter_logo_test.dart @@ -63,7 +63,7 @@ void main() { expect( start.toString(), equals( - 'FlutterLogoDecoration(textColor: Color(0xffd4f144), style: stacked)' + 'FlutterLogoDecoration(textColor: Color(0xffd4f144), style: stacked)', ), ); expect( diff --git a/packages/flutter/test/painting/gradient_test.dart b/packages/flutter/test/painting/gradient_test.dart index 5f41dcb0f3..ef40c5c65d 100644 --- a/packages/flutter/test/painting/gradient_test.dart +++ b/packages/flutter/test/painting/gradient_test.dart @@ -801,7 +801,7 @@ void main() { child: RepaintBoundary( key: painterKey, child: CustomPaint( - painter: GradientPainter(shader, rect) + painter: GradientPainter(shader, rect), ), ), ), diff --git a/packages/flutter/test/painting/image_cache_clearing_test.dart b/packages/flutter/test/painting/image_cache_clearing_test.dart index d640351a43..95561d276a 100644 --- a/packages/flutter/test/painting/image_cache_clearing_test.dart +++ b/packages/flutter/test/painting/image_cache_clearing_test.dart @@ -23,7 +23,7 @@ void main() { stream.addListener(ImageStreamListener( (ImageInfo image, bool synchronousCall) { completer.complete(); - } + }, )); imageCache!.clearLiveImages(); await completer.future; diff --git a/packages/flutter/test/painting/image_provider_resize_image_test.dart b/packages/flutter/test/painting/image_provider_resize_image_test.dart index 07223f2409..ea1a413a30 100644 --- a/packages/flutter/test/painting/image_provider_resize_image_test.dart +++ b/packages/flutter/test/painting/image_provider_resize_image_test.dart @@ -136,8 +136,10 @@ void main() { }); } -Future _resolveAndGetSize(ImageProvider imageProvider, - {ImageConfiguration configuration = ImageConfiguration.empty}) async { +Future _resolveAndGetSize( + ImageProvider imageProvider, { + ImageConfiguration configuration = ImageConfiguration.empty, +}) async { final ImageStream stream = imageProvider.resolve(configuration); final Completer completer = Completer(); final ImageStreamListener listener = diff --git a/packages/flutter/test/painting/image_resolution_test.dart b/packages/flutter/test/painting/image_resolution_test.dart index 0921f53561..df80f773fa 100644 --- a/packages/flutter/test/painting/image_resolution_test.dart +++ b/packages/flutter/test/painting/image_resolution_test.dart @@ -24,8 +24,7 @@ class TestAssetBundle extends CachingAssetBundle { @override Future load(String key) async { if (key == 'AssetManifest.json') - return ByteData.view(Uint8List.fromList( - const Utf8Encoder().convert(_assetBundleContents)).buffer); + return ByteData.view(Uint8List.fromList(const Utf8Encoder().convert(_assetBundleContents)).buffer); loadCallCount[key] = loadCallCount[key] ?? 0 + 1; if (key == 'one') @@ -43,8 +42,9 @@ void main() { assetBundleMap[mainAssetPath] = []; final AssetImage assetImage = AssetImage( - mainAssetPath, - bundle: TestAssetBundle(assetBundleMap)); + mainAssetPath, + bundle: TestAssetBundle(assetBundleMap), + ); const ImageConfiguration configuration = ImageConfiguration.empty; assetImage.obtainKey(configuration) @@ -90,12 +90,12 @@ void main() { assetBundleMap[mainAssetPath] = [mainAssetPath, variantPath]; - final TestAssetBundle testAssetBundle = TestAssetBundle( - assetBundleMap); + final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap); final AssetImage assetImage = AssetImage( - mainAssetPath, - bundle: testAssetBundle); + mainAssetPath, + bundle: testAssetBundle, + ); // we have the exact match for this scale, let's use it assetImage.obtainKey(ImageConfiguration.empty) @@ -122,12 +122,12 @@ void main() { assetBundleMap[mainAssetPath] = [mainAssetPath]; - final TestAssetBundle testAssetBundle = TestAssetBundle( - assetBundleMap); + final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap); final AssetImage assetImage = AssetImage( - mainAssetPath, - bundle: TestAssetBundle(assetBundleMap)); + mainAssetPath, + bundle: TestAssetBundle(assetBundleMap), + ); assetImage.obtainKey(ImageConfiguration.empty) @@ -138,8 +138,8 @@ void main() { assetImage.obtainKey(ImageConfiguration( bundle: testAssetBundle, - devicePixelRatio: 3.0), - ).then(expectAsync1((AssetBundleImageKey bundleKey) { + devicePixelRatio: 3.0, + )).then(expectAsync1((AssetBundleImageKey bundleKey) { expect(bundleKey.name, mainAssetPath); expect(bundleKey.scale, 1.0); })); @@ -161,18 +161,18 @@ void main() { assetBundleMap[mainAssetPath] = [mainAssetPath, variantPath]; - final TestAssetBundle testAssetBundle = TestAssetBundle( - assetBundleMap); + final TestAssetBundle testAssetBundle = TestAssetBundle(assetBundleMap); final AssetImage assetImage = AssetImage( - mainAssetPath, - bundle: testAssetBundle); + mainAssetPath, + bundle: testAssetBundle, + ); // we have 1.0 and 3.0, asking for 1.5 should give assetImage.obtainKey(ImageConfiguration( bundle: testAssetBundle, - devicePixelRatio: deviceRatio), - ).then(expectAsync1((AssetBundleImageKey bundleKey) { + devicePixelRatio: deviceRatio, + )).then(expectAsync1((AssetBundleImageKey bundleKey) { expect(bundleKey.name, expectedAssetPath); expect(bundleKey.scale, chosenAssetRatio); })); diff --git a/packages/flutter/test/painting/mocks_for_image_cache.dart b/packages/flutter/test/painting/mocks_for_image_cache.dart index 7049951419..475789e563 100644 --- a/packages/flutter/test/painting/mocks_for_image_cache.dart +++ b/packages/flutter/test/painting/mocks_for_image_cache.dart @@ -75,7 +75,7 @@ class TestImageProvider extends ImageProvider { @override ImageStreamCompleter load(int key, DecoderCallback decode) { return OneFrameImageStreamCompleter( - SynchronousFuture(TestImageInfo(imageValue, image: image.clone())) + SynchronousFuture(TestImageInfo(imageValue, image: image.clone())), ); } diff --git a/packages/flutter/test/painting/rounded_rectangle_border_test.dart b/packages/flutter/test/painting/rounded_rectangle_border_test.dart index 252923a999..37f95c40f9 100644 --- a/packages/flutter/test/painting/rounded_rectangle_border_test.dart +++ b/packages/flutter/test/painting/rounded_rectangle_border_test.dart @@ -55,8 +55,10 @@ void main() { const RoundedRectangleBorder directional = RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.only(topStart: Radius.circular(20)), ); - expect(ShapeBorder.lerp(directional, c10, 1.0), - ShapeBorder.lerp(c10, directional, 0.0)); + expect( + ShapeBorder.lerp(directional, c10, 1.0), + ShapeBorder.lerp(c10, directional, 0.0), + ); }); test('RoundedRectangleBorder and CircleBorder', () { @@ -86,19 +88,31 @@ void main() { expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.1)!.getOuterPath(rect), looksLikeC); expect(ShapeBorder.lerp(c, ShapeBorder.lerp(r, c, 0.1), 0.9)!.getOuterPath(rect), looksLikeR); - expect(ShapeBorder.lerp(r, c, 0.1).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(r, c, 0.2).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.9), 0.9).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)'); + expect( + ShapeBorder.lerp(r, c, 0.1).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(r, c, 0.2).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.9), 0.9).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)', + ); - expect(ShapeBorder.lerp(c, r, 0.9).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(c, r, 0.8).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.9), ShapeBorder.lerp(r, c, 0.1), 0.1).toString(), - 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)'); + expect( + ShapeBorder.lerp(c, r, 0.9).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 10.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(c, r, 0.8).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 20.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(r, c, 0.9), ShapeBorder.lerp(r, c, 0.1), 0.1).toString(), + 'RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(10.0), 82.0% of the way to being a CircleBorder)', + ); expect(ShapeBorder.lerp(r, c, 0.1), ShapeBorder.lerp(r, c, 0.1)); expect(ShapeBorder.lerp(r, c, 0.1).hashCode, ShapeBorder.lerp(r, c, 0.1).hashCode); diff --git a/packages/flutter/test/painting/stadium_border_test.dart b/packages/flutter/test/painting/stadium_border_test.dart index 276d48e4d4..496db9bfd7 100644 --- a/packages/flutter/test/painting/stadium_border_test.dart +++ b/packages/flutter/test/painting/stadium_border_test.dart @@ -74,19 +74,31 @@ void main() { expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.1)!.getOuterPath(rect), looksLikeC); expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.9)!.getOuterPath(rect), looksLikeS); - expect(ShapeBorder.lerp(stadium, circle, 0.1).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(stadium, circle, 0.2).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)'); + expect( + ShapeBorder.lerp(stadium, circle, 0.1).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(stadium, circle, 0.2).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)', + ); - expect(ShapeBorder.lerp(circle, stadium, 0.9).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(circle, stadium, 0.8).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), ShapeBorder.lerp(stadium, circle, 0.1), 0.1).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)'); + expect( + ShapeBorder.lerp(circle, stadium, 0.9).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 10.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(circle, stadium, 0.8).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 20.0% of the way to being a CircleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), ShapeBorder.lerp(stadium, circle, 0.1), 0.1).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), 82.0% of the way to being a CircleBorder)', + ); expect(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.1)); expect(ShapeBorder.lerp(stadium, circle, 0.1).hashCode, ShapeBorder.lerp(stadium, circle, 0.1).hashCode); @@ -141,25 +153,37 @@ void main() { expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect), looksLikeS); expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect), looksLikeS); - expect(ShapeBorder.lerp(stadium, rrect, 0.1).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)'); - expect(ShapeBorder.lerp(stadium, rrect, 0.2).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)'); + expect( + ShapeBorder.lerp(stadium, rrect, 0.1).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)', + ); + expect( + ShapeBorder.lerp(stadium, rrect, 0.2).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)', + ); - expect(ShapeBorder.lerp(rrect, stadium, 0.9).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)'); - expect(ShapeBorder.lerp(rrect, stadium, 0.8).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)'); - expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(), - 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' - 'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)'); + expect( + ShapeBorder.lerp(rrect, stadium, 0.9).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)', + ); + expect( + ShapeBorder.lerp(rrect, stadium, 0.8).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)', + ); + expect( + ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(), + 'StadiumBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), ' + 'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)', + ); expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1)); expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode); diff --git a/packages/flutter/test/painting/text_span_test.dart b/packages/flutter/test/painting/text_span_test.dart index 1485b6cfe8..c43fd8da56 100644 --- a/packages/flutter/test/painting/text_span_test.dart +++ b/packages/flutter/test/painting/text_span_test.dart @@ -72,7 +72,7 @@ void main() { ' TextSpan:\n' ' (empty)\n' ' TextSpan:\n' - ' "c"\n' + ' "c"\n', )); }); @@ -82,7 +82,7 @@ void main() { ); expect(test1.toStringDeep(), equals( 'TextSpan:\n' - ' "a"\n' + ' "a"\n', )); final TextSpan test2 = TextSpan( @@ -95,7 +95,7 @@ void main() { 'TextSpan:\n' ' "a"\n' ' callbacks: enter, exit\n' - ' mouseCursor: SystemMouseCursor(forbidden)\n' + ' mouseCursor: SystemMouseCursor(forbidden)\n', )); }); @@ -335,7 +335,7 @@ void main() { }, onExit: (PointerExitEvent event) { logEvents.add(event); - } + }, ), const TextSpan( text: 'xxxxx', diff --git a/packages/flutter/test/physics/newton_test.dart b/packages/flutter/test/physics/newton_test.dart index 9336f18507..34556213e4 100644 --- a/packages/flutter/test/physics/newton_test.dart +++ b/packages/flutter/test/physics/newton_test.dart @@ -43,8 +43,7 @@ void main() { // Verify that the "through" FrictionSimulation ends up at // endPosition and endVelocity; implies that it computed the right // value for _drag. - FrictionSimulation friction = FrictionSimulation.through( - startPosition, endPosition, startVelocity, endVelocity); + FrictionSimulation friction = FrictionSimulation.through(startPosition, endPosition, startVelocity, endVelocity); expect(friction.isDone(0.0), false); expect(friction.x(0.0), 10.0); expect(friction.dx(0.0), 600.0); @@ -63,8 +62,7 @@ void main() { expect(endPosition, lessThan(startPosition)); expect(endVelocity, greaterThan(startVelocity)); - friction = FrictionSimulation.through( - startPosition, endPosition, startVelocity, endVelocity); + friction = FrictionSimulation.through(startPosition, endPosition, startVelocity, endVelocity); expect(friction.isDone(1.0 + precisionErrorTolerance), true); expect(friction.x(1.0), moreOrLessEquals(endPosition)); expect(friction.dx(1.0), moreOrLessEquals(endVelocity)); @@ -116,31 +114,47 @@ void main() { test('spring_types', () { SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0), 0.0, 300.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ), 0.0, 300.0, 0.0); expect(crit.type, SpringType.criticallyDamped); crit = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 1.0), 0.0, 300.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 1.0, + ), 0.0, 300.0, 0.0); expect(crit.type, SpringType.criticallyDamped); final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 0.75), 0.0, 300.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 0.75, + ), 0.0, 300.0, 0.0); expect(under.type, SpringType.underDamped); final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 1.25), 0.0, 300.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 1.25, + ), 0.0, 300.0, 0.0); expect(over.type, SpringType.overDamped); // Just so we don't forget how to create a desc without the ratio. - final SpringSimulation other = SpringSimulation( - const SpringDescription(mass: 1.0, stiffness: 100.0, damping: 20.0), - 0.0, 20.0, 20.0); + final SpringSimulation other = SpringSimulation(const SpringDescription( + mass: 1.0, + stiffness: 100.0, + damping: 20.0, + ), 0.0, 20.0, 20.0); expect(other.type, SpringType.criticallyDamped); }); test('crit_spring', () { final SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 1.0), 0.0, 500.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 1.0, + ), 0.0, 500.0, 0.0); crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); @@ -165,7 +179,10 @@ void main() { test('overdamped_spring', () { final SpringSimulation over = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 1.25), 0.0, 500.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 1.25, + ), 0.0, 500.0, 0.0); over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); @@ -187,7 +204,10 @@ void main() { test('underdamped_spring', () { final SpringSimulation under = SpringSimulation(SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 100.0, ratio: 0.25), 0.0, 300.0, 0.0); + mass: 1.0, + stiffness: 100.0, + ratio: 0.25, + ), 0.0, 300.0, 0.0); expect(under.type, SpringType.underDamped); expect(under.isDone(0.0), false); @@ -204,7 +224,10 @@ void main() { test('test_kinetic_scroll', () { final SpringDescription spring = SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 50.0, ratio: 0.5); + mass: 1.0, + stiffness: 50.0, + ratio: 0.5, + ); final BouncingScrollSimulation scroll = BouncingScrollSimulation( position: 100.0, @@ -233,7 +256,10 @@ void main() { test('scroll_with_inf_edge_ends', () { final SpringDescription spring = SpringDescription.withDampingRatio( - mass: 1.0, stiffness: 50.0, ratio: 0.5); + mass: 1.0, + stiffness: 50.0, + ratio: 0.5, + ); final BouncingScrollSimulation scroll = BouncingScrollSimulation( position: 100.0, diff --git a/packages/flutter/test/scheduler/benchmarks_test.dart b/packages/flutter/test/scheduler/benchmarks_test.dart index 903fb0dbae..eb8823479a 100644 --- a/packages/flutter/test/scheduler/benchmarks_test.dart +++ b/packages/flutter/test/scheduler/benchmarks_test.dart @@ -39,34 +39,36 @@ void main() { }); test('test pumpBenchmark() only runs one frame', () async { - await benchmarkWidgets((WidgetTester tester) async { - const Key root = Key('root'); - binding.attachRootWidget(Container(key: root)); - await tester.pump(); + await benchmarkWidgets( + (WidgetTester tester) async { + const Key root = Key('root'); + binding.attachRootWidget(Container(key: root)); + await tester.pump(); - expect(binding.framesBegun, greaterThan(0)); - expect(binding.framesDrawn, greaterThan(0)); + expect(binding.framesBegun, greaterThan(0)); + expect(binding.framesDrawn, greaterThan(0)); - final Element appState = tester.element(find.byKey(root)); - binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.benchmark; + final Element appState = tester.element(find.byKey(root)); + binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.benchmark; - final int startFramesBegun = binding.framesBegun; - final int startFramesDrawn = binding.framesDrawn; - expect(startFramesBegun, equals(startFramesDrawn)); + final int startFramesBegun = binding.framesBegun; + final int startFramesDrawn = binding.framesDrawn; + expect(startFramesBegun, equals(startFramesDrawn)); - appState.markNeedsBuild(); + appState.markNeedsBuild(); - await tester.pumpBenchmark(const Duration(milliseconds: 16)); + await tester.pumpBenchmark(const Duration(milliseconds: 16)); - final int endFramesBegun = binding.framesBegun; - final int endFramesDrawn = binding.framesDrawn; - expect(endFramesBegun, equals(endFramesDrawn)); + final int endFramesBegun = binding.framesBegun; + final int endFramesDrawn = binding.framesDrawn; + expect(endFramesBegun, equals(endFramesDrawn)); - expect(endFramesBegun, equals(startFramesBegun + 1)); - expect(endFramesDrawn, equals(startFramesDrawn + 1)); - }, - // We are not interested in the performance of the "benchmark", we are just - // testing the behavior. So it's OK that asserts are enabled. - mayRunWithAsserts: true); + expect(endFramesBegun, equals(startFramesBegun + 1)); + expect(endFramesDrawn, equals(startFramesDrawn + 1)); + }, + // We are not interested in the performance of the "benchmark", we are just + // testing the behavior. So it's OK that asserts are enabled. + mayRunWithAsserts: true, + ); }, skip: isBrowser); } diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart index dce2aa459e..60066e6895 100644 --- a/packages/flutter/test/semantics/semantics_test.dart +++ b/packages/flutter/test/semantics/semantics_test.dart @@ -82,9 +82,10 @@ void main() { childrenInInversePaintOrder: children, ); - children.add(SemanticsNode() - ..isMergedIntoParent = true - ..rect = const Rect.fromLTRB(42.0, 42.0, 10.0, 10.0) + children.add( + SemanticsNode() + ..isMergedIntoParent = true + ..rect = const Rect.fromLTRB(42.0, 42.0, 10.0, 10.0), ); { @@ -101,7 +102,7 @@ void main() { 'Failed to replace child semantics nodes because the list of `SemanticsNode`s was mutated.\n' 'Instead of mutating the existing list, create a new list containing the desired `SemanticsNode`s.\n' 'Error details:\n' - "The list's length has changed from 1 to 2." + "The list's length has changed from 1 to 2.", )); expect( error.diagnostics.singleWhere((DiagnosticsNode node) => node.level == DiagnosticLevel.hint).toString(), @@ -150,7 +151,7 @@ void main() { '\n' ' Child node at position 1 was replaced:\n' ' Previous child: SemanticsNode#7(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(40.0, 14.0, 20.0, 20.0))\n' - ' New child: SemanticsNode#5(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0))\n' + ' New child: SemanticsNode#5(STALE, owner: null, merged up ⬆️, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0))\n', )); expect( @@ -489,16 +490,16 @@ void main() { expect( allProperties.toStringDeep(), equalsIgnoringHashCodes( - 'SemanticsNode#2\n' - ' STALE\n' - ' owner: null\n' - ' merge boundary ⛔️\n' - ' Rect.fromLTRB(60.0, 20.0, 80.0, 50.0)\n' - ' actions: longPress, scrollUp, showOnScreen\n' - ' flags: hasCheckedState, isSelected, isButton\n' - ' label: "Use all the properties"\n' - ' textDirection: rtl\n' - ' sortKey: OrdinalSortKey#19df5(order: 1.0)\n' + 'SemanticsNode#2\n' + ' STALE\n' + ' owner: null\n' + ' merge boundary ⛔️\n' + ' Rect.fromLTRB(60.0, 20.0, 80.0, 50.0)\n' + ' actions: longPress, scrollUp, showOnScreen\n' + ' flags: hasCheckedState, isSelected, isButton\n' + ' label: "Use all the properties"\n' + ' textDirection: rtl\n' + ' sortKey: OrdinalSortKey#19df5(order: 1.0)\n', ), ); expect( diff --git a/packages/flutter/test/semantics/semantics_update_test.dart b/packages/flutter/test/semantics/semantics_update_test.dart index fa912e2547..a9a706247a 100644 --- a/packages/flutter/test/semantics/semantics_update_test.dart +++ b/packages/flutter/test/semantics/semantics_update_test.dart @@ -18,7 +18,7 @@ void main() { const Placeholder(), // Stops right after the warm up frame. null, - EnginePhase.build + EnginePhase.build, ); // The warm up frame will send update for an empty semantics tree. We // ignore this one time update.