From d5fbc3750e368eba8b166f8011814d129df50295 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 25 May 2022 09:38:09 -0700 Subject: [PATCH] Remove unused code from tests (#104550) --- .../test/foundation/platform_helper.dart | 18 ---- .../flutter/test/foundation/print_test.dart | 2 - .../flutter/test/gestures/arena_test.dart | 2 - .../test/gestures/long_press_test.dart | 17 ---- .../flutter/test/gestures/multitap_test.dart | 3 - packages/flutter/test/material/chip_test.dart | 2 - .../test/material/chip_theme_test.dart | 10 -- .../flutter/test/material/dropdown_test.dart | 29 ------ .../test/material/theme_defaults_test.dart | 3 - .../test/painting/image_stream_test.dart | 18 ---- .../flutter/test/rendering/editable_test.dart | 37 -------- .../test/widgets/custom_paint_test.dart | 15 --- .../layout_builder_and_parent_data_test.dart | 14 --- .../flutter/test/widgets/multichild_test.dart | 17 ---- .../route_notification_messages_test.dart | 7 -- .../flutter/test/widgets/routes_test.dart | 44 --------- .../widgets/scrollable_semantics_test.dart | 4 - .../test/widgets/selectable_region_test.dart | 92 ------------------- .../test/widgets/selectable_text_test.dart | 9 -- .../flutter/test/widgets/shortcuts_test.dart | 15 --- .../test/widgets/slivers_evil_test.dart | 15 --- .../test/widgets/text_selection_test.dart | 31 ------- .../test/widgets/widget_inspector_test.dart | 11 +-- 23 files changed, 4 insertions(+), 411 deletions(-) delete mode 100644 packages/flutter/test/foundation/platform_helper.dart diff --git a/packages/flutter/test/foundation/platform_helper.dart b/packages/flutter/test/foundation/platform_helper.dart deleted file mode 100644 index a30e882ea4d50..0000000000000 --- a/packages/flutter/test/foundation/platform_helper.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:io' show Platform; - -/// Returns [Platform.pathSeparator], suitably escaped so as to be usable in a -/// regular expression. -String get pathSeparatorForRegExp { - switch (Platform.pathSeparator) { - case r'/': - return r'/'; - case r'\': - return r'\\'; // because dividerRegExp gets inserted into regexps - default: - throw 'Unsupported platform.'; - } -} diff --git a/packages/flutter/test/foundation/print_test.dart b/packages/flutter/test/foundation/print_test.dart index 08691b77f05e9..412a92e74f0fa 100644 --- a/packages/flutter/test/foundation/print_test.dart +++ b/packages/flutter/test/foundation/print_test.dart @@ -8,8 +8,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'capture_output.dart'; -String? foo; - void main() { test('debugPrint', () { expect( diff --git a/packages/flutter/test/gestures/arena_test.dart b/packages/flutter/test/gestures/arena_test.dart index 9250e1506f14c..4206ac57fb970 100644 --- a/packages/flutter/test/gestures/arena_test.dart +++ b/packages/flutter/test/gestures/arena_test.dart @@ -5,8 +5,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter_test/flutter_test.dart'; -typedef GestureArenaCallback = void Function(Object key); - const int primaryKey = 4; class TestGestureArenaMember extends GestureArenaMember { diff --git a/packages/flutter/test/gestures/long_press_test.dart b/packages/flutter/test/gestures/long_press_test.dart index ceee4cc7028c7..70a40fb7ef3a3 100644 --- a/packages/flutter/test/gestures/long_press_test.dart +++ b/packages/flutter/test/gestures/long_press_test.dart @@ -41,23 +41,6 @@ const PointerDownEvent down3 = PointerDownEvent( buttons: kSecondaryButton, ); -const PointerUpEvent up3 = PointerUpEvent( - pointer: 7, - position: Offset(31, 29), -); - -// Down/up pair 4: tap sequence with tertiary button -const PointerDownEvent down4 = PointerDownEvent( - pointer: 8, - position: Offset(42, 24), - buttons: kTertiaryButton, -); - -const PointerUpEvent up4 = PointerUpEvent( - pointer: 8, - position: Offset(43, 23), -); - void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/gestures/multitap_test.dart b/packages/flutter/test/gestures/multitap_test.dart index 55f3947ad5d45..17987666e344e 100644 --- a/packages/flutter/test/gestures/multitap_test.dart +++ b/packages/flutter/test/gestures/multitap_test.dart @@ -7,9 +7,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'gesture_tester.dart'; -class TestDrag extends Drag { -} - void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 15c8416fe255b..d7d11e048187d 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -67,8 +67,6 @@ double getSelectProgress(WidgetTester tester) => getRenderChip(tester)?.checkmar double getAvatarDrawerProgress(WidgetTester tester) => getRenderChip(tester)?.avatarDrawerAnimation?.value as double; // ignore: avoid_dynamic_calls double getDeleteDrawerProgress(WidgetTester tester) => getRenderChip(tester)?.deleteDrawerAnimation?.value as double; -// ignore: avoid_dynamic_calls -double getEnableProgress(WidgetTester tester) => getRenderChip(tester)?.enableAnimation?.value as double; /// Adds the basic requirements for a Chip. Widget wrapForChip({ diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index 2722c8bc7223f..f267638f524ca 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -27,16 +27,6 @@ Material getMaterial(WidgetTester tester) { ); } -IconThemeData getIconData(WidgetTester tester) { - final IconTheme iconTheme = tester.firstWidget( - find.descendant( - of: find.byType(RawChip), - matching: find.byType(IconTheme), - ), - ); - return iconTheme.data; -} - DefaultTextStyle getLabelStyle(WidgetTester tester) { return tester.widget( find.descendant( diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart index a1f9cc36130a9..3a87c5ffe6d92 100644 --- a/packages/flutter/test/material/dropdown_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -252,29 +252,6 @@ void checkSelectedItemTextGeometry(WidgetTester tester, String value) { expect(box0.size, equals(box1.size)); } -void verifyPaintedShadow(Finder customPaint, int elevation) { - const Rect originalRectangle = Rect.fromLTRB(0.0, 0.0, 800, 208.0); - - final List boxShadows = List.generate(3, (int index) => kElevationToShadow[elevation]![index]); - final List rrects = List.generate(3, (int index) { - return RRect.fromRectAndRadius( - originalRectangle.shift( - boxShadows[index].offset, - ).inflate(boxShadows[index].spreadRadius), - const Radius.circular(2.0), - ); - }); - - expect( - customPaint, - paints - ..save() - ..rrect(rrect: rrects[0], color: boxShadows[0].color, hasMaskFilter: true) - ..rrect(rrect: rrects[1], color: boxShadows[1].color, hasMaskFilter: true) - ..rrect(rrect: rrects[2], color: boxShadows[2].color, hasMaskFilter: true), - ); -} - Future checkDropdownColor(WidgetTester tester, {Color? color, bool isFormField = false }) async { const String text = 'foo'; await tester.pumpWidget( @@ -325,12 +302,6 @@ Future checkDropdownColor(WidgetTester tester, {Color? color, bool isFormF ); } -bool sameGeometry(RenderBox box1, RenderBox box2) { - expect(box1.localToGlobal(Offset.zero), equals(box2.localToGlobal(Offset.zero))); - expect(box1.size.height, equals(box2.size.height)); - return true; -} - void main() { testWidgets('Default dropdown golden', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); diff --git a/packages/flutter/test/material/theme_defaults_test.dart b/packages/flutter/test/material/theme_defaults_test.dart index 445f3ebde9a9e..23d1e47383eeb 100644 --- a/packages/flutter/test/material/theme_defaults_test.dart +++ b/packages/flutter/test/material/theme_defaults_test.dart @@ -5,9 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -const ShapeBorder defaultButtonShape = RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(2.0))); -const EdgeInsets defaultButtonPadding = EdgeInsets.only(left: 16.0, right: 16.0); -const BoxConstraints defaultButtonConstraints = BoxConstraints(minWidth: 88.0, minHeight: 36.0); const Duration defaultButtonDuration = Duration(milliseconds: 200); void main() { diff --git a/packages/flutter/test/painting/image_stream_test.dart b/packages/flutter/test/painting/image_stream_test.dart index 4a2879470a478..a6771e1398bee 100644 --- a/packages/flutter/test/painting/image_stream_test.dart +++ b/packages/flutter/test/painting/image_stream_test.dart @@ -79,24 +79,6 @@ class FakeEventReportingImageStreamCompleter extends ImageStreamCompleter { } } -class SynchronousTestImageProvider extends ImageProvider { - const SynchronousTestImageProvider(this.image); - - final Image image; - - @override - Future obtainKey(ImageConfiguration configuration) { - return SynchronousFuture(1); - } - - @override - ImageStreamCompleter load(int key, DecoderCallback decode) { - return OneFrameImageStreamCompleter( - SynchronousFuture(TestImageInfo(key, image: image)), - ); - } -} - void main() { late Image image20x10; late Image image200x100; diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index f5f074a377068..2d802f7fbd609 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -13,11 +13,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:meta/meta.dart'; - -// The test_api package is not for general use... it's literally for our use. -// ignore: deprecated_member_use -import 'package:test_api/test_api.dart' as test_package; import 'mock_canvas.dart'; import 'recording_canvas.dart'; @@ -55,38 +50,6 @@ class _FakeEditableTextState with TextSelectionDelegate { void copySelection(SelectionChangedCause cause) { } } -@isTest -void testVariants( - String description, - AsyncValueGetter callback, { - bool? skip, - test_package.Timeout? timeout, - TestVariant variant = const DefaultTestVariant(), - dynamic tags, -}) { - assert(variant != null); - assert(variant.values.isNotEmpty, 'There must be at least one value to test in the testing variant.'); - for (final dynamic value in variant.values) { - final String variationDescription = variant.describeValue(value); - final String combinedDescription = variationDescription.isNotEmpty ? '$description ($variationDescription)' : description; - test( - combinedDescription, - () async { - Object? memento; - try { - memento = await variant.setUp(value); - await callback(); - } finally { - await variant.tearDown(value, memento); - } - }, - skip: skip, // [intended] just part of the API. - timeout: timeout, - tags: tags, - ); - } -} - void main() { TestRenderingFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/widgets/custom_paint_test.dart b/packages/flutter/test/widgets/custom_paint_test.dart index 151a7a99abef5..d177096c574a0 100644 --- a/packages/flutter/test/widgets/custom_paint_test.dart +++ b/packages/flutter/test/widgets/custom_paint_test.dart @@ -21,21 +21,6 @@ class TestCustomPainter extends CustomPainter { bool shouldRepaint(TestCustomPainter oldPainter) => true; } -class TestCustomPainterWithCustomSemanticsBuilder extends TestCustomPainter { - TestCustomPainterWithCustomSemanticsBuilder() : super(log: []); - - @override - SemanticsBuilderCallback get semanticsBuilder => (Size size) { - const Key key = Key('0'); - const Rect rect = Rect.zero; - const SemanticsProperties semanticsProperties = SemanticsProperties(); - return [ - const CustomPainterSemantics(key: key, rect: rect, properties: semanticsProperties), - const CustomPainterSemantics(key: key, rect: rect, properties: semanticsProperties), - ]; - }; -} - class MockCanvas extends Fake implements Canvas { int saveCount = 0; int saveCountDelta = 1; diff --git a/packages/flutter/test/widgets/layout_builder_and_parent_data_test.dart b/packages/flutter/test/widgets/layout_builder_and_parent_data_test.dart index 70f42972262b1..6388fa320e509 100644 --- a/packages/flutter/test/widgets/layout_builder_and_parent_data_test.dart +++ b/packages/flutter/test/widgets/layout_builder_and_parent_data_test.dart @@ -41,20 +41,6 @@ class SizeChangerState extends State { } } -class Wrapper extends StatelessWidget { - const Wrapper({ - super.key, - required this.child, - }); - - final Widget child; - - @override - Widget build(BuildContext context) { - return child; - } -} - void main() { testWidgets('Applying parent data inside a LayoutBuilder', (WidgetTester tester) async { int frame = 1; diff --git a/packages/flutter/test/widgets/multichild_test.dart b/packages/flutter/test/widgets/multichild_test.dart index a55070bb7cbf9..032b2d6fd4aa1 100644 --- a/packages/flutter/test/widgets/multichild_test.dart +++ b/packages/flutter/test/widgets/multichild_test.dart @@ -31,16 +31,6 @@ void checkTree(WidgetTester tester, List expectedDecorations) { } } -class MockMultiChildRenderObjectWidget extends MultiChildRenderObjectWidget { - MockMultiChildRenderObjectWidget({ super.key, required super.children }); - - @override - RenderObject createRenderObject(BuildContext context) { - assert(false); - return FakeRenderObject(); - } -} - void main() { testWidgets('MultiChildRenderObjectElement control test', (WidgetTester tester) async { @@ -357,13 +347,6 @@ void main() { }); } -class FakeRenderObject extends RenderBox { - @override - void performLayout() { - size = constraints.biggest; - } -} - class DummyWidget extends StatelessWidget { const DummyWidget({ super.key, required this.child }); diff --git a/packages/flutter/test/widgets/route_notification_messages_test.dart b/packages/flutter/test/widgets/route_notification_messages_test.dart index 89a1e7cb18189..1e8c4502a9f5f 100644 --- a/packages/flutter/test/widgets/route_notification_messages_test.dart +++ b/packages/flutter/test/widgets/route_notification_messages_test.dart @@ -29,13 +29,6 @@ class OnTapPage extends StatelessWidget { } } -Map convertRouteInformationToMap(RouteInformation routeInformation) { - return { - 'location': routeInformation.location, - 'state': routeInformation.state, - }; -} - void main() { testWidgets('Push and Pop should send platform messages', (WidgetTester tester) async { final Map routes = { diff --git a/packages/flutter/test/widgets/routes_test.dart b/packages/flutter/test/widgets/routes_test.dart index ad36da4356dcc..327e026859385 100644 --- a/packages/flutter/test/widgets/routes_test.dart +++ b/packages/flutter/test/widgets/routes_test.dart @@ -2296,50 +2296,6 @@ class WidgetWithNoLocalHistoryState extends State { } } -class TransitionDetector extends DefaultTransitionDelegate { - bool hasTransition = false; - @override - Iterable resolve({ - required List newPageRouteHistory, - required Map locationToExitingPageRoute, - required Map> pageRouteToPagelessRoutes, - }) { - hasTransition = true; - return super.resolve( - newPageRouteHistory: newPageRouteHistory, - locationToExitingPageRoute: locationToExitingPageRoute, - pageRouteToPagelessRoutes: pageRouteToPagelessRoutes, - ); - } -} - -Widget buildNavigator({ - required List> pages, - required PopPageCallback onPopPage, - GlobalKey? key, - TransitionDelegate? transitionDelegate, -}) { - return MediaQuery( - data: MediaQueryData.fromWindow(WidgetsBinding.instance.window), - child: Localizations( - locale: const Locale('en', 'US'), - delegates: const >[ - DefaultMaterialLocalizations.delegate, - DefaultWidgetsLocalizations.delegate, - ], - child: Directionality( - textDirection: TextDirection.ltr, - child: Navigator( - key: key, - pages: pages, - onPopPage: onPopPage, - transitionDelegate: transitionDelegate ?? const DefaultTransitionDelegate(), - ), - ), - ), - ); -} - class _RestorableDialogTestWidget extends StatelessWidget { static Route _dialogBuilder(BuildContext context, Object? arguments) { return RawDialogRoute( diff --git a/packages/flutter/test/widgets/scrollable_semantics_test.dart b/packages/flutter/test/widgets/scrollable_semantics_test.dart index 75d5c440ae4d8..ea24b449601b4 100644 --- a/packages/flutter/test/widgets/scrollable_semantics_test.dart +++ b/packages/flutter/test/widgets/scrollable_semantics_test.dart @@ -643,10 +643,6 @@ Future flingUp(WidgetTester tester, { int repetitions = 1 }) => fling(test Future flingDown(WidgetTester tester, { int repetitions = 1 }) => fling(tester, const Offset(0.0, 200.0), repetitions); -Future flingRight(WidgetTester tester, { int repetitions = 1 }) => fling(tester, const Offset(200.0, 0.0), repetitions); - -Future flingLeft(WidgetTester tester, { int repetitions = 1 }) => fling(tester, const Offset(-200.0, 0.0), repetitions); - Future fling(WidgetTester tester, Offset offset, int repetitions) async { while (repetitions-- > 0) { await tester.fling(find.byType(ListView), offset, 1000.0); diff --git a/packages/flutter/test/widgets/selectable_region_test.dart b/packages/flutter/test/widgets/selectable_region_test.dart index 80e6791592866..618bca6237840 100644 --- a/packages/flutter/test/widgets/selectable_region_test.dart +++ b/packages/flutter/test/widgets/selectable_region_test.dart @@ -1041,95 +1041,3 @@ class RenderSelectionSpy extends RenderProxyBox @override void pushHandleLayers(LayerLink? startHandle, LayerLink? endHandle) { } } - - -class TextTextSelectionControls extends TextSelectionControls { - static final UniqueKey leftHandle = UniqueKey(); - static final UniqueKey rightHandle = UniqueKey(); - static final UniqueKey toolbar = UniqueKey(); - - @override - Size getHandleSize(double textLineHeight) => Size(textLineHeight, textLineHeight); - - @override - Widget buildToolbar( - BuildContext context, - Rect globalEditableRegion, - double textLineHeight, - Offset selectionMidpoint, - List endpoints, - TextSelectionDelegate delegate, - ClipboardStatusNotifier? clipboardStatus, - Offset? lastSecondaryTapDownPosition, - ) { - return TestToolbar( - key: toolbar, - globalEditableRegion: globalEditableRegion, - textLineHeight: textLineHeight, - selectionMidpoint: selectionMidpoint, - endpoints: endpoints, - delegate: delegate, - clipboardStatus: clipboardStatus, - lastSecondaryTapDownPosition: lastSecondaryTapDownPosition, - ); - } - - @override - Widget buildHandle(BuildContext context, TextSelectionHandleType type, double textHeight, [VoidCallback? onTap]) { - return TestHandle( - key: type == TextSelectionHandleType.left ? leftHandle : rightHandle, - type: type, - textHeight: textHeight, - ); - } - - @override - Offset getHandleAnchor(TextSelectionHandleType type, double textLineHeight) { - return Offset.zero; - } - - @override - bool canSelectAll(TextSelectionDelegate delegate) => true; -} - -class TestHandle extends StatelessWidget { - const TestHandle({ - super.key, - required this.type, - required this.textHeight, - }); - - final TextSelectionHandleType type; - final double textHeight; - - @override - Widget build(BuildContext context) { - return SizedBox(width: textHeight, height: textHeight); - } -} - -class TestToolbar extends StatelessWidget { - const TestToolbar({ - super.key, - required this.globalEditableRegion, - required this.textLineHeight, - required this.selectionMidpoint, - required this.endpoints, - required this.delegate, - required this.clipboardStatus, - required this.lastSecondaryTapDownPosition, - }); - - final Rect globalEditableRegion; - final double textLineHeight; - final Offset selectionMidpoint; - final List endpoints; - final TextSelectionDelegate delegate; - final ClipboardStatusNotifier? clipboardStatus; - final Offset? lastSecondaryTapDownPosition; - - @override - Widget build(BuildContext context) { - return SizedBox(width: textLineHeight, height: textLineHeight); - } -} diff --git a/packages/flutter/test/widgets/selectable_text_test.dart b/packages/flutter/test/widgets/selectable_text_test.dart index 748c8157617b5..3826981bfc371 100644 --- a/packages/flutter/test/widgets/selectable_text_test.dart +++ b/packages/flutter/test/widgets/selectable_text_test.dart @@ -103,15 +103,6 @@ Future skipPastScrollingAnimation(WidgetTester tester) async { await tester.pump(const Duration(milliseconds: 200)); } -double getOpacity(WidgetTester tester, Finder finder) { - return tester.widget( - find.ancestor( - of: finder, - matching: find.byType(FadeTransition), - ), - ).opacity.value; -} - void main() { TestWidgetsFlutterBinding.ensureInitialized(); final MockClipboard mockClipboard = MockClipboard(); diff --git a/packages/flutter/test/widgets/shortcuts_test.dart b/packages/flutter/test/widgets/shortcuts_test.dart index d46746cca918e..8e9ba8a82e516 100644 --- a/packages/flutter/test/widgets/shortcuts_test.dart +++ b/packages/flutter/test/widgets/shortcuts_test.dart @@ -1737,8 +1737,6 @@ class _TestCallbackRegistrationState extends State { } } -typedef PostInvokeCallback = void Function({Action action, Intent intent, BuildContext? context, ActionDispatcher dispatcher}); - class TestAction extends CallbackAction { TestAction({ required super.onInvoke, @@ -1747,19 +1745,6 @@ class TestAction extends CallbackAction { static const LocalKey key = ValueKey(TestAction); } -class TestDispatcher extends ActionDispatcher { - const TestDispatcher({this.postInvoke}); - - final PostInvokeCallback? postInvoke; - - @override - Object? invokeAction(Action action, Intent intent, [BuildContext? context]) { - final Object? result = super.invokeAction(action, intent, context); - postInvoke?.call(action: action, intent: intent, context: context, dispatcher: this); - return result; - } -} - /// An activator that accepts down events that has [key] as the logical key. /// /// This class is used only to tests. It is intentionally designed poorly by diff --git a/packages/flutter/test/widgets/slivers_evil_test.dart b/packages/flutter/test/widgets/slivers_evil_test.dart index 07be043da66aa..a7abfb99a6aac 100644 --- a/packages/flutter/test/widgets/slivers_evil_test.dart +++ b/packages/flutter/test/widgets/slivers_evil_test.dart @@ -56,21 +56,6 @@ class TestScrollPhysics extends ClampingScrollPhysics { Tolerance get tolerance => const Tolerance(velocity: 20.0, distance: 1.0); } -class TestViewportScrollPosition extends ScrollPositionWithSingleContext { - TestViewportScrollPosition({ - required super.physics, - required super.context, - super.oldPosition, - }); - - @override - bool applyContentDimensions(double minScrollExtent, double maxScrollExtent) { - expect(minScrollExtent, moreOrLessEquals(-3895.0)); - expect(maxScrollExtent, moreOrLessEquals(8575.0)); - return super.applyContentDimensions(minScrollExtent, maxScrollExtent); - } -} - void main() { testWidgets('Evil test of sliver features - 1', (WidgetTester tester) async { final GlobalKey centerKey = GlobalKey(); diff --git a/packages/flutter/test/widgets/text_selection_test.dart b/packages/flutter/test/widgets/text_selection_test.dart index 9cc91f2e38ce7..b0da65e747fda 100644 --- a/packages/flutter/test/widgets/text_selection_test.dart +++ b/packages/flutter/test/widgets/text_selection_test.dart @@ -1426,37 +1426,6 @@ class FakeRenderEditable extends RenderEditable { bool hasFocus = false; } -class CustomTextSelectionControls extends TextSelectionControls { - @override - Widget buildHandle(BuildContext context, TextSelectionHandleType type, double textLineHeight, [VoidCallback? onTap]) { - throw UnimplementedError(); - } - - @override - Widget buildToolbar( - BuildContext context, - Rect globalEditableRegion, - double textLineHeight, - Offset position, - List endpoints, - TextSelectionDelegate delegate, - ClipboardStatusNotifier? clipboardStatus, - Offset? lastSecondaryTapDownPosition, - ) { - throw UnimplementedError(); - } - - @override - Offset getHandleAnchor(TextSelectionHandleType type, double textLineHeight) { - throw UnimplementedError(); - } - - @override - Size getHandleSize(double textLineHeight) { - throw UnimplementedError(); - } -} - class TextSelectionControlsSpy extends TextSelectionControls { UniqueKey leftHandleKey = UniqueKey(); UniqueKey rightHandleKey = UniqueKey(); diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index e00dc28bcdcd6..82175b39c5aee 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -14,7 +14,6 @@ @TestOn('!chrome') -import 'dart:async'; import 'dart:convert'; import 'dart:math'; import 'dart:ui' as ui; @@ -160,8 +159,6 @@ class _CreationLocation { String? name; } -typedef InspectorServiceExtensionCallback = FutureOr> Function(Map parameters); - class RenderRepaintBoundaryWithDebugPaint extends RenderRepaintBoundary { @override void debugPaintSize(PaintingContext context, Offset offset) { @@ -1999,7 +1996,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { _CreationLocation location = knownLocations[id]!; expect(location.file, equals(file)); // ClockText widget. - expect(location.line, equals(64)); + expect(location.line, equals(63)); expect(location.column, equals(9)); expect(location.name, equals('ClockText')); expect(count, equals(1)); @@ -2009,7 +2006,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // Text widget in _ClockTextState build method. - expect(location.line, equals(102)); + expect(location.line, equals(101)); expect(location.column, equals(12)); expect(location.name, equals('Text')); expect(count, equals(1)); @@ -2036,7 +2033,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // ClockText widget. - expect(location.line, equals(64)); + expect(location.line, equals(63)); expect(location.column, equals(9)); expect(location.name, equals('ClockText')); expect(count, equals(3)); // 3 clock widget instances rebuilt. @@ -2046,7 +2043,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { location = knownLocations[id]!; expect(location.file, equals(file)); // Text widget in _ClockTextState build method. - expect(location.line, equals(102)); + expect(location.line, equals(101)); expect(location.column, equals(12)); expect(location.name, equals('Text')); expect(count, equals(3)); // 3 clock widget instances rebuilt.