From 64fe22a3e20877bcb3881c51d978f8af61b366f9 Mon Sep 17 00:00:00 2001 From: n7484443j Date: Sat, 6 Jul 2024 17:51:16 +0900 Subject: [PATCH] style: correct dart format --- lib/src/widgets/others/delegate.dart | 3 +- test/bug_fix_test.dart | 222 +++++++++++++-------------- 2 files changed, 113 insertions(+), 112 deletions(-) diff --git a/lib/src/widgets/others/delegate.dart b/lib/src/widgets/others/delegate.dart index d6f848cb..64ccd21b 100644 --- a/lib/src/widgets/others/delegate.dart +++ b/lib/src/widgets/others/delegate.dart @@ -324,7 +324,8 @@ class EditorTextSelectionGestureDetectorBuilder { /// * [EditorTextSelectionGestureDetector.onDragSelectionUpdate], /// which triggers this callback./lib/src/material/text_field.dart @protected - void onDragSelectionUpdate(//DragStartDetails startDetails, + void onDragSelectionUpdate( + //DragStartDetails startDetails, DragUpdateDetails updateDetails) { renderEditor!.extendSelection( updateDetails.globalPosition, diff --git a/test/bug_fix_test.dart b/test/bug_fix_test.dart index f2db66e0..0be8a1e0 100644 --- a/test/bug_fix_test.dart +++ b/test/bug_fix_test.dart @@ -8,51 +8,51 @@ void main() { group('Bug fix', () { group( '1266 - QuillToolbar.basic() custom buttons do not have correct fill' - 'color set', () { + 'color set', () { testWidgets('fillColor of custom buttons and builtin buttons match', - (tester) async { - const tooltip = 'custom button'; - - final controller = QuillController.basic(); - - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: QuillSimpleToolbar( - configurations: QuillSimpleToolbarConfigurations( - controller: controller, - showRedo: false, - customButtons: const [ - QuillToolbarCustomButtonOptions( - tooltip: tooltip, - ) - ], - ), - ), + (tester) async { + const tooltip = 'custom button'; + + final controller = QuillController.basic(); + + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: QuillSimpleToolbar( + configurations: QuillSimpleToolbarConfigurations( + controller: controller, + showRedo: false, + customButtons: const [ + QuillToolbarCustomButtonOptions( + tooltip: tooltip, + ) + ], ), ), - ); - - final builtinFinder = find.descendant( - of: find.byType(QuillToolbarHistoryButton), - matching: find.byType(QuillToolbarIconButton), - matchRoot: true, - ); - expect(builtinFinder, findsOneWidget); - // final builtinButton = - // builtinFinder.evaluate().first.widget as QuillToolbarIconButton; - - final customFinder = find.descendant( - of: find.byType(QuillToolbar), - matching: find.byWidgetPredicate((widget) => + ), + ), + ); + + final builtinFinder = find.descendant( + of: find.byType(QuillToolbarHistoryButton), + matching: find.byType(QuillToolbarIconButton), + matchRoot: true, + ); + expect(builtinFinder, findsOneWidget); + // final builtinButton = + // builtinFinder.evaluate().first.widget as QuillToolbarIconButton; + + final customFinder = find.descendant( + of: find.byType(QuillToolbar), + matching: find.byWidgetPredicate((widget) => widget is QuillToolbarIconButton && widget.tooltip == tooltip), - matchRoot: true); - expect(customFinder, findsOneWidget); - // final customButton = - // customFinder.evaluate().first.widget as QuillToolbarIconButton; + matchRoot: true); + expect(customFinder, findsOneWidget); + // final customButton = + // customFinder.evaluate().first.widget as QuillToolbarIconButton; - // expect(customButton.fillColor, equals(builtinButton.fillColor)); - }); + // expect(customButton.fillColor, equals(builtinButton.fillColor)); + }); }); group('1189 - The provided text position is not in the current node', () { @@ -75,41 +75,41 @@ void main() { }); testWidgets('Refocus editor after controller clears document', - (tester) async { - await tester.pumpWidget( - MaterialApp( - home: Column( - children: [editor], - ), - ), - ); - await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: Column( + children: [editor], + ), + ), + ); + await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); - editor.focusNode.unfocus(); - await tester.pump(); - controller.clear(); - editor.focusNode.requestFocus(); - await tester.pump(); - expect(tester.takeException(), isNull); - }); + editor.focusNode.unfocus(); + await tester.pump(); + controller.clear(); + editor.focusNode.requestFocus(); + await tester.pump(); + expect(tester.takeException(), isNull); + }); testWidgets('Refocus editor after removing block attribute', - (tester) async { - await tester.pumpWidget(MaterialApp( - home: Column( - children: [editor], - ), - )); - await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); - - controller.formatSelection(Attribute.ul); - editor.focusNode.unfocus(); - await tester.pump(); - controller.formatSelection(const ListAttribute(null)); - editor.focusNode.requestFocus(); - await tester.pump(); - expect(tester.takeException(), isNull); - }); + (tester) async { + await tester.pumpWidget(MaterialApp( + home: Column( + children: [editor], + ), + )); + await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); + + controller.formatSelection(Attribute.ul); + editor.focusNode.unfocus(); + await tester.pump(); + controller.formatSelection(const ListAttribute(null)); + editor.focusNode.requestFocus(); + await tester.pump(); + expect(tester.takeException(), isNull); + }); testWidgets('Tap checkbox in unfocused editor', (tester) async { await tester.pumpWidget( @@ -144,46 +144,46 @@ void main() { for (final device in [PointerDeviceKind.mouse, PointerDeviceKind.touch]) { testWidgets( '1742 - Disable context menu after selection for desktop platform $device', - (tester) async { - await tester.pumpWidget( - MaterialApp( - home: QuillEditor( - focusNode: FocusNode(), - scrollController: ScrollController(), - // ignore: avoid_redundant_argument_values - configurations: QuillEditorConfigurations( - controller: controller, - // ignore: avoid_redundant_argument_values - autoFocus: true, - expands: true, - ), - ), + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: QuillEditor( + focusNode: FocusNode(), + scrollController: ScrollController(), + // ignore: avoid_redundant_argument_values + configurations: QuillEditorConfigurations( + controller: controller, + // ignore: avoid_redundant_argument_values + autoFocus: true, + expands: true, ), - ); - if (device == PointerDeviceKind.mouse) { - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - // Long press to show menu - await tester.longPress(find.byType(QuillEditor), kind: device); - await tester.pumpAndSettle(); - - // Verify custom widget not shows - expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); - - await tester.tap(find.byType(QuillEditor), - buttons: kSecondaryButton, kind: device); - await tester.pumpAndSettle(); - - // Verify custom widget shows - expect(find.byType(AdaptiveTextSelectionToolbar), findsAny); - } else { - // Long press to show menu - await tester.longPress(find.byType(QuillEditor), kind: device); - await tester.pumpAndSettle(); - - // Verify custom widget shows - expect(find.byType(AdaptiveTextSelectionToolbar), findsAny); - } - }); + ), + ), + ); + if (device == PointerDeviceKind.mouse) { + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + // Long press to show menu + await tester.longPress(find.byType(QuillEditor), kind: device); + await tester.pumpAndSettle(); + + // Verify custom widget not shows + expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); + + await tester.tap(find.byType(QuillEditor), + buttons: kSecondaryButton, kind: device); + await tester.pumpAndSettle(); + + // Verify custom widget shows + expect(find.byType(AdaptiveTextSelectionToolbar), findsAny); + } else { + // Long press to show menu + await tester.longPress(find.byType(QuillEditor), kind: device); + await tester.pumpAndSettle(); + + // Verify custom widget shows + expect(find.byType(AdaptiveTextSelectionToolbar), findsAny); + } + }); } }); }