From c78c913343793278a3521a89c3888bcdac5a01e8 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Fri, 23 Apr 2021 21:00:42 +0200 Subject: [PATCH] add missing trailing commas (#81042) --- .../flutter/test/services/autofill_test.dart | 6 +- .../flutter/test/services/binding_test.dart | 12 +- .../default_binary_messenger_test.dart | 12 +- .../test/services/keyboard_key_test.dart | 83 +++++------ .../test/services/message_codecs_test.dart | 39 ++--- .../test/services/message_codecs_testing.dart | 3 +- .../test/services/message_codecs_vm_test.dart | 3 +- .../test/services/platform_views_test.dart | 133 +++++++++++------- .../test/services/raw_keyboard_test.dart | 17 +-- .../services/restoration_bucket_test.dart | 2 +- .../test/services/restoration_test.dart | 4 +- .../test/services/system_chrome_test.dart | 4 +- .../test/services/text_formatter_test.dart | 20 ++- .../test/services/text_input_test.dart | 57 +++----- 14 files changed, 210 insertions(+), 185 deletions(-) diff --git a/packages/flutter/test/services/autofill_test.dart b/packages/flutter/test/services/autofill_test.dart index 0febeea415..428f6c74fe 100644 --- a/packages/flutter/test/services/autofill_test.dart +++ b/packages/flutter/test/services/autofill_test.dart @@ -88,7 +88,8 @@ void main() { )); expect(client2.currentTextEditingValue, text2); - }); + }, + ); }); } @@ -212,7 +213,8 @@ class FakeTextChannel implements MethodChannel { print( 'Index $i did not match:\n' ' actual: ${outgoingCalls[i]}\n' - ' expected: ${calls[i]}'); + ' expected: ${calls[i]}', + ); hasError = true; } } diff --git a/packages/flutter/test/services/binding_test.dart b/packages/flutter/test/services/binding_test.dart index ae28fd190c..0fae7f8ed6 100644 --- a/packages/flutter/test/services/binding_test.dart +++ b/packages/flutter/test/services/binding_test.dart @@ -56,11 +56,15 @@ void main() { final List licenses = await LicenseRegistry.licenses.toList(); expect(licenses[0].packages, equals(['L1Package1', 'L1Package2', 'L1Package3'])); - expect(licenses[0].paragraphs.map((LicenseParagraph p) => p.text), - equals(['L1Paragraph1', 'L1Paragraph2', 'L1Paragraph3'])); + expect( + licenses[0].paragraphs.map((LicenseParagraph p) => p.text), + equals(['L1Paragraph1', 'L1Paragraph2', 'L1Paragraph3']), + ); expect(licenses[1].packages, equals(['L2Package1', 'L2Package2', 'L2Package3'])); - expect(licenses[1].paragraphs.map((LicenseParagraph p) => p.text), - equals(['L2Paragraph1', 'L2Paragraph2', 'L2Paragraph3'])); + expect( + licenses[1].paragraphs.map((LicenseParagraph p) => p.text), + equals(['L2Paragraph1', 'L2Paragraph2', 'L2Paragraph3']), + ); }); } diff --git a/packages/flutter/test/services/default_binary_messenger_test.dart b/packages/flutter/test/services/default_binary_messenger_test.dart index e90ecfb4aa..e6a768d486 100644 --- a/packages/flutter/test/services/default_binary_messenger_test.dart +++ b/packages/flutter/test/services/default_binary_messenger_test.dart @@ -22,12 +22,14 @@ void main() { int count = 0; const String channel = 'foo'; ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage( - channel, _makeByteData('bar'), (ByteData? message) async { - count += 1; - }); + channel, + _makeByteData('bar'), + (ByteData? message) async { + count += 1; + }, + ); expect(count, equals(0)); - await ui.channelBuffers.drain(channel, - (ByteData? data, ui.PlatformMessageResponseCallback callback) async { + await ui.channelBuffers.drain(channel, (ByteData? data, ui.PlatformMessageResponseCallback callback) async { callback(null); }); expect(count, equals(1)); diff --git a/packages/flutter/test/services/keyboard_key_test.dart b/packages/flutter/test/services/keyboard_key_test.dart index 94f1cd3b9f..daca18f1f1 100644 --- a/packages/flutter/test/services/keyboard_key_test.dart +++ b/packages/flutter/test/services/keyboard_key_test.dart @@ -61,48 +61,51 @@ void main() { test('Synonyms get collapsed properly.', () async { expect(LogicalKeyboardKey.collapseSynonyms({}), isEmpty); expect( - LogicalKeyboardKey.collapseSynonyms({ - LogicalKeyboardKey.shiftLeft, - LogicalKeyboardKey.controlLeft, - LogicalKeyboardKey.altLeft, - LogicalKeyboardKey.metaLeft, - }), - equals({ - LogicalKeyboardKey.shift, - LogicalKeyboardKey.control, - LogicalKeyboardKey.alt, - LogicalKeyboardKey.meta, - })); + LogicalKeyboardKey.collapseSynonyms({ + LogicalKeyboardKey.shiftLeft, + LogicalKeyboardKey.controlLeft, + LogicalKeyboardKey.altLeft, + LogicalKeyboardKey.metaLeft, + }), + equals({ + LogicalKeyboardKey.shift, + LogicalKeyboardKey.control, + LogicalKeyboardKey.alt, + LogicalKeyboardKey.meta, + }), + ); expect( - LogicalKeyboardKey.collapseSynonyms({ - LogicalKeyboardKey.shiftRight, - LogicalKeyboardKey.controlRight, - LogicalKeyboardKey.altRight, - LogicalKeyboardKey.metaRight, - }), - equals({ - LogicalKeyboardKey.shift, - LogicalKeyboardKey.control, - LogicalKeyboardKey.alt, - LogicalKeyboardKey.meta, - })); + LogicalKeyboardKey.collapseSynonyms({ + LogicalKeyboardKey.shiftRight, + LogicalKeyboardKey.controlRight, + LogicalKeyboardKey.altRight, + LogicalKeyboardKey.metaRight, + }), + equals({ + LogicalKeyboardKey.shift, + LogicalKeyboardKey.control, + LogicalKeyboardKey.alt, + LogicalKeyboardKey.meta, + }), + ); expect( - LogicalKeyboardKey.collapseSynonyms({ - LogicalKeyboardKey.shiftLeft, - LogicalKeyboardKey.controlLeft, - LogicalKeyboardKey.altLeft, - LogicalKeyboardKey.metaLeft, - LogicalKeyboardKey.shiftRight, - LogicalKeyboardKey.controlRight, - LogicalKeyboardKey.altRight, - LogicalKeyboardKey.metaRight, - }), - equals({ - LogicalKeyboardKey.shift, - LogicalKeyboardKey.control, - LogicalKeyboardKey.alt, - LogicalKeyboardKey.meta, - })); + LogicalKeyboardKey.collapseSynonyms({ + LogicalKeyboardKey.shiftLeft, + LogicalKeyboardKey.controlLeft, + LogicalKeyboardKey.altLeft, + LogicalKeyboardKey.metaLeft, + LogicalKeyboardKey.shiftRight, + LogicalKeyboardKey.controlRight, + LogicalKeyboardKey.altRight, + LogicalKeyboardKey.metaRight, + }), + equals({ + LogicalKeyboardKey.shift, + LogicalKeyboardKey.control, + LogicalKeyboardKey.alt, + LogicalKeyboardKey.meta, + }), + ); }); test('Values are equal', () async { expect(LogicalKeyboardKey.keyA == LogicalKeyboardKey(LogicalKeyboardKey.keyA.keyId), true); diff --git a/packages/flutter/test/services/message_codecs_test.dart b/packages/flutter/test/services/message_codecs_test.dart index 01b5376ffe..d81d840de0 100644 --- a/packages/flutter/test/services/message_codecs_test.dart +++ b/packages/flutter/test/services/message_codecs_test.dart @@ -54,11 +54,14 @@ void main() { details: 'errorDetails', ); expect( - () => method.decodeEnvelope(errorData), - throwsA(predicate((PlatformException e) => + () => method.decodeEnvelope(errorData), + throwsA(predicate( + (PlatformException e) => e.code == 'errorCode' && e.message == 'errorMessage' && - e.details == 'errorDetails'))); + e.details == 'errorDetails', + )), + ); }); test('should decode error envelope with native stacktrace.', () { final WriteBuffer buffer = WriteBuffer(); @@ -69,9 +72,9 @@ void main() { messageCodec.writeValue(buffer, 'errorStacktrace'); final ByteData errorData = buffer.done(); expect( - () => method.decodeEnvelope(errorData), - throwsA(predicate((PlatformException e) => - e.stacktrace == 'errorStacktrace'))); + () => method.decodeEnvelope(errorData), + throwsA(predicate((PlatformException e) => e.stacktrace == 'errorStacktrace')), + ); }); test('should allow null error message,', () { @@ -103,24 +106,26 @@ void main() { details: 'errorDetails', ); expect( - () => jsonMethodCodec.decodeEnvelope(errorData), - throwsA(predicate((PlatformException e) => - e.code == 'errorCode' && - e.message == 'errorMessage' && - e.details == 'errorDetails'))); + () => jsonMethodCodec.decodeEnvelope(errorData), + throwsA(predicate( + (PlatformException e) => + e.code == 'errorCode' && + e.message == 'errorMessage' && + e.details == 'errorDetails', + )), + ); }); test('should decode error envelope with native stacktrace.', () { - final ByteData? errorData = stringCodec.encodeMessage(json - .encode([ + final ByteData? errorData = stringCodec.encodeMessage(json.encode([ 'errorCode', 'errorMessage', 'errorDetails', - 'errorStacktrace' + 'errorStacktrace', ])); expect( - () => jsonMethodCodec.decodeEnvelope(errorData!), - throwsA(predicate((PlatformException e) => - e.stacktrace == 'errorStacktrace'))); + () => jsonMethodCodec.decodeEnvelope(errorData!), + throwsA(predicate((PlatformException e) => e.stacktrace == 'errorStacktrace')), + ); }); }); group('JSON message codec', () { diff --git a/packages/flutter/test/services/message_codecs_testing.dart b/packages/flutter/test/services/message_codecs_testing.dart index 927542d22d..c612b3d4fc 100644 --- a/packages/flutter/test/services/message_codecs_testing.dart +++ b/packages/flutter/test/services/message_codecs_testing.dart @@ -46,8 +46,7 @@ bool deepEquals(dynamic valueA, dynamic valueB) { bool deepEqualsTypedData(TypedData valueA, TypedData valueB) { if (valueA is ByteData) { return valueB is ByteData - && deepEqualsList( - valueA.buffer.asUint8List(), valueB.buffer.asUint8List()); + && deepEqualsList(valueA.buffer.asUint8List(), valueB.buffer.asUint8List()); } if (valueA is Uint8List) return valueB is Uint8List && deepEqualsList(valueA, valueB); diff --git a/packages/flutter/test/services/message_codecs_vm_test.dart b/packages/flutter/test/services/message_codecs_vm_test.dart index 946a0b33b8..fa240b0f3e 100644 --- a/packages/flutter/test/services/message_codecs_vm_test.dart +++ b/packages/flutter/test/services/message_codecs_vm_test.dart @@ -74,8 +74,7 @@ void main() { test('should encode and decode a list containing big numbers', () { final List message = [ -7000000000000000007, - Int64List.fromList( - [-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]), + Int64List.fromList([-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]), ]; checkEncodeDecode(standard, message); }); diff --git a/packages/flutter/test/services/platform_views_test.dart b/packages/flutter/test/services/platform_views_test.dart index c7a35070ed..993f4f2fd1 100644 --- a/packages/flutter/test/services/platform_views_test.dart +++ b/packages/flutter/test/services/platform_views_test.dart @@ -49,12 +49,13 @@ void main() { .setSize(const Size(200.0, 300.0)); await PlatformViewsService.initSurfaceAndroidView(id: 2, viewType: 'webview', layoutDirection: TextDirection.rtl).create(); expect( - viewsController.views, - unorderedEquals([ - const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), - const FakeAndroidPlatformView(1, 'webview', Size(200.0, 300.0), AndroidViewController.kAndroidLayoutDirectionRtl, null), - const FakeAndroidPlatformView(2, 'webview', null, AndroidViewController.kAndroidLayoutDirectionRtl, true), - ])); + viewsController.views, + unorderedEquals([ + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), + const FakeAndroidPlatformView(1, 'webview', Size(200.0, 300.0), AndroidViewController.kAndroidLayoutDirectionRtl, null), + const FakeAndroidPlatformView(2, 'webview', null, AndroidViewController.kAndroidLayoutDirectionRtl, true), + ]), + ); }); test('reuse Android view id', () async { @@ -65,9 +66,13 @@ void main() { layoutDirection: TextDirection.ltr, ).setSize(const Size(100.0, 100.0)); expect( - () => PlatformViewsService.initAndroidView( - id: 0, viewType: 'web', layoutDirection: TextDirection.ltr).setSize(const Size(100.0, 100.0)), - throwsA(isA())); + () => PlatformViewsService.initAndroidView( + id: 0, + viewType: 'web', + layoutDirection: TextDirection.ltr, + ).setSize(const Size(100.0, 100.0)), + throwsA(isA()), + ); await PlatformViewsService.initSurfaceAndroidView( id: 1, @@ -75,15 +80,22 @@ void main() { layoutDirection: TextDirection.ltr, ).create(); expect( - () => PlatformViewsService.initSurfaceAndroidView( - id: 1, viewType: 'web', layoutDirection: TextDirection.ltr).create(), - throwsA(isA())); + () => PlatformViewsService.initSurfaceAndroidView( + id: 1, + viewType: 'web', + layoutDirection: TextDirection.ltr, + ).create(), + throwsA(isA()), + ); }); test('dispose Android view', () async { viewsController.registerViewType('webview'); await PlatformViewsService.initAndroidView( - id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr).setSize(const Size(100.0, 100.0)); + id: 0, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + ).setSize(const Size(100.0, 100.0)); final AndroidViewController viewController = PlatformViewsService.initAndroidView(id: 1, viewType: 'webview', layoutDirection: TextDirection.ltr); await viewController.setSize(const Size(200.0, 300.0)); @@ -94,16 +106,20 @@ void main() { await surfaceViewController.dispose(); expect( - viewsController.views, - unorderedEquals([ - const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), - ])); + viewsController.views, + unorderedEquals([ + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), + ]), + ); }); test('dispose inexisting Android view', () async { viewsController.registerViewType('webview'); await PlatformViewsService.initAndroidView( - id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr).setSize(const Size(100.0, 100.0)); + id: 0, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + ).setSize(const Size(100.0, 100.0)); final AndroidViewController viewController = PlatformViewsService.initAndroidView(id: 1, viewType: 'webview', layoutDirection: TextDirection.ltr); await viewController.setSize(const Size(200.0, 300.0)); @@ -115,10 +131,10 @@ void main() { bool didFocus = false; viewsController.registerViewType('webview'); final AndroidViewController viewController = PlatformViewsService.initAndroidView( - id: 0, - viewType: 'webview', - layoutDirection: TextDirection.ltr, - onFocus: () { didFocus = true; } + id: 0, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + onFocus: () { didFocus = true; }, ); await viewController.setSize(const Size(100.0, 100.0)); await viewController.dispose(); @@ -131,17 +147,21 @@ void main() { test('resize Android view', () async { viewsController.registerViewType('webview'); await PlatformViewsService.initAndroidView( - id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr).setSize(const Size(100.0, 100.0)); + id: 0, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + ).setSize(const Size(100.0, 100.0)); final AndroidViewController viewController = PlatformViewsService.initAndroidView(id: 1, viewType: 'webview', layoutDirection: TextDirection.ltr); await viewController.setSize(const Size(200.0, 300.0)); await viewController.setSize(const Size(500.0, 500.0)); expect( - viewsController.views, - unorderedEquals([ - const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), - const FakeAndroidPlatformView(1, 'webview', Size(500.0, 500.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), - ])); + viewsController.views, + unorderedEquals([ + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), + const FakeAndroidPlatformView(1, 'webview', Size(500.0, 500.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), + ]), + ); }); test('OnPlatformViewCreated callback', () async { @@ -178,10 +198,11 @@ void main() { await viewController.setLayoutDirection(TextDirection.ltr); await viewController.setSize(const Size(100.0, 100.0)); expect( - viewsController.views, - unorderedEquals([ - const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), - ])); + viewsController.views, + unorderedEquals([ + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr, null), + ]), + ); }); test("change Android view's directionality after creation", () async { @@ -191,10 +212,11 @@ void main() { await viewController.setSize(const Size(100.0, 100.0)); await viewController.setLayoutDirection(TextDirection.rtl); expect( - viewsController.views, - unorderedEquals([ - const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionRtl, null), - ])); + viewsController.views, + unorderedEquals([ + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionRtl, null), + ]), + ); }); }); @@ -219,10 +241,8 @@ void main() { test('create iOS views', () async { viewsController.registerViewType('webview'); - await PlatformViewsService.initUiKitView( - id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr); - await PlatformViewsService.initUiKitView( - id: 1, viewType: 'webview', layoutDirection: TextDirection.rtl); + await PlatformViewsService.initUiKitView(id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr); + await PlatformViewsService.initUiKitView(id: 1, viewType: 'webview', layoutDirection: TextDirection.rtl); expect( viewsController.views, unorderedEquals([ @@ -240,38 +260,43 @@ void main() { layoutDirection: TextDirection.ltr, ); expect( - () => PlatformViewsService.initUiKitView( - id: 0, viewType: 'web', layoutDirection: TextDirection.ltr), + () => PlatformViewsService.initUiKitView(id: 0, viewType: 'web', layoutDirection: TextDirection.ltr), throwsA(isA()), ); }); test('dispose iOS view', () async { viewsController.registerViewType('webview'); - await PlatformViewsService.initUiKitView( - id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr); + await PlatformViewsService.initUiKitView(id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr); final UiKitViewController viewController = await PlatformViewsService.initUiKitView( - id: 1, viewType: 'webview', layoutDirection: TextDirection.ltr); + id: 1, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + ); viewController.dispose(); expect( - viewsController.views, - unorderedEquals([ - const FakeUiKitView(0, 'webview'), - ])); + viewsController.views, + unorderedEquals([ + const FakeUiKitView(0, 'webview'), + ]), + ); }); test('dispose inexisting iOS view', () async { viewsController.registerViewType('webview'); await PlatformViewsService.initUiKitView(id: 0, viewType: 'webview', layoutDirection: TextDirection.ltr); final UiKitViewController viewController = await PlatformViewsService.initUiKitView( - id: 1, viewType: 'webview', layoutDirection: TextDirection.ltr); + id: 1, + viewType: 'webview', + layoutDirection: TextDirection.ltr, + ); await viewController.dispose(); expect( - () async { - await viewController.dispose(); - }, - throwsA(isA()), + () async { + await viewController.dispose(); + }, + throwsA(isA()), ); }); }); diff --git a/packages/flutter/test/services/raw_keyboard_test.dart b/packages/flutter/test/services/raw_keyboard_test.dart index 0d935f6615..7f65991532 100644 --- a/packages/flutter/test/services/raw_keyboard_test.dart +++ b/packages/flutter/test/services/raw_keyboard_test.dart @@ -113,13 +113,14 @@ void main() { if (platform != 'linux' && platform != 'windows' && platform != 'ios') { await simulateKeyDownEvent(LogicalKeyboardKey.fn, platform: platform); expect( - RawKeyboard.instance.keysPressed, - equals( - { - if (platform != 'macos') LogicalKeyboardKey.fn, - }, - ), - reason: 'on $platform'); + RawKeyboard.instance.keysPressed, + equals( + { + if (platform != 'macos') LogicalKeyboardKey.fn, + }, + ), + reason: 'on $platform', + ); await simulateKeyDownEvent(LogicalKeyboardKey.f12, platform: platform); expect( RawKeyboard.instance.keysPressed, @@ -1539,7 +1540,7 @@ void main() { (ByteData? data) { final Map decoded = SystemChannels.keyEvent.codec.decodeMessage(data) as Map; lastHandled = decoded['handled'] as bool; - } + }, ); } RawKeyboard.instance.addListener(events.add); diff --git a/packages/flutter/test/services/restoration_bucket_test.dart b/packages/flutter/test/services/restoration_bucket_test.dart index f64883b59f..58ef32e16f 100644 --- a/packages/flutter/test/services/restoration_bucket_test.dart +++ b/packages/flutter/test/services/restoration_bucket_test.dart @@ -191,7 +191,7 @@ void main() { 'The following IDs were claimed multiple times from the parent RestorationBucket(restorationId: root, owner: MockManager):\n' ' * "child1" was claimed by:\n' ' * SecondClaim\n' - ' * FirstClaim (current owner)' + ' * FirstClaim (current owner)', ); } }); diff --git a/packages/flutter/test/services/restoration_test.dart b/packages/flutter/test/services/restoration_test.dart index 1fde21dc0f..2def380ec8 100644 --- a/packages/flutter/test/services/restoration_test.dart +++ b/packages/flutter/test/services/restoration_test.dart @@ -322,7 +322,7 @@ Map _createEncodedRestorationData1() { 'child1' : { valuesMapKey : { 'another value': 22, - } + }, }, }, }; @@ -338,7 +338,7 @@ Map _createEncodedRestorationData2() { 'childFoo' : { valuesMapKey : { 'bar': 'Hello', - } + }, }, }, }; diff --git a/packages/flutter/test/services/system_chrome_test.dart b/packages/flutter/test/services/system_chrome_test.dart index 900d919521..5356e4de2b 100644 --- a/packages/flutter/test/services/system_chrome_test.dart +++ b/packages/flutter/test/services/system_chrome_test.dart @@ -47,7 +47,7 @@ void main() { }); await SystemChrome.setApplicationSwitcherDescription( - const ApplicationSwitcherDescription(label: 'Example label', primaryColor: 0xFF00FF00) + const ApplicationSwitcherDescription(label: 'Example label', primaryColor: 0xFF00FF00), ); expect(log, hasLength(1)); @@ -65,7 +65,7 @@ void main() { }); await SystemChrome.setApplicationSwitcherDescription( - const ApplicationSwitcherDescription(label: 'Example label', primaryColor: 0xFF00FF00) + const ApplicationSwitcherDescription(label: 'Example label', primaryColor: 0xFF00FF00), ); expect(log, isNotEmpty); diff --git a/packages/flutter/test/services/text_formatter_test.dart b/packages/flutter/test/services/text_formatter_test.dart index afe02c148c..2385ad309b 100644 --- a/packages/flutter/test/services/text_formatter_test.dart +++ b/packages/flutter/test/services/text_formatter_test.dart @@ -22,7 +22,7 @@ void main() { calledOldValue = oldValue; calledNewValue = newValue; return TextEditingValue.empty; - } + }, ); formatterUnderTest.formatEditUpdate(testOldValue, testNewValue); @@ -416,7 +416,7 @@ void main() { LengthLimitingTextInputFormatter(maxLength); final TextEditingValue formatted = formatter.formatEditUpdate( oldValue, - newValue + newValue, ); expect(formatted.text, newValue.text); }); @@ -436,7 +436,7 @@ void main() { LengthLimitingTextInputFormatter(maxLength); final TextEditingValue formatted = formatter.formatEditUpdate( oldValue, - newValue + newValue, ); expect(formatted.text, oldValue.text); }); @@ -456,7 +456,7 @@ void main() { LengthLimitingTextInputFormatter(maxLength); final TextEditingValue formatted = formatter.formatEditUpdate( oldValue, - newValue + newValue, ); expect(formatted.text, 'bbbbbbbbbb'); }); @@ -575,8 +575,7 @@ void main() { final TextInputFormatter formatter = FilteringTextInputFormatter.digitsOnly; - TextEditingValue formatted = formatter.formatEditUpdate(oldValue, - newValue); + TextEditingValue formatted = formatter.formatEditUpdate(oldValue, newValue); // assert that we are passing digits only at the first time expect(oldValue.text, equals('123')); @@ -586,8 +585,7 @@ void main() { expect(formatted.selection.baseOffset, equals(6)); // move cursor at the middle of the text and then add the number 9. - oldValue = newValue.copyWith( - selection: const TextSelection.collapsed(offset: 4)); + oldValue = newValue.copyWith(selection: const TextSelection.collapsed(offset: 4)); newValue = oldValue.copyWith(text: '1239456'); formatted = formatter.formatEditUpdate(oldValue, newValue); @@ -608,8 +606,7 @@ void main() { final TextInputFormatter formatter = FilteringTextInputFormatter.digitsOnly; - TextEditingValue formatted = formatter.formatEditUpdate(oldValue, - newValue); + TextEditingValue formatted = formatter.formatEditUpdate(oldValue, newValue); // assert that we are passing digits only at the first time expect(oldValue.text, equals('123')); @@ -619,8 +616,7 @@ void main() { expect(formatted.selection.baseOffset, equals(6)); // move cursor at the middle of the text and then add the number 9. - oldValue = newValue.copyWith( - selection: const TextSelection.collapsed(offset: 4)); + oldValue = newValue.copyWith(selection: const TextSelection.collapsed(offset: 4)); newValue = oldValue.copyWith(text: '1239456'); formatted = formatter.formatEditUpdate(oldValue, newValue); diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart index 968f5ba7a8..7d03836808 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -61,16 +61,17 @@ void main() { MethodCall('TextInput.setClient', [1, client.configuration.toJson()]), // From requestExistingInputState const MethodCall( - 'TextInput.setEditingState', - { - 'text': '', - 'selectionBase': -1, - 'selectionExtent': -1, - 'selectionAffinity': 'TextAffinity.downstream', - 'selectionIsDirectional': false, - 'composingBase': -1, - 'composingExtent': -1, - }), + 'TextInput.setEditingState', + { + 'text': '', + 'selectionBase': -1, + 'selectionExtent': -1, + 'selectionAffinity': 'TextAffinity.downstream', + 'selectionIsDirectional': false, + 'composingBase': -1, + 'composingExtent': -1, + }, + ), ]); }); }); @@ -197,8 +198,7 @@ void main() { final ByteData? messageBytes = const JSONMessageCodec().encodeMessage({ 'args': [ 1, - jsonDecode( - '{"action": "actionCommand", "data": {"input_context" : "abcdefg"}}') + jsonDecode('{"action": "actionCommand", "data": {"input_context" : "abcdefg"}}'), ], 'method': 'TextInputClient.performPrivateCommand', }); @@ -211,8 +211,7 @@ void main() { expect(client.latestMethodCall, 'performPrivateCommand'); }); - test('TextInputClient performPrivateCommand method is called with float', - () async { + test('TextInputClient performPrivateCommand method is called with float', () async { // Assemble a TextInputConnection so we can verify its change in state. final FakeTextInputClient client = FakeTextInputClient(TextEditingValue.empty); const TextInputConfiguration configuration = TextInputConfiguration(); @@ -224,8 +223,7 @@ void main() { final ByteData? messageBytes = const JSONMessageCodec().encodeMessage({ 'args': [ 1, - jsonDecode( - '{"action": "actionCommand", "data": {"input_context" : 0.5}}') + jsonDecode('{"action": "actionCommand", "data": {"input_context" : 0.5}}'), ], 'method': 'TextInputClient.performPrivateCommand', }); @@ -238,9 +236,7 @@ void main() { expect(client.latestMethodCall, 'performPrivateCommand'); }); - test( - 'TextInputClient performPrivateCommand method is called with CharSequence array', - () async { + test('TextInputClient performPrivateCommand method is called with CharSequence array', () async { // Assemble a TextInputConnection so we can verify its change in state. final FakeTextInputClient client = FakeTextInputClient(TextEditingValue.empty); const TextInputConfiguration configuration = TextInputConfiguration(); @@ -252,8 +248,7 @@ void main() { final ByteData? messageBytes = const JSONMessageCodec().encodeMessage({ 'args': [ 1, - jsonDecode( - '{"action": "actionCommand", "data": {"input_context" : ["abc", "efg"]}}') + jsonDecode('{"action": "actionCommand", "data": {"input_context" : ["abc", "efg"]}}'), ], 'method': 'TextInputClient.performPrivateCommand', }); @@ -266,9 +261,7 @@ void main() { expect(client.latestMethodCall, 'performPrivateCommand'); }); - test( - 'TextInputClient performPrivateCommand method is called with CharSequence', - () async { + test('TextInputClient performPrivateCommand method is called with CharSequence', () async { // Assemble a TextInputConnection so we can verify its change in state. final FakeTextInputClient client = FakeTextInputClient(TextEditingValue.empty); const TextInputConfiguration configuration = TextInputConfiguration(); @@ -281,8 +274,7 @@ void main() { const JSONMessageCodec().encodeMessage({ 'args': [ 1, - jsonDecode( - '{"action": "actionCommand", "data": {"input_context" : "abc"}}') + jsonDecode('{"action": "actionCommand", "data": {"input_context" : "abc"}}'), ], 'method': 'TextInputClient.performPrivateCommand', }); @@ -295,9 +287,7 @@ void main() { expect(client.latestMethodCall, 'performPrivateCommand'); }); - test( - 'TextInputClient performPrivateCommand method is called with float array', - () async { + test('TextInputClient performPrivateCommand method is called with float array', () async { // Assemble a TextInputConnection so we can verify its change in state. final FakeTextInputClient client = FakeTextInputClient(TextEditingValue.empty); const TextInputConfiguration configuration = TextInputConfiguration(); @@ -310,8 +300,7 @@ void main() { const JSONMessageCodec().encodeMessage({ 'args': [ 1, - jsonDecode( - '{"action": "actionCommand", "data": {"input_context" : [0.5, 0.8]}}') + jsonDecode('{"action": "actionCommand", "data": {"input_context" : [0.5, 0.8]}}'), ], 'method': 'TextInputClient.performPrivateCommand', }); @@ -324,8 +313,7 @@ void main() { expect(client.latestMethodCall, 'performPrivateCommand'); }); - test('TextInputClient showAutocorrectionPromptRect method is called', - () async { + test('TextInputClient showAutocorrectionPromptRect method is called', () async { // Assemble a TextInputConnection so we can verify its change in state. final FakeTextInputClient client = FakeTextInputClient(TextEditingValue.empty); const TextInputConfiguration configuration = TextInputConfiguration(); @@ -477,7 +465,8 @@ class FakeTextChannel implements MethodChannel { print( 'Index $i did not match:\n' ' actual: $outgoingString\n' - ' expected: $expectedString'); + ' expected: $expectedString', + ); hasError = true; } }