diff --git a/packages/flutter/pubspec.yaml b/packages/flutter/pubspec.yaml index dd753c75e9..7975cf6bf2 100644 --- a/packages/flutter/pubspec.yaml +++ b/packages/flutter/pubspec.yaml @@ -22,8 +22,8 @@ dev_dependencies: flutter_goldens: sdk: flutter fake_async: 1.3.1 - leak_tracker: 8.0.3 - leak_tracker_testing: 1.0.2 + leak_tracker: 9.0.4 + leak_tracker_flutter_testing: 1.0.1 _fe_analyzer_shared: 63.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" analyzer: 6.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -42,6 +42,7 @@ dev_dependencies: intl: 0.18.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" io: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" js: 0.6.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" + leak_tracker_testing: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" logging: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" matcher: 0.12.16 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" mime: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -73,4 +74,4 @@ dev_dependencies: webkit_inspection_protocol: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 3.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" -# PUBSPEC CHECKSUM: 443a +# PUBSPEC CHECKSUM: a63c diff --git a/packages/flutter/test/animation/animation_sheet_test.dart b/packages/flutter/test/animation/animation_sheet_test.dart index 4c26669abe..0d60746c45 100644 --- a/packages/flutter/test/animation/animation_sheet_test.dart +++ b/packages/flutter/test/animation/animation_sheet_test.dart @@ -12,7 +12,6 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; void main() { /* @@ -20,7 +19,7 @@ void main() { * because [matchesGoldenFile] does not use Skia Gold in its native package. */ - testWidgetsWithLeakTracking('correctly records frames using collate', (WidgetTester tester) async { + testWidgets('correctly records frames using collate', (WidgetTester tester) async { final AnimationSheetBuilder builder = AnimationSheetBuilder(frameSize: _DecuplePixels.size); await tester.pumpFrames( @@ -57,7 +56,7 @@ void main() { image.dispose(); }, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001 - testWidgetsWithLeakTracking('use allLayers to record out-of-subtree contents', (WidgetTester tester) async { + testWidgets('use allLayers to record out-of-subtree contents', (WidgetTester tester) async { final AnimationSheetBuilder builder = AnimationSheetBuilder( frameSize: const Size(8, 2), allLayers: true, diff --git a/packages/flutter/test/animation/futures_test.dart b/packages/flutter/test/animation/futures_test.dart index 5a33543024..6ffee8e164 100644 --- a/packages/flutter/test/animation/futures_test.dart +++ b/packages/flutter/test/animation/futures_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/animation.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('awaiting animation controllers - using direct future', (WidgetTester tester) async { diff --git a/packages/flutter/test/animation/iteration_patterns_test.dart b/packages/flutter/test/animation/iteration_patterns_test.dart index 42b4e916da..0705333d3f 100644 --- a/packages/flutter/test/animation/iteration_patterns_test.dart +++ b/packages/flutter/test/animation/iteration_patterns_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { setUp(() { diff --git a/packages/flutter/test/animation/live_binding_test.dart b/packages/flutter/test/animation/live_binding_test.dart index 4928e6a676..e0d523fb22 100644 --- a/packages/flutter/test/animation/live_binding_test.dart +++ b/packages/flutter/test/animation/live_binding_test.dart @@ -11,8 +11,7 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { /* @@ -80,7 +79,7 @@ void main() { // Currently skipped due to daily flake: https://github.com/flutter/flutter/issues/87588 }, skip: true); // Typically skip: isBrowser https://github.com/flutter/flutter/issues/42767 - testWidgetsWithLeakTracking('Should show event indicator for pointer events with setSurfaceSize', (WidgetTester tester) async { + testWidgets('Should show event indicator for pointer events with setSurfaceSize', (WidgetTester tester) async { final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(200, 200), allLayers: true); final List taps = []; Widget target({bool recording = true}) => Container( diff --git a/packages/flutter/test/flutter_test_config.dart b/packages/flutter/test/flutter_test_config.dart index e8d488aff5..5600ab0460 100644 --- a/packages/flutter/test/flutter_test_config.dart +++ b/packages/flutter/test/flutter_test_config.dart @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:leak_tracker/leak_tracker.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '_goldens_io.dart' if (dart.library.html) '_goldens_web.dart' as flutter_goldens; @@ -23,7 +24,10 @@ Future testExecutable(FutureOr Function() testMain) { // receive the event. WidgetController.hitTestWarningShouldBeFatal = true; - LeakTrackerGlobalSettings.warnForNonSupportedPlatforms = false; + LeakTracking.warnForUnsupportedPlatforms = false; + setLeakTrackingTestSettings( + LeakTrackingTestSettings(switches: const Switches(disableNotGCed: true)) + ); // Enable golden file testing using Skia Gold. return flutter_goldens.testExecutable(testMain); diff --git a/packages/flutter/test/foundation/change_notifier_test.dart b/packages/flutter/test/foundation/change_notifier_test.dart index 661431e6c4..a7adb3df31 100644 --- a/packages/flutter/test/foundation/change_notifier_test.dart +++ b/packages/flutter/test/foundation/change_notifier_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; - -import 'leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestNotifier extends ChangeNotifier { void notify() { diff --git a/packages/flutter/test/foundation/leak_tracking.dart b/packages/flutter/test/foundation/leak_tracking.dart deleted file mode 100644 index 1ed364c9fa..0000000000 --- a/packages/flutter/test/foundation/leak_tracking.dart +++ /dev/null @@ -1,206 +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:core'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:leak_tracker/leak_tracker.dart'; -import 'package:leak_tracker_testing/leak_tracker_testing.dart'; -import 'package:meta/meta.dart'; - -export 'package:leak_tracker/leak_tracker.dart' show LeakDiagnosticConfig, LeakTrackingTestConfig; - -/// Set of objects, that does not hold the objects from garbage collection. -/// -/// The objects are referenced by hash codes and can duplicate with low probability. -@visibleForTesting -class WeakSet { - final Set _objectCodes = {}; - - String _toCode(int hashCode, String type) => '$type-$hashCode'; - - void add(Object object) { - _objectCodes.add(_toCode(identityHashCode(object), object.runtimeType.toString())); - } - - void addByCode(int hashCode, String type) { - _objectCodes.add(_toCode(hashCode, type)); - } - - bool contains(int hashCode, String type) { - final bool result = _objectCodes.contains(_toCode(hashCode, type)); - return result; - } -} - -/// Wrapper for [testWidgets] with memory leak tracking. -/// -/// The method will fail if instrumented objects in [callback] are -/// garbage collected without being disposed. -/// -/// More about leak tracking: -/// https://github.com/dart-lang/leak_tracker. -/// -/// See https://github.com/flutter/devtools/issues/3951 for plans -/// on leak tracking. -@isTest -void testWidgetsWithLeakTracking( - String description, - WidgetTesterCallback callback, { - bool? skip, - Timeout? timeout, - bool semanticsEnabled = true, - TestVariant variant = const DefaultTestVariant(), - dynamic tags, - LeakTrackingTestConfig leakTrackingTestConfig = const LeakTrackingTestConfig(), -}) { - Future wrappedCallback(WidgetTester tester) async { - await _withFlutterLeakTracking( - () async => callback(tester), - tester, - leakTrackingTestConfig, - ); - } - - testWidgets( - description, - wrappedCallback, - skip: skip, - timeout: timeout, - semanticsEnabled: semanticsEnabled, - variant: variant, - tags: tags, - ); -} - -bool _webWarningPrinted = false; - -/// Runs [callback] with leak tracking. -/// -/// Wrapper for [withLeakTracking] with Flutter specific functionality. -/// -/// The method will fail if wrapped code contains memory leaks. -/// -/// See details in documentation for `withLeakTracking` at -/// https://github.com/dart-lang/leak_tracker/blob/main/lib/src/leak_tracking/orchestration.dart -/// -/// The Flutter related enhancements are: -/// 1. Listens to [MemoryAllocations] events. -/// 2. Uses `tester.runAsync` for leak detection if [tester] is provided. -/// -/// Pass [config] to troubleshoot or exempt leaks. See [LeakTrackingTestConfig] -/// for details. -Future _withFlutterLeakTracking( - DartAsyncCallback callback, - WidgetTester tester, - LeakTrackingTestConfig config, -) async { - // Leak tracker does not work for web platform. - if (kIsWeb) { - final bool shouldPrintWarning = !_webWarningPrinted && LeakTrackerGlobalSettings.warnForNonSupportedPlatforms; - if (shouldPrintWarning) { - _webWarningPrinted = true; - debugPrint('Leak tracking is not supported on web platform.\nTo turn off this message, set `LeakTrackingTestConfig.warnForNonSupportedPlatforms` to false.'); - } - await callback(); - return; - } - - void flutterEventToLeakTracker(ObjectEvent event) { - return dispatchObjectEvent(event.toMap()); - } - - return TestAsyncUtils.guard(() async { - MemoryAllocations.instance.addListener(flutterEventToLeakTracker); - Future asyncCodeRunner(DartAsyncCallback action) async => tester.runAsync(action); - - try { - Leaks leaks = await withLeakTracking( - callback, - asyncCodeRunner: asyncCodeRunner, - leakDiagnosticConfig: config.leakDiagnosticConfig, - shouldThrowOnLeaks: false, - ); - - leaks = LeakCleaner(config).clean(leaks); - - if (leaks.total > 0) { - config.onLeaks?.call(leaks); - if (config.failTestOnLeaks) { - expect(leaks, isLeakFree); - } - } - } finally { - MemoryAllocations.instance.removeListener(flutterEventToLeakTracker); - } - }); -} - -/// Cleans leaks that are allowed by [config]. -@visibleForTesting -class LeakCleaner { - LeakCleaner(this.config); - - final LeakTrackingTestConfig config; - - static Map<(String, LeakType), int> _countByClassAndType(Leaks leaks) { - final Map<(String, LeakType), int> result = <(String, LeakType), int>{}; - - for (final MapEntry> entry in leaks.byType.entries) { - for (final LeakReport leak in entry.value) { - final (String, LeakType) classAndType = (leak.type, entry.key); - result[classAndType] = (result[classAndType] ?? 0) + 1; - } - } - return result; - } - - Leaks clean(Leaks leaks) { - final Map<(String, LeakType), int> countByClassAndType = _countByClassAndType(leaks); - - final Leaks result = Leaks(>{ - for (final LeakType leakType in leaks.byType.keys) - leakType: leaks.byType[leakType]!.where((LeakReport leak) => _shouldReportLeak(leakType, leak, countByClassAndType)).toList() - }); - return result; - } - - /// Returns true if [leak] should be reported as failure. - bool _shouldReportLeak(LeakType leakType, LeakReport leak, Map<(String, LeakType), int> countByClassAndType) { - switch (leakType) { - case LeakType.notDisposed: - if (config.allowAllNotDisposed) { - return false; - } - case LeakType.notGCed: - case LeakType.gcedLate: - if (config.allowAllNotGCed) { - return false; - } - } - - final String leakingClass = leak.type; - final (String, LeakType) classAndType = (leakingClass, leakType); - - bool isAllowedForClass(Map allowList) { - if (!allowList.containsKey(leakingClass)) { - return false; - } - final int? allowedCount = allowList[leakingClass]; - if (allowedCount == null) { - return true; - } - return allowedCount >= countByClassAndType[classAndType]!; - } - - switch (leakType) { - case LeakType.notDisposed: - return !isAllowedForClass(config.notDisposedAllowList); - case LeakType.notGCed: - case LeakType.gcedLate: - return !isAllowedForClass(config.notGCedAllowList); - } - } -} diff --git a/packages/flutter/test/foundation/leak_tracking_test.dart b/packages/flutter/test/foundation/leak_tracking_test.dart deleted file mode 100644 index bd02bd2c78..0000000000 --- a/packages/flutter/test/foundation/leak_tracking_test.dart +++ /dev/null @@ -1,235 +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 'package:flutter/widgets.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:leak_tracker/leak_tracker.dart'; -import 'package:leak_tracker_testing/leak_tracker_testing.dart'; - -import 'leak_tracking.dart'; - -final String _leakTrackedClassName = '$_LeakTrackedClass'; - -Leaks _leaksOfAllTypes() => Leaks(> { - LeakType.notDisposed: [LeakReport(code: 1, context: {}, type:'myNotDisposedClass', trackedClass: 'myTrackedClass')], - LeakType.notGCed: [LeakReport(code: 2, context: {}, type:'myNotGCedClass', trackedClass: 'myTrackedClass')], - LeakType.gcedLate: [LeakReport(code: 3, context: {}, type:'myGCedLateClass', trackedClass: 'myTrackedClass')], -}); - -Future main() async { - test('Trivial $LeakCleaner returns all leaks.', () { - final LeakCleaner leakCleaner = LeakCleaner(const LeakTrackingTestConfig()); - final Leaks leaks = _leaksOfAllTypes(); - final int leakTotal = leaks.total; - - final Leaks cleanedLeaks = leakCleaner.clean(leaks); - - expect(leaks.total, leakTotal); - expect(cleanedLeaks.total, 3); - }); - - test('$LeakCleaner catches extra leaks', () { - Leaks leaks = _leaksOfAllTypes(); - final LeakReport leak = leaks.notDisposed.first; - leaks.notDisposed.add(leak); - - final LeakTrackingTestConfig config = LeakTrackingTestConfig( - notDisposedAllowList: {leak.type: 1}, - ); - leaks = LeakCleaner(config).clean(leaks); - - expect(leaks.notDisposed, hasLength(2)); - }); - - group('Leak tracking works for non-web, and', () { - testWidgetsWithLeakTracking( - 'respects all allow lists', - (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - leakTrackingTestConfig: LeakTrackingTestConfig( - notDisposedAllowList: {_leakTrackedClassName: null}, - notGCedAllowList: {_leakTrackedClassName: null}, - ), - ); - - testWidgetsWithLeakTracking( - 'respects allowAllNotDisposed', - (WidgetTester tester) async { - // ignore: avoid_redundant_argument_values, for readability. - await tester.pumpWidget(_StatelessLeakingWidget(notDisposed: true, notGCed: false)); - }, - leakTrackingTestConfig: const LeakTrackingTestConfig( - allowAllNotDisposed: true, - ), - ); - - testWidgetsWithLeakTracking( - 'respects allowAllNotGCed', - (WidgetTester tester) async { - // ignore: avoid_redundant_argument_values, for readability. - await tester.pumpWidget(_StatelessLeakingWidget(notDisposed: false, notGCed: true)); - }, - leakTrackingTestConfig: const LeakTrackingTestConfig( - allowAllNotGCed: true, - ), - ); - - testWidgetsWithLeakTracking( - 'respects count in allow lists', - (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - leakTrackingTestConfig: LeakTrackingTestConfig( - notDisposedAllowList: {_leakTrackedClassName: 1}, - notGCedAllowList: {_leakTrackedClassName: 1}, - ), - ); - - group('fails if number or leaks is more than allowed', () { - // This test cannot run inside other tests because test nesting is forbidden. - // So, `expect` happens outside the tests, in `tearDown`. - late Leaks leaks; - - testWidgetsWithLeakTracking( - 'for $_StatelessLeakingWidget', - (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - leakTrackingTestConfig: LeakTrackingTestConfig( - onLeaks: (Leaks theLeaks) { - leaks = theLeaks; - }, - failTestOnLeaks: false, - notDisposedAllowList: {_leakTrackedClassName: 1}, - ), - ); - - tearDown(() => _verifyLeaks(leaks, expectedNotDisposed: 2, expectedNotGCed: 2, shouldContainDebugInfo: false)); - }); - - group('respects notGCed allow lists', () { - // These tests cannot run inside other tests because test nesting is forbidden. - // So, `expect` happens outside the tests, in `tearDown`. - late Leaks leaks; - - testWidgetsWithLeakTracking( - 'when $_StatelessLeakingWidget leaks', - (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - leakTrackingTestConfig: LeakTrackingTestConfig( - onLeaks: (Leaks theLeaks) { - leaks = theLeaks; - }, - failTestOnLeaks: false, - notGCedAllowList: {_leakTrackedClassName: null}, - ), - ); - - tearDown(() => _verifyLeaks(leaks, expectedNotDisposed: 1, shouldContainDebugInfo: false)); - }); - - group('catches that', () { - // These test cannot run inside other tests because test nesting is forbidden. - // So, `expect` happens outside the tests, in `tearDown`. - late Leaks leaks; - - testWidgetsWithLeakTracking( - '$_StatelessLeakingWidget leaks', - (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - leakTrackingTestConfig: LeakTrackingTestConfig( - onLeaks: (Leaks theLeaks) { - leaks = theLeaks; - }, - failTestOnLeaks: false, - ), - ); - - tearDown(() => _verifyLeaks(leaks, expectedNotDisposed: 1, expectedNotGCed: 1, shouldContainDebugInfo: false)); - }); - }, - skip: isBrowser); // [intended] Leak detection is off for web. - - testWidgetsWithLeakTracking('Leak tracking is no-op for web', (WidgetTester tester) async { - await tester.pumpWidget(_StatelessLeakingWidget()); - }, - skip: !isBrowser); // [intended] Leaks detection is off for web. -} - -/// Verifies [leaks] contains expected number of leaks for [_LeakTrackedClass]. -void _verifyLeaks( - Leaks leaks, { - int expectedNotDisposed = 0, - int expectedNotGCed = 0, - required bool shouldContainDebugInfo, -}) { - const String linkToLeakTracker = 'https://github.com/dart-lang/leak_tracker'; - - expect( - () => expect(leaks, isLeakFree), - throwsA( - predicate((Object? e) { - return e is TestFailure && e.toString().contains(linkToLeakTracker); - }), - ), - ); - - _verifyLeakList(leaks.notDisposed, expectedNotDisposed, shouldContainDebugInfo); - _verifyLeakList(leaks.notGCed, expectedNotGCed, shouldContainDebugInfo); -} - -void _verifyLeakList(List list, int expectedCount, bool shouldContainDebugInfo){ - expect(list.length, expectedCount); - - for (final LeakReport leak in list) { - if (shouldContainDebugInfo) { - expect(leak.context, isNotEmpty); - } else { - expect(leak.context ?? {}, isEmpty); - } - - expect(leak.trackedClass, contains(_LeakTrackedClass.library)); - expect(leak.trackedClass, contains(_leakTrackedClassName)); - } -} - -/// Storage to keep disposed objects, to generate not-gced leaks. -final List<_LeakTrackedClass> _notGcedStorage = <_LeakTrackedClass>[]; - -class _StatelessLeakingWidget extends StatelessWidget { - _StatelessLeakingWidget({bool notDisposed = true, bool notGCed = true}) { - if (notDisposed) { - // ignore: unused_local_variable, the variable is used to create non disposed leak - final _LeakTrackedClass notDisposed = _LeakTrackedClass(); - } - if (notGCed) { - _notGcedStorage.add(_LeakTrackedClass()..dispose()); - } - } - - @override - Widget build(BuildContext context) { - return const Placeholder(); - } -} - -class _LeakTrackedClass { - _LeakTrackedClass() { - dispatchObjectCreated( - library: library, - className: '$_LeakTrackedClass', - object: this, - ); - } - - static const String library = 'package:my_package/lib/src/my_lib.dart'; - - void dispose() { - dispatchObjectDisposed(object: this); - } -} diff --git a/packages/flutter/test/gestures/debug_test.dart b/packages/flutter/test/gestures/debug_test.dart index f3f812ccf9..6a17b90642 100644 --- a/packages/flutter/test/gestures/debug_test.dart +++ b/packages/flutter/test/gestures/debug_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('debugPrintGestureArenaDiagnostics', (WidgetTester tester) async { diff --git a/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart b/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart index 26c2f8ffe3..76d0d82be2 100644 --- a/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart @@ -9,8 +9,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestResampleEventFlutterBinding extends AutomatedTestWidgetsFlutterBinding { @override diff --git a/packages/flutter/test/gestures/gesture_config_regression_test.dart b/packages/flutter/test/gestures/gesture_config_regression_test.dart index 7fcda721bb..b238b5b103 100644 --- a/packages/flutter/test/gestures/gesture_config_regression_test.dart +++ b/packages/flutter/test/gestures/gesture_config_regression_test.dart @@ -6,8 +6,7 @@ import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestResult { bool dragStarted = false; diff --git a/packages/flutter/test/gestures/transformed_double_tap_test.dart b/packages/flutter/test/gestures/transformed_double_tap_test.dart index 38056a658e..b550ad0f3f 100644 --- a/packages/flutter/test/gestures/transformed_double_tap_test.dart +++ b/packages/flutter/test/gestures/transformed_double_tap_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('kTouchSlop is evaluated in the global coordinate space when scaled up', (WidgetTester tester) async { diff --git a/packages/flutter/test/gestures/transformed_long_press_test.dart b/packages/flutter/test/gestures/transformed_long_press_test.dart index fcbd38c69a..9e222ca41d 100644 --- a/packages/flutter/test/gestures/transformed_long_press_test.dart +++ b/packages/flutter/test/gestures/transformed_long_press_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async { diff --git a/packages/flutter/test/gestures/transformed_monodrag_test.dart b/packages/flutter/test/gestures/transformed_monodrag_test.dart index c85bf24cd0..1a7c39b682 100644 --- a/packages/flutter/test/gestures/transformed_monodrag_test.dart +++ b/packages/flutter/test/gestures/transformed_monodrag_test.dart @@ -7,12 +7,11 @@ import 'dart:math' as math; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { group('Horizontal', () { - testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async { + testWidgets('gets local coordinates', (WidgetTester tester) async { int dragCancelCount = 0; final List downDetails = []; final List endDetails = []; diff --git a/packages/flutter/test/gestures/transformed_scale_test.dart b/packages/flutter/test/gestures/transformed_scale_test.dart index c01c6548ad..f48b5e8a14 100644 --- a/packages/flutter/test/gestures/transformed_scale_test.dart +++ b/packages/flutter/test/gestures/transformed_scale_test.dart @@ -5,10 +5,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { - testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async { + testWidgets('gets local coordinates', (WidgetTester tester) async { final List startDetails = []; final List updateDetails = []; diff --git a/packages/flutter/test/gestures/transformed_tap_test.dart b/packages/flutter/test/gestures/transformed_tap_test.dart index 2d3dd3cd48..5486805993 100644 --- a/packages/flutter/test/gestures/transformed_tap_test.dart +++ b/packages/flutter/test/gestures/transformed_tap_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 0199deb48f..7585853dc4 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -10,8 +10,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { tearDown(() { @@ -58,7 +57,7 @@ void main() { expect(find.text('View licenses'), findsOneWidget); }); - testWidgetsWithLeakTracking('Material2 - AboutListTile control test', (WidgetTester tester) async { + testWidgets('Material2 - AboutListTile control test', (WidgetTester tester) async { const FlutterLogo logo = FlutterLogo(); await tester.pumpWidget( @@ -141,7 +140,7 @@ void main() { expect(find.text('Pirate license'), findsOneWidget); }); - testWidgetsWithLeakTracking('Material3 - AboutListTile control test', (WidgetTester tester) async { + testWidgets('Material3 - AboutListTile control test', (WidgetTester tester) async { const FlutterLogo logo = FlutterLogo(); await tester.pumpWidget( @@ -1477,7 +1476,7 @@ void main() { expect(find.text('Exception: Injected failure'), findsOneWidget); }); - testWidgetsWithLeakTracking('Material2 - LicensePage master view layout position - ltr', (WidgetTester tester) async { + testWidgets('Material2 - LicensePage master view layout position - ltr', (WidgetTester tester) async { const TextDirection textDirection = TextDirection.ltr; const Size defaultSize = Size(800.0, 600.0); const Size wideSize = Size(1200.0, 600.0); @@ -1542,7 +1541,7 @@ void main() { expect(tester.getCenter(find.byType(ListView)), const Offset(160, 356)); }); - testWidgetsWithLeakTracking('Material3 - LicensePage master view layout position - ltr', (WidgetTester tester) async { + testWidgets('Material3 - LicensePage master view layout position - ltr', (WidgetTester tester) async { const TextDirection textDirection = TextDirection.ltr; const Size defaultSize = Size(800.0, 600.0); const Size wideSize = Size(1200.0, 600.0); @@ -1609,7 +1608,7 @@ void main() { expect(tester.getCenter(find.byType(ListView)), const Offset(160, 356)); }); - testWidgetsWithLeakTracking('Material2 - LicensePage master view layout position - rtl', (WidgetTester tester) async { + testWidgets('Material2 - LicensePage master view layout position - rtl', (WidgetTester tester) async { const TextDirection textDirection = TextDirection.rtl; const Size defaultSize = Size(800.0, 600.0); const Size wideSize = Size(1200.0, 600.0); @@ -1674,7 +1673,7 @@ void main() { expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0)); }); - testWidgetsWithLeakTracking('Material3 - LicensePage master view layout position - rtl', (WidgetTester tester) async { + testWidgets('Material3 - LicensePage master view layout position - rtl', (WidgetTester tester) async { const TextDirection textDirection = TextDirection.rtl; const Size defaultSize = Size(800.0, 600.0); const Size wideSize = Size(1200.0, 600.0); @@ -1741,7 +1740,7 @@ void main() { expect(tester.getCenter(find.byType(ListView)), const Offset(1040.0, 356.0)); }); - testWidgetsWithLeakTracking('License page title in lateral UI does not use AppBarTheme.foregroundColor', (WidgetTester tester) async { + testWidgets('License page title in lateral UI does not use AppBarTheme.foregroundColor', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/108991 final ThemeData theme = ThemeData( appBarTheme: const AppBarTheme(foregroundColor: Color(0xFFFFFFFF)), diff --git a/packages/flutter/test/material/action_chip_test.dart b/packages/flutter/test/material/action_chip_test.dart index 879c6fb5bd..310db84c5c 100644 --- a/packages/flutter/test/material/action_chip_test.dart +++ b/packages/flutter/test/material/action_chip_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; /// Adds the basic requirements for a Chip. Widget wrapForChip({ diff --git a/packages/flutter/test/material/action_icons_theme_test.dart b/packages/flutter/test/material/action_icons_theme_test.dart index f69ce2ac7e..37ad357c9d 100644 --- a/packages/flutter/test/material/action_icons_theme_test.dart +++ b/packages/flutter/test/material/action_icons_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('ActionIconThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart b/packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart index 41ad77aec6..067ced6229 100644 --- a/packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart +++ b/packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/clipboard_utils.dart'; import '../widgets/editable_text_utils.dart'; import '../widgets/live_text_utils.dart'; @@ -112,7 +111,7 @@ void main() { expect(find.byKey(key), findsOneWidget); }); - testWidgetsWithLeakTracking('Can build from EditableTextState', (WidgetTester tester) async { + testWidgets('Can build from EditableTextState', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( @@ -233,7 +232,7 @@ void main() { ); group('buttonItems', () { - testWidgetsWithLeakTracking('getEditableTextButtonItems builds the correct button items per-platform', (WidgetTester tester) async { + testWidgets('getEditableTextButtonItems builds the correct button items per-platform', (WidgetTester tester) async { // Fill the clipboard so that the Paste option is available in the text // selection menu. await Clipboard.setData(const ClipboardData(text: 'Clipboard data')); @@ -328,7 +327,7 @@ void main() { skip: kIsWeb, // [intended] ); - testWidgetsWithLeakTracking('getAdaptiveButtons builds the correct button widgets per-platform', (WidgetTester tester) async { + testWidgets('getAdaptiveButtons builds the correct button widgets per-platform', (WidgetTester tester) async { const String buttonText = 'Click me'; await tester.pumpWidget( diff --git a/packages/flutter/test/material/animated_icons_test.dart b/packages/flutter/test/material/animated_icons_test.dart index b245000b02..b81df83618 100644 --- a/packages/flutter/test/material/animated_icons_test.dart +++ b/packages/flutter/test/material/animated_icons_test.dart @@ -9,8 +9,7 @@ import 'dart:math' as math show pi; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; class MockCanvas extends Fake implements Canvas { diff --git a/packages/flutter/test/material/app_builder_test.dart b/packages/flutter/test/material/app_builder_test.dart index aedf2b14f4..f5b6500ac5 100644 --- a/packages/flutter/test/material/app_builder_test.dart +++ b/packages/flutter/test/material/app_builder_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking("builder doesn't get called if app doesn't change", (WidgetTester tester) async { diff --git a/packages/flutter/test/material/back_button_test.dart b/packages/flutter/test/material/back_button_test.dart index ef0eb7d112..9ba330182c 100644 --- a/packages/flutter/test/material/back_button_test.dart +++ b/packages/flutter/test/material/back_button_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgets('BackButton control test', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/badge_test.dart b/packages/flutter/test/material/badge_test.dart index d51adf08bc..b5b5b3c658 100644 --- a/packages/flutter/test/material/badge_test.dart +++ b/packages/flutter/test/material/badge_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { diff --git a/packages/flutter/test/material/badge_theme_test.dart b/packages/flutter/test/material/badge_theme_test.dart index 9786e5639f..9ab250eaab 100644 --- a/packages/flutter/test/material/badge_theme_test.dart +++ b/packages/flutter/test/material/badge_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('BadgeThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/banner_test.dart b/packages/flutter/test/material/banner_test.dart index 332cab51ed..4d766fbfc1 100644 --- a/packages/flutter/test/material/banner_test.dart +++ b/packages/flutter/test/material/banner_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('MaterialBanner properties are respected', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/banner_theme_test.dart b/packages/flutter/test/material/banner_theme_test.dart index 04db7bba26..1287699d39 100644 --- a/packages/flutter/test/material/banner_theme_test.dart +++ b/packages/flutter/test/material/banner_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('MaterialBannerThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/bottom_app_bar_test.dart b/packages/flutter/test/material/bottom_app_bar_test.dart index 2c26051617..05f7da0b69 100644 --- a/packages/flutter/test/material/bottom_app_bar_test.dart +++ b/packages/flutter/test/material/bottom_app_bar_test.dart @@ -10,8 +10,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('Material3 - Shadow effect is not doubled', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/123064 diff --git a/packages/flutter/test/material/bottom_app_bar_theme_test.dart b/packages/flutter/test/material/bottom_app_bar_theme_test.dart index eed8f3e01b..e3358d1af8 100644 --- a/packages/flutter/test/material/bottom_app_bar_theme_test.dart +++ b/packages/flutter/test/material/bottom_app_bar_theme_test.dart @@ -9,8 +9,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('BottomAppBarTheme lerp special cases', () { diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index 92a1ec9af2..88f772474a 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -12,9 +12,9 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'package:vector_math/vector_math_64.dart' show Vector3; -import '../foundation/leak_tracking.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; diff --git a/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart b/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart index 59b93e01b8..70ae2b6833 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart @@ -6,10 +6,9 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'package:vector_math/vector_math_64.dart' show Vector3; -import '../foundation/leak_tracking.dart'; - void main() { test('BottomNavigationBarThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/bottom_sheet_theme_test.dart b/packages/flutter/test/material/bottom_sheet_theme_test.dart index 0e3593d04a..9d203e5cef 100644 --- a/packages/flutter/test/material/bottom_sheet_theme_test.dart +++ b/packages/flutter/test/material/bottom_sheet_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('BottomSheetThemeData copyWith, ==, hashCode basics', () { @@ -171,7 +170,7 @@ void main() { expect(material.clipBehavior, clipBehavior); }); - testWidgetsWithLeakTracking('Modal bottom sheet-specific parameters are used for modal bottom sheets', (WidgetTester tester) async { + testWidgets('Modal bottom sheet-specific parameters are used for modal bottom sheets', (WidgetTester tester) async { const double modalElevation = 5.0; const double persistentElevation = 7.0; const Color modalBackgroundColor = Colors.yellow; @@ -250,7 +249,7 @@ void main() { expect(material.color, null); }); - testWidgetsWithLeakTracking('Modal bottom sheets respond to theme changes', (WidgetTester tester) async { + testWidgets('Modal bottom sheets respond to theme changes', (WidgetTester tester) async { const double lightElevation = 5.0; const double darkElevation = 3.0; const Color lightBackgroundColor = Colors.green; diff --git a/packages/flutter/test/material/button_bar_test.dart b/packages/flutter/test/material/button_bar_test.dart index 16d4e84f0e..f7bb7768b3 100644 --- a/packages/flutter/test/material/button_bar_test.dart +++ b/packages/flutter/test/material/button_bar_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('ButtonBar default control smoketest', (WidgetTester tester) async { @@ -341,7 +340,7 @@ void main() { group('layoutBehavior', () { - testWidgetsWithLeakTracking('ButtonBar has a min height of 52 when using ButtonBarLayoutBehavior.constrained', (WidgetTester tester) async { + testWidgets('ButtonBar has a min height of 52 when using ButtonBarLayoutBehavior.constrained', (WidgetTester tester) async { await tester.pumpWidget( const SingleChildScrollView( child: ListBody( @@ -364,7 +363,7 @@ void main() { expect(tester.getBottomRight(buttonBar).dy - tester.getTopRight(buttonBar).dy, 52.0); }); - testWidgetsWithLeakTracking('ButtonBar has padding applied when using ButtonBarLayoutBehavior.padded', (WidgetTester tester) async { + testWidgets('ButtonBar has padding applied when using ButtonBarLayoutBehavior.padded', (WidgetTester tester) async { await tester.pumpWidget( const SingleChildScrollView( child: ListBody( diff --git a/packages/flutter/test/material/button_bar_theme_test.dart b/packages/flutter/test/material/button_bar_theme_test.dart index 7e25d30493..158c9dbb51 100644 --- a/packages/flutter/test/material/button_bar_theme_test.dart +++ b/packages/flutter/test/material/button_bar_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { diff --git a/packages/flutter/test/material/button_style_test.dart b/packages/flutter/test/material/button_style_test.dart index 6ccc97ece5..f6b096abd5 100644 --- a/packages/flutter/test/material/button_style_test.dart +++ b/packages/flutter/test/material/button_style_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('ButtonStyle copyWith, merge, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/card_test.dart b/packages/flutter/test/material/card_test.dart index 7c9f265854..1f08017a13 100644 --- a/packages/flutter/test/material/card_test.dart +++ b/packages/flutter/test/material/card_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { diff --git a/packages/flutter/test/material/checkbox_list_tile_test.dart b/packages/flutter/test/material/checkbox_list_tile_test.dart index 4732591978..ef5f4971ae 100644 --- a/packages/flutter/test/material/checkbox_list_tile_test.dart +++ b/packages/flutter/test/material/checkbox_list_tile_test.dart @@ -8,8 +8,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'feedback_tester.dart'; Widget wrap({ required Widget child }) { @@ -496,6 +495,8 @@ void main() { await tester.pump(); expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('CheckboxListTile can be disabled', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/checkbox_theme_test.dart b/packages/flutter/test/material/checkbox_theme_test.dart index 5beec65073..36e23779fa 100644 --- a/packages/flutter/test/material/checkbox_theme_test.dart +++ b/packages/flutter/test/material/checkbox_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('CheckboxThemeData copyWith, ==, hashCode basics', () { @@ -302,7 +301,7 @@ void main() { expect(_getCheckboxMaterial(tester), paints..path(color: selectedFillColor)); }); - testWidgetsWithLeakTracking('Checkbox theme overlay color resolves in active/pressed states', (WidgetTester tester) async { + testWidgets('Checkbox theme overlay color resolves in active/pressed states', (WidgetTester tester) async { const Color activePressedOverlayColor = Color(0xFF000001); const Color inactivePressedOverlayColor = Color(0xFF000002); diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 24a5943490..d098936aa1 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -701,7 +700,7 @@ void main() { expect(calledDelete, isFalse); }); - testWidgetsWithLeakTracking('Chip elements are ordered horizontally for locale', (WidgetTester tester) async { + testWidgets('Chip elements are ordered horizontally for locale', (WidgetTester tester) async { final UniqueKey iconKey = UniqueKey(); final Widget test = Overlay( initialEntries: [ @@ -877,7 +876,7 @@ void main() { expect(tester.getSize(find.byKey(keyA)), equals(const Size(20.0, 20.0))); }); - testWidgetsWithLeakTracking('Chip padding - LTR', (WidgetTester tester) async { + testWidgets('Chip padding - LTR', (WidgetTester tester) async { final GlobalKey keyA = GlobalKey(); final GlobalKey keyB = GlobalKey(); await tester.pumpWidget( @@ -913,7 +912,7 @@ void main() { expect(tester.getBottomRight(find.byType(Icon)), const Offset(457.0, 309.0)); }); - testWidgetsWithLeakTracking('Chip padding - RTL', (WidgetTester tester) async { + testWidgets('Chip padding - RTL', (WidgetTester tester) async { final GlobalKey keyA = GlobalKey(); final GlobalKey keyB = GlobalKey(); await tester.pumpWidget( @@ -2633,7 +2632,7 @@ void main() { expect(find.byType(InkWell), findsOneWidget); }); - testWidgetsWithLeakTracking('Chip uses stateful color for text color in different states', (WidgetTester tester) async { + testWidgets('Chip uses stateful color for text color in different states', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); const Color pressedColor = Color(0x00000001); @@ -2721,7 +2720,7 @@ void main() { expect(textColor(), disabledColor); }); - testWidgetsWithLeakTracking('Chip uses stateful border side color in different states', (WidgetTester tester) async { + testWidgets('Chip uses stateful border side color in different states', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); const Color pressedColor = Color(0x00000001); @@ -2801,7 +2800,7 @@ void main() { expect(find.byType(RawChip), paints..rrect()..rrect(color: disabledColor)); }); - testWidgetsWithLeakTracking('Chip uses stateful border side color from resolveWith', (WidgetTester tester) async { + testWidgets('Chip uses stateful border side color from resolveWith', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); const Color pressedColor = Color(0x00000001); @@ -2882,7 +2881,7 @@ void main() { }); - testWidgetsWithLeakTracking('Chip uses stateful nullable border side color from resolveWith', (WidgetTester tester) async { + testWidgets('Chip uses stateful nullable border side color from resolveWith', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); const Color pressedColor = Color(0x00000001); @@ -2971,7 +2970,7 @@ void main() { expect(find.byType(RawChip), paints..rrect()..rrect(color: disabledColor)); }); - testWidgetsWithLeakTracking('Chip uses stateful shape in different states', (WidgetTester tester) async { + testWidgets('Chip uses stateful shape in different states', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); OutlinedBorder? getShape(Set states) { @@ -3339,7 +3338,7 @@ void main() { expect(decoration.shape, shape); }); - testWidgetsWithLeakTracking('Chip highlight color is drawn on top of the backgroundColor', (WidgetTester tester) async { + testWidgets('Chip highlight color is drawn on top of the backgroundColor', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(debugLabel: 'RawChip'); tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; const Color backgroundColor = Color(0xff00ff00); diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index 13fa9dbf02..2303b56478 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; RenderBox getMaterialBox(WidgetTester tester) { return tester.firstRenderObject( @@ -641,6 +640,8 @@ void main() { await tester.pumpWidget(chipWidget(enabled: false)); await tester.pumpAndSettle(); expect(textColor(), disabledColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Chip uses stateful border side from resolveWith pattern', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/choice_chip_test.dart b/packages/flutter/test/material/choice_chip_test.dart index 1fcf539520..2f97610fd2 100644 --- a/packages/flutter/test/material/choice_chip_test.dart +++ b/packages/flutter/test/material/choice_chip_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; RenderBox getMaterialBox(WidgetTester tester, Finder type) { return tester.firstRenderObject( diff --git a/packages/flutter/test/material/circle_avatar_test.dart b/packages/flutter/test/material/circle_avatar_test.dart index 93ede89c0c..8487f124cf 100644 --- a/packages/flutter/test/material/circle_avatar_test.dart +++ b/packages/flutter/test/material/circle_avatar_test.dart @@ -12,8 +12,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../image_data.dart'; import '../painting/mocks_for_image_cache.dart'; diff --git a/packages/flutter/test/material/data_table_test.dart b/packages/flutter/test/material/data_table_test.dart index 356301629f..8b71d9eca4 100644 --- a/packages/flutter/test/material/data_table_test.dart +++ b/packages/flutter/test/material/data_table_test.dart @@ -11,9 +11,9 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'package:vector_math/vector_math_64.dart' show Matrix3; -import '../foundation/leak_tracking.dart'; import 'data_table_test_utils.dart'; void main() { diff --git a/packages/flutter/test/material/data_table_theme_test.dart b/packages/flutter/test/material/data_table_theme_test.dart index 0f922cb0a4..ea5d19235c 100644 --- a/packages/flutter/test/material/data_table_theme_test.dart +++ b/packages/flutter/test/material/data_table_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('DataTableThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/date_range_picker_test.dart b/packages/flutter/test/material/date_range_picker_test.dart index c9e5c544c2..021a85b5db 100644 --- a/packages/flutter/test/material/date_range_picker_test.dart +++ b/packages/flutter/test/material/date_range_picker_test.dart @@ -8,8 +8,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'feedback_tester.dart'; void main() { @@ -260,6 +259,7 @@ void main() { // https://github.com/flutter/flutter/issues/130354 leakTrackingTestConfig: const LeakTrackingTestConfig( allowAllNotGCed: true, + allowAllNotDisposed: true, )); }); diff --git a/packages/flutter/test/material/debug_test.dart b/packages/flutter/test/material/debug_test.dart index d3d01556d4..4ff2481973 100644 --- a/packages/flutter/test/material/debug_test.dart +++ b/packages/flutter/test/material/debug_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('debugCheckHasMaterial control test', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/desktop_text_selection_toolbar_button_test.dart b/packages/flutter/test/material/desktop_text_selection_toolbar_button_test.dart index d42cbc638c..e025948ea0 100644 --- a/packages/flutter/test/material/desktop_text_selection_toolbar_button_test.dart +++ b/packages/flutter/test/material/desktop_text_selection_toolbar_button_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/material/desktop_text_selection_toolbar_test.dart b/packages/flutter/test/material/desktop_text_selection_toolbar_test.dart index 5eb0c67c54..3a0652b7b3 100644 --- a/packages/flutter/test/material/desktop_text_selection_toolbar_test.dart +++ b/packages/flutter/test/material/desktop_text_selection_toolbar_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart index 4ba0c9b5e0..d26707e986 100644 --- a/packages/flutter/test/material/dialog_test.dart +++ b/packages/flutter/test/material/dialog_test.dart @@ -9,8 +9,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; MaterialApp _buildAppWithDialog( @@ -2338,7 +2337,7 @@ void main() { }); group('AlertDialog.scrollable: ', () { - testWidgetsWithLeakTracking('Title is scrollable', (WidgetTester tester) async { + testWidgets('Title is scrollable', (WidgetTester tester) async { final Key titleKey = UniqueKey(); final AlertDialog dialog = AlertDialog( title: Container( @@ -2378,7 +2377,7 @@ void main() { expect(box.localToGlobal(Offset.zero), equals(originalOffset.translate(0.0, -200.0))); }); - testWidgetsWithLeakTracking('Title and content are scrollable', (WidgetTester tester) async { + testWidgets('Title and content are scrollable', (WidgetTester tester) async { final Key titleKey = UniqueKey(); final Key contentKey = UniqueKey(); final AlertDialog dialog = AlertDialog( @@ -2511,7 +2510,7 @@ void main() { semantics.dispose(); }); - testWidgetsWithLeakTracking('DialogRoute is state restorable', (WidgetTester tester) async { + testWidgets('DialogRoute is state restorable', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( restorationScopeId: 'app', @@ -2660,6 +2659,9 @@ void main() { expect(await previousFocus(), true); expect(okNode.hasFocus, true); expect(cancelNode.hasFocus, false); + + cancelNode.dispose(); + okNode.dispose(); }); testWidgets('Adaptive AlertDialog shows correct widget on each platform', (WidgetTester tester) async { @@ -2764,7 +2766,7 @@ void main() { expect(find.text('Dialog2'), findsOneWidget); }); - testWidgetsWithLeakTracking('Uses open focus traversal when overridden', (WidgetTester tester) async { + testWidgets('Uses open focus traversal when overridden', (WidgetTester tester) async { final FocusNode okNode = FocusNode(); final FocusNode cancelNode = FocusNode(); diff --git a/packages/flutter/test/material/drawer_button_test.dart b/packages/flutter/test/material/drawer_button_test.dart index 872e633e7b..4e42ba7dcd 100644 --- a/packages/flutter/test/material/drawer_button_test.dart +++ b/packages/flutter/test/material/drawer_button_test.dart @@ -5,11 +5,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { - testWidgetsWithLeakTracking('DrawerButton control test', (WidgetTester tester) async { + testWidgets('DrawerButton control test', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: Scaffold( @@ -171,7 +170,7 @@ void main() { handle.dispose(); }, variant: TargetPlatformVariant.all()); - testWidgetsWithLeakTracking('EndDrawerButton control test', (WidgetTester tester) async { + testWidgets('EndDrawerButton control test', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: Scaffold( diff --git a/packages/flutter/test/material/dropdown_form_field_test.dart b/packages/flutter/test/material/dropdown_form_field_test.dart index 6b13161d31..582f0e8888 100644 --- a/packages/flutter/test/material/dropdown_form_field_test.dart +++ b/packages/flutter/test/material/dropdown_form_field_test.dart @@ -8,8 +8,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - const List menuItems = ['one', 'two', 'three', 'four']; void onChanged(T _) { } final Type dropdownButtonType = DropdownButton( @@ -201,7 +199,7 @@ void main() { expect(hintEmptyLabel, oneValueLabel); }); - testWidgetsWithLeakTracking('label position test - show disabledHint: disable', (WidgetTester tester) async { + testWidgets('label position test - show disabledHint: disable', (WidgetTester tester) async { int? value; await tester.pumpWidget( @@ -239,7 +237,7 @@ void main() { expect(hintEmptyLabel, const Offset(0.0, 12.0)); }); - testWidgetsWithLeakTracking('label position test - show disabledHint: enable + null item', (WidgetTester tester) async { + testWidgets('label position test - show disabledHint: enable + null item', (WidgetTester tester) async { int? value; await tester.pumpWidget( @@ -264,7 +262,7 @@ void main() { expect(hintEmptyLabel, const Offset(0.0, 12.0)); }); - testWidgetsWithLeakTracking('label position test - show disabledHint: enable + empty item', (WidgetTester tester) async { + testWidgets('label position test - show disabledHint: enable + empty item', (WidgetTester tester) async { int? value; await tester.pumpWidget( @@ -314,7 +312,7 @@ void main() { expect(hintEmptyLabel, const Offset(0.0, 12.0)); }); - testWidgetsWithLeakTracking('label position test - no hint shown: enable + no selected + disabledHint', (WidgetTester tester) async { + testWidgets('label position test - no hint shown: enable + no selected + disabledHint', (WidgetTester tester) async { int? value; await tester.pumpWidget( @@ -352,7 +350,7 @@ void main() { expect(hintEmptyLabel, const Offset(0.0, 24.0)); }); - testWidgetsWithLeakTracking('label position test - show selected item: disabled + hint + disabledHint', (WidgetTester tester) async { + testWidgets('label position test - show selected item: disabled + hint + disabledHint', (WidgetTester tester) async { const int value = 1; await tester.pumpWidget( @@ -392,7 +390,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/82910 - testWidgetsWithLeakTracking('null value test', (WidgetTester tester) async { + testWidgets('null value test', (WidgetTester tester) async { int? value = 1; await tester.pumpWidget( @@ -493,7 +491,7 @@ void main() { expect(value, equals('three')); }); - testWidgetsWithLeakTracking('DropdownButtonFormField arrow icon aligns with the edge of button when expanded', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField arrow icon aligns with the edge of button when expanded', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); // There shouldn't be overflow when expanded although list contains longer items. @@ -528,7 +526,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('DropdownButtonFormField with isDense:true aligns selected menu item', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField with isDense:true aligns selected menu item', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); await tester.pumpWidget( @@ -568,7 +566,7 @@ void main() { } }); - testWidgetsWithLeakTracking('DropdownButtonFormField with isDense:true does not clip large scale text', + testWidgets('DropdownButtonFormField with isDense:true does not clip large scale text', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); const String value = 'two'; @@ -607,7 +605,7 @@ void main() { expect(box.size.height, 72.0); }); - testWidgetsWithLeakTracking('DropdownButtonFormField.isDense is true by default', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField.isDense is true by default', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/46844 final Key buttonKey = UniqueKey(); const String value = 'two'; @@ -638,7 +636,7 @@ void main() { expect(box.size.height, 48.0); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - custom text style', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - custom text style', (WidgetTester tester) async { const String value = 'foo'; final UniqueKey itemKey = UniqueKey(); @@ -676,7 +674,7 @@ void main() { expect(richText.text.style!.fontSize, 20.0); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - disabledHint displays when the items list is empty, when items is null', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - disabledHint displays when the items list is empty, when items is null', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); Widget build({ List? items }) { @@ -699,7 +697,7 @@ void main() { expect(find.text('disabled'), findsOneWidget); }); - testWidgetsWithLeakTracking( + testWidgets( 'DropdownButtonFormField - hint displays when the items list is ' 'empty, items is null, and disabledHint is null', (WidgetTester tester) async { @@ -723,7 +721,7 @@ void main() { }, ); - testWidgetsWithLeakTracking('DropdownButtonFormField - disabledHint is null by default', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - disabledHint is null by default', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); Widget build({ List? items }) { @@ -743,7 +741,7 @@ void main() { expect(find.text('hint used when disabled'), findsOneWidget); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - disabledHint is null by default', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - disabledHint is null by default', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); Widget build({ List? items }) { @@ -763,7 +761,7 @@ void main() { expect(find.text('hint used when disabled'), findsOneWidget); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - disabledHint displays when onChanged is null', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - disabledHint displays when onChanged is null', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); Widget build({ List? items, ValueChanged? onChanged }) { @@ -781,7 +779,7 @@ void main() { expect(find.text('disabled'), findsOneWidget); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - disabled hint should be of same size as enabled hint', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - disabled hint should be of same size as enabled hint', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); Widget build({ List? items}) { @@ -806,7 +804,7 @@ void main() { expect(enabledHintBox.size, equals(disabledHintBox.size)); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - Custom icon size and colors', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - Custom icon size and colors', (WidgetTester tester) async { final Key iconKey = UniqueKey(); final Icon customIcon = Icon(Icons.assessment, key: iconKey); @@ -839,7 +837,7 @@ void main() { expect(disabledRichText.text.style!.color, Colors.orange); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - default elevation', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - default elevation', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); debugDisableShadows = false; await tester.pumpWidget(buildFormFrame( @@ -896,7 +894,7 @@ void main() { debugDisableShadows = true; }); - testWidgetsWithLeakTracking('DropdownButtonFormField does not allow duplicate item values', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField does not allow duplicate item values', (WidgetTester tester) async { final List> itemsWithDuplicateValues = ['a', 'b', 'c', 'c'] .map>((String value) { return DropdownMenuItem( @@ -925,7 +923,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('DropdownButtonFormField value should only appear in one menu item', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField value should only appear in one menu item', (WidgetTester tester) async { final List> itemsWithDuplicateValues = ['a', 'b', 'c', 'd'] .map>((String value) { return DropdownMenuItem( @@ -1090,7 +1088,7 @@ void main() { expect(find.text(currentValue), findsOneWidget); }); - testWidgetsWithLeakTracking('autovalidateMode is passed to super', (WidgetTester tester) async { + testWidgets('autovalidateMode is passed to super', (WidgetTester tester) async { int validateCalled = 0; await tester.pumpWidget( @@ -1119,7 +1117,7 @@ void main() { expect(validateCalled, 1); }); - testWidgetsWithLeakTracking('DropdownButtonFormField - Custom button alignment', (WidgetTester tester) async { + testWidgets('DropdownButtonFormField - Custom button alignment', (WidgetTester tester) async { await tester.pumpWidget(buildFormFrame( buttonAlignment: AlignmentDirectional.center, items: ['one'], diff --git a/packages/flutter/test/material/dropdown_menu_theme_test.dart b/packages/flutter/test/material/dropdown_menu_theme_test.dart index dcfd4ff75e..dabb572db8 100644 --- a/packages/flutter/test/material/dropdown_menu_theme_test.dart +++ b/packages/flutter/test/material/dropdown_menu_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('DropdownMenuThemeData copyWith, ==, hashCode basics', () { @@ -44,7 +43,7 @@ void main() { expect(description, []); }); - testWidgetsWithLeakTracking('With no other configuration, defaults are used', (WidgetTester tester) async { + testWidgets('With no other configuration, defaults are used', (WidgetTester tester) async { final ThemeData themeData = ThemeData(); await tester.pumpWidget( MaterialApp( @@ -101,7 +100,7 @@ void main() { expect(material.textStyle?.color, themeData.colorScheme.onSurface); }); - testWidgetsWithLeakTracking('ThemeData.dropdownMenuTheme overrides defaults', (WidgetTester tester) async { + testWidgets('ThemeData.dropdownMenuTheme overrides defaults', (WidgetTester tester) async { final ThemeData theme = ThemeData( dropdownMenuTheme: DropdownMenuThemeData( textStyle: TextStyle( @@ -180,7 +179,7 @@ void main() { expect(material.textStyle?.color, theme.colorScheme.onSurface); }); - testWidgetsWithLeakTracking('DropdownMenuTheme overrides ThemeData and defaults', (WidgetTester tester) async { + testWidgets('DropdownMenuTheme overrides ThemeData and defaults', (WidgetTester tester) async { final DropdownMenuThemeData global = DropdownMenuThemeData( textStyle: TextStyle( color: Colors.orange, @@ -283,7 +282,7 @@ void main() { expect(material.textStyle?.color, theme.colorScheme.onSurface); }); - testWidgetsWithLeakTracking('Widget parameters overrides DropdownMenuTheme, ThemeData and defaults', (WidgetTester tester) async { + testWidgets('Widget parameters overrides DropdownMenuTheme, ThemeData and defaults', (WidgetTester tester) async { final DropdownMenuThemeData global = DropdownMenuThemeData( textStyle: TextStyle( color: Colors.orange, diff --git a/packages/flutter/test/material/elevated_button_test.dart b/packages/flutter/test/material/elevated_button_test.dart index 0f504b5283..34db08eca1 100644 --- a/packages/flutter/test/material/elevated_button_test.dart +++ b/packages/flutter/test/material/elevated_button_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -196,6 +195,7 @@ void main() { await gesture.moveTo(center); await tester.pumpAndSettle(); await expectLater(tester, meetsGuideline(textContrastGuideline)); + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -259,6 +259,8 @@ void main() { await tester.pumpAndSettle(); expect(elevation(), 1.0); expect(overlayColor(), paints..rect(color: theme.colorScheme.primary.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('ElevatedButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -334,6 +336,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(textColor(), pressedColor); + + focusNode.dispose(); }); @@ -410,6 +414,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(iconColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('ElevatedButton onPressed and onLongPress callbacks are correctly called when non-null', (WidgetTester tester) async { @@ -534,6 +540,8 @@ void main() { await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('disabled and hovered ElevatedButton responds to mouse-exit', (WidgetTester tester) async { @@ -625,6 +633,8 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('When ElevatedButton disable, Can not set ElevatedButton focus.', (WidgetTester tester) async { @@ -648,6 +658,9 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + + node.dispose(); }); testWidgetsWithLeakTracking('Does ElevatedButton work with hover', (WidgetTester tester) async { @@ -703,6 +716,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does ElevatedButton work with autofocus', (WidgetTester tester) async { @@ -733,6 +748,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does ElevatedButton contribute semantics', (WidgetTester tester) async { @@ -1667,7 +1684,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); - testWidgetsWithLeakTracking('ElevatedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('ElevatedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/104595. await tester.pumpWidget(MaterialApp( home: SelectionArea( @@ -1865,15 +1882,15 @@ void main() { await gesture.removePointer(); } - testWidgetsWithLeakTracking('ElevatedButton statesController', (WidgetTester tester) async { + testWidgets('ElevatedButton statesController', (WidgetTester tester) async { testStatesController(null, tester); }); - testWidgetsWithLeakTracking('ElevatedButton.icon statesController', (WidgetTester tester) async { + testWidgets('ElevatedButton.icon statesController', (WidgetTester tester) async { testStatesController(const Icon(Icons.add), tester); }); - testWidgetsWithLeakTracking('Disabled ElevatedButton statesController', (WidgetTester tester) async { + testWidgets('Disabled ElevatedButton statesController', (WidgetTester tester) async { int count = 0; void valueChanged() { count += 1; diff --git a/packages/flutter/test/material/elevated_button_theme_test.dart b/packages/flutter/test/material/elevated_button_theme_test.dart index 449da915d4..aa713c2369 100644 --- a/packages/flutter/test/material/elevated_button_theme_test.dart +++ b/packages/flutter/test/material/elevated_button_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('ElevatedButtonThemeData lerp special cases', () { diff --git a/packages/flutter/test/material/expand_icon_test.dart b/packages/flutter/test/material/expand_icon_test.dart index 5908befe00..b6998cc58f 100644 --- a/packages/flutter/test/material/expand_icon_test.dart +++ b/packages/flutter/test/material/expand_icon_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; Widget wrap({ required Widget child, ThemeData? theme }) { return MaterialApp( diff --git a/packages/flutter/test/material/expansion_panel_test.dart b/packages/flutter/test/material/expansion_panel_test.dart index 0f3c1e6e14..c60cd9a0cc 100644 --- a/packages/flutter/test/material/expansion_panel_test.dart +++ b/packages/flutter/test/material/expansion_panel_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class SimpleExpansionPanelListTestWidget extends StatefulWidget { const SimpleExpansionPanelListTestWidget({ diff --git a/packages/flutter/test/material/expansion_tile_test.dart b/packages/flutter/test/material/expansion_tile_test.dart index 6763491178..3c6d9640a5 100644 --- a/packages/flutter/test/material/expansion_tile_test.dart +++ b/packages/flutter/test/material/expansion_tile_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestIcon extends StatefulWidget { const TestIcon({super.key}); diff --git a/packages/flutter/test/material/expansion_tile_theme_test.dart b/packages/flutter/test/material/expansion_tile_theme_test.dart index 582d2486e4..f21b095156 100644 --- a/packages/flutter/test/material/expansion_tile_theme_test.dart +++ b/packages/flutter/test/material/expansion_tile_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestIcon extends StatefulWidget { const TestIcon({super.key}); diff --git a/packages/flutter/test/material/feedback_test.dart b/packages/flutter/test/material/feedback_test.dart index 1a1a4ef2a1..95cc70b7cb 100644 --- a/packages/flutter/test/material/feedback_test.dart +++ b/packages/flutter/test/material/feedback_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; diff --git a/packages/flutter/test/material/filled_button_test.dart b/packages/flutter/test/material/filled_button_test.dart index b2d29c7142..2940dac610 100644 --- a/packages/flutter/test/material/filled_button_test.dart +++ b/packages/flutter/test/material/filled_button_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -340,6 +339,7 @@ void main() { await tester.pumpAndSettle(); expect(elevation(), 0.0); expect(overlayColor(), paints..rect(color: theme.colorScheme.onPrimary.withOpacity(0.12))); + focusNode.dispose(); }); testWidgetsWithLeakTracking('FilledButton.tonal default overlayColor and elevation resolve pressed state', (WidgetTester tester) async { @@ -405,6 +405,7 @@ void main() { await tester.pumpAndSettle(); expect(elevation(), 0.0); expect(overlayColor(), paints..rect(color: theme.colorScheme.onSecondaryContainer.withOpacity(0.12))); + focusNode.dispose(); }); testWidgetsWithLeakTracking('FilledButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -480,6 +481,7 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(textColor(), pressedColor); + focusNode.dispose(); }); @@ -556,6 +558,7 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(iconColor(), pressedColor); + focusNode.dispose(); }); testWidgetsWithLeakTracking('FilledButton onPressed and onLongPress callbacks are correctly called when non-null', (WidgetTester tester) async { @@ -680,6 +683,7 @@ void main() { await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + focusNode.dispose(); }); testWidgetsWithLeakTracking('disabled and hovered FilledButton responds to mouse-exit', (WidgetTester tester) async { @@ -771,6 +775,7 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + node.dispose(); }); testWidgetsWithLeakTracking('When FilledButton disable, Can not set FilledButton focus.', (WidgetTester tester) async { @@ -794,6 +799,7 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + node.dispose(); }); testWidgetsWithLeakTracking('Does FilledButton work with hover', (WidgetTester tester) async { @@ -849,6 +855,7 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does FilledButton work with autofocus', (WidgetTester tester) async { @@ -879,6 +886,7 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does FilledButton contribute semantics', (WidgetTester tester) async { @@ -1741,7 +1749,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); - testWidgetsWithLeakTracking('FilledButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('FilledButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/104595. await tester.pumpWidget(MaterialApp( home: SelectionArea( @@ -1937,15 +1945,15 @@ void main() { await gesture.removePointer(); } - testWidgetsWithLeakTracking('FilledButton statesController', (WidgetTester tester) async { + testWidgets('FilledButton statesController', (WidgetTester tester) async { testStatesController(null, tester); }); - testWidgetsWithLeakTracking('FilledButton.icon statesController', (WidgetTester tester) async { + testWidgets('FilledButton.icon statesController', (WidgetTester tester) async { testStatesController(const Icon(Icons.add), tester); }); - testWidgetsWithLeakTracking('Disabled FilledButton statesController', (WidgetTester tester) async { + testWidgets('Disabled FilledButton statesController', (WidgetTester tester) async { int count = 0; void valueChanged() { count += 1; diff --git a/packages/flutter/test/material/filled_button_theme_test.dart b/packages/flutter/test/material/filled_button_theme_test.dart index ab30f3c60e..2b0ff185dd 100644 --- a/packages/flutter/test/material/filled_button_theme_test.dart +++ b/packages/flutter/test/material/filled_button_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('FilledButtonThemeData lerp special cases', () { diff --git a/packages/flutter/test/material/filter_chip_test.dart b/packages/flutter/test/material/filter_chip_test.dart index 30dbbfed3b..3d46afa83f 100644 --- a/packages/flutter/test/material/filter_chip_test.dart +++ b/packages/flutter/test/material/filter_chip_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; /// Adds the basic requirements for a Chip. Widget wrapForChip({ diff --git a/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart b/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart index 4d481b87b7..f66f471b56 100644 --- a/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart +++ b/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; final Key blockKey = UniqueKey(); const double expandedAppbarHeight = 250.0; @@ -51,7 +50,7 @@ void main() { expect(topAfterScroll.dy, equals(0.0)); }, variant: TargetPlatformVariant.all(excluding: { TargetPlatform.fuchsia })); - testWidgetsWithLeakTracking('FlexibleSpaceBar collapse mode pin', (WidgetTester tester) async { + testWidgets('FlexibleSpaceBar collapse mode pin', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(platform: debugDefaultTargetPlatformOverride), @@ -89,7 +88,7 @@ void main() { expect(topAfterScroll.dy, equals(-100.0)); }, variant: TargetPlatformVariant.all(excluding: { TargetPlatform.fuchsia })); - testWidgetsWithLeakTracking('FlexibleSpaceBar collapse mode parallax', (WidgetTester tester) async { + testWidgets('FlexibleSpaceBar collapse mode parallax', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(platform: debugDefaultTargetPlatformOverride), diff --git a/packages/flutter/test/material/flexible_space_bar_stretch_mode_test.dart b/packages/flutter/test/material/flexible_space_bar_stretch_mode_test.dart index 4fa49ea934..f515061f0c 100644 --- a/packages/flutter/test/material/flexible_space_bar_stretch_mode_test.dart +++ b/packages/flutter/test/material/flexible_space_bar_stretch_mode_test.dart @@ -9,8 +9,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; final Key blockKey = UniqueKey(); const double expandedAppbarHeight = 250.0; @@ -92,7 +91,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('FlexibleSpaceBar stretch mode fadeTitle', (WidgetTester tester) async { + testWidgets('FlexibleSpaceBar stretch mode fadeTitle', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( @@ -136,7 +135,7 @@ void main() { expect(opacityWidget.opacity, equals(0.0)); }); - testWidgetsWithLeakTracking('FlexibleSpaceBar stretch mode ignored for non-overscroll physics', (WidgetTester tester) async { + testWidgets('FlexibleSpaceBar stretch mode ignored for non-overscroll physics', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( diff --git a/packages/flutter/test/material/flexible_space_bar_test.dart b/packages/flutter/test/material/flexible_space_bar_test.dart index 4f37ab2db2..b1f34bebd9 100644 --- a/packages/flutter/test/material/flexible_space_bar_test.dart +++ b/packages/flutter/test/material/flexible_space_bar_test.dart @@ -10,8 +10,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { diff --git a/packages/flutter/test/material/floating_action_button_location_test.dart b/packages/flutter/test/material/floating_action_button_location_test.dart index 932b632617..5b87324bc5 100644 --- a/packages/flutter/test/material/floating_action_button_location_test.dart +++ b/packages/flutter/test/material/floating_action_button_location_test.dart @@ -7,8 +7,7 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { group('Basic floating action button locations', () { @@ -185,7 +184,7 @@ void main() { await tester.pumpAndSettle(); }); - testWidgetsWithLeakTracking('interrupting motion towards the StartTop location.', (WidgetTester tester) async { + testWidgets('interrupting motion towards the StartTop location.', (WidgetTester tester) async { await tester.pumpWidget(_buildFrame(location: FloatingActionButtonLocation.centerFloat, listener: geometryListener)); setupListener(tester); @@ -198,7 +197,7 @@ void main() { await tester.pumpAndSettle(); }); - testWidgetsWithLeakTracking('interrupting entrance to remove the fab.', (WidgetTester tester) async { + testWidgets('interrupting entrance to remove the fab.', (WidgetTester tester) async { await tester.pumpWidget(_buildFrame(fab: null, location: FloatingActionButtonLocation.centerFloat, listener: geometryListener)); setupListener(tester); @@ -217,7 +216,7 @@ void main() { await tester.pumpAndSettle(); }); - testWidgetsWithLeakTracking('interrupting entrance of a new fab.', (WidgetTester tester) async { + testWidgets('interrupting entrance of a new fab.', (WidgetTester tester) async { await tester.pumpWidget( _buildFrame( fab: null, diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart index 189573dfc0..7cda152c9e 100644 --- a/packages/flutter/test/material/floating_action_button_test.dart +++ b/packages/flutter/test/material/floating_action_button_test.dart @@ -13,8 +13,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -326,7 +325,7 @@ void main() { expect(tester.widget(find.byType(PhysicalShape)).elevation, 6.0); }); - testWidgetsWithLeakTracking('Floating Action Button states elevation', (WidgetTester tester) async { + testWidgets('Floating Action Button states elevation', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); await tester.pumpWidget( @@ -368,6 +367,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(getFABWidget(fabFinder).elevation, 6); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('FlatActionButton mini size is configurable by ThemeData.materialTapTargetSize', (WidgetTester tester) async { @@ -785,7 +786,7 @@ void main() { }); // This test prevents https://github.com/flutter/flutter/issues/20483 - testWidgetsWithLeakTracking('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { + testWidgets('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( @@ -909,6 +910,8 @@ void main() { tester.renderObject(find.byType(FloatingActionButton)), paintsExactlyCountTimes(#clipPath, 0), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Can find FloatingActionButton semantics', (WidgetTester tester) async { @@ -1164,7 +1167,7 @@ void main() { expect(tester.widget(find.byType(PhysicalShape)).elevation, 6.0); }); - testWidgetsWithLeakTracking('Floating Action Button states elevation', (WidgetTester tester) async { + testWidgets('Floating Action Button states elevation', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); await tester.pumpWidget( @@ -1206,6 +1209,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(getFABWidget(fabFinder).elevation, 12); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('FloatingActionButton.isExtended', (WidgetTester tester) async { @@ -1327,7 +1332,7 @@ void main() { // This test prevents https://github.com/flutter/flutter/issues/20483 - testWidgetsWithLeakTracking('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { + testWidgets('Floating Action Button clips ink splash and highlight', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( diff --git a/packages/flutter/test/material/floating_action_button_theme_test.dart b/packages/flutter/test/material/floating_action_button_theme_test.dart index dcc68ce96c..1c282d714f 100644 --- a/packages/flutter/test/material/floating_action_button_theme_test.dart +++ b/packages/flutter/test/material/floating_action_button_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('FloatingActionButtonThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/flutter_logo_test.dart b/packages/flutter/test/material/flutter_logo_test.dart index 284a965c03..66d9d2484e 100644 --- a/packages/flutter/test/material/flutter_logo_test.dart +++ b/packages/flutter/test/material/flutter_logo_test.dart @@ -9,8 +9,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('Flutter Logo golden test', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/grid_title_test.dart b/packages/flutter/test/material/grid_title_test.dart index bd4f17297b..ff5bd5bd5f 100644 --- a/packages/flutter/test/material/grid_title_test.dart +++ b/packages/flutter/test/material/grid_title_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('GridTile control test', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart index 19ea27f0ad..fce7855170 100644 --- a/packages/flutter/test/material/icon_button_test.dart +++ b/packages/flutter/test/material/icon_button_test.dart @@ -7,8 +7,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -100,13 +99,14 @@ void main() { testWidgetsWithLeakTracking('when both iconSize and IconTheme.of(context).size are null, size falls back to 24.0', (WidgetTester tester) async { final bool material3 = theme.useMaterial3; + final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus'); await tester.pumpWidget( wrap( useMaterial3: material3, child: IconTheme( data: const IconThemeData(), child: IconButton( - focusNode: FocusNode(debugLabel: 'Ink Focus'), + focusNode: focusNode, onPressed: mockOnPressedFunction.handler, icon: const Icon(Icons.link), ), @@ -116,6 +116,8 @@ void main() { final RenderBox icon = tester.renderObject(find.byType(Icon)); expect(icon.size, const Size(24.0, 24.0)); + + focusNode.dispose(); }); testWidgets('when null, iconSize is overridden by closest IconTheme', (WidgetTester tester) async { @@ -739,6 +741,8 @@ void main() { ); await tester.pump(); expect(focusNode.hasPrimaryFocus, isFalse); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('IconButton keeps focus when disabled in directional navigation mode.', (WidgetTester tester) async { @@ -781,6 +785,8 @@ void main() { ); await tester.pump(); expect(focusNode.hasPrimaryFocus, isTrue); + + focusNode.dispose(); }); testWidgetsWithLeakTracking("Disabled IconButton can't be traversed to when disabled.", (WidgetTester tester) async { @@ -817,6 +823,9 @@ void main() { expect(focusNode1.hasPrimaryFocus, isTrue); expect(focusNode2.hasPrimaryFocus, isFalse); + + focusNode1.dispose(); + focusNode2.dispose(); }); group('feedback', () { @@ -1240,6 +1249,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.onSurfaceVariant.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('IconButton.fill defaults - M3', (WidgetTester tester) async { @@ -1379,6 +1390,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.onPrimary.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Toggleable IconButton.fill defaults - M3', (WidgetTester tester) async { @@ -1633,6 +1646,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.onSecondaryContainer.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Toggleable IconButton.filledTonal defaults - M3', (WidgetTester tester) async { @@ -1887,6 +1902,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.onSurfaceVariant.withOpacity(0.08))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Toggleable IconButton.outlined defaults - M3', (WidgetTester tester) async { @@ -2047,6 +2064,8 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); await gesture.removePointer(); + + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -2135,6 +2154,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(iconColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does IconButton contribute semantics - M3', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/icon_button_theme_test.dart b/packages/flutter/test/material/icon_button_theme_test.dart index 20b2889b85..f0f3c8cd89 100644 --- a/packages/flutter/test/material/icon_button_theme_test.dart +++ b/packages/flutter/test/material/icon_button_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('IconButtonThemeData lerp special cases', () { diff --git a/packages/flutter/test/material/icons_test.dart b/packages/flutter/test/material/icons_test.dart index 01bd6c4cd1..adc51f4d32 100644 --- a/packages/flutter/test/material/icons_test.dart +++ b/packages/flutter/test/material/icons_test.dart @@ -12,10 +12,9 @@ import 'package:file/local.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'package:platform/platform.dart'; -import '../foundation/leak_tracking.dart'; - void main() { testWidgetsWithLeakTracking('IconData object test', (WidgetTester tester) async { expect(Icons.account_balance, isNot(equals(Icons.account_box))); diff --git a/packages/flutter/test/material/ink_paint_test.dart b/packages/flutter/test/material/ink_paint_test.dart index 5dc4710697..082e1a42ef 100644 --- a/packages/flutter/test/material/ink_paint_test.dart +++ b/packages/flutter/test/material/ink_paint_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('The Ink widget expands when no dimensions are set', (WidgetTester tester) async { @@ -271,7 +270,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('The InkWell widget renders an SelectAction or ActivateAction-induced ink ripple', (WidgetTester tester) async { + testWidgets('The InkWell widget renders an SelectAction or ActivateAction-induced ink ripple', (WidgetTester tester) async { const Color highlightColor = Color(0xAAFF0000); const Color splashColor = Color(0xB40000FF); const BorderRadius borderRadius = BorderRadius.all(Radius.circular(6.0)); @@ -454,7 +453,7 @@ void main() { })); }); - testWidgetsWithLeakTracking('The InkWell widget on OverlayPortal does not throw', (WidgetTester tester) async { + testWidgets('The InkWell widget on OverlayPortal does not throw', (WidgetTester tester) async { final OverlayPortalController controller = OverlayPortalController(); controller.show(); await tester.pumpWidget( diff --git a/packages/flutter/test/material/ink_sparkle_test.dart b/packages/flutter/test/material/ink_sparkle_test.dart index 707c0d934d..40b47d7625 100644 --- a/packages/flutter/test/material/ink_sparkle_test.dart +++ b/packages/flutter/test/material/ink_sparkle_test.dart @@ -10,8 +10,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter/src/foundation/constants.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('InkSparkle in a Button compiles and does not crash', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/ink_splash_test.dart b/packages/flutter/test/material/ink_splash_test.dart index aee7979469..ceb1c4b114 100644 --- a/packages/flutter/test/material/ink_splash_test.dart +++ b/packages/flutter/test/material/ink_splash_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { // Regression test for https://github.com/flutter/flutter/issues/21506. diff --git a/packages/flutter/test/material/ink_well_test.dart b/packages/flutter/test/material/ink_well_test.dart index 1019d9bf4c..ed2a5411f3 100644 --- a/packages/flutter/test/material/ink_well_test.dart +++ b/packages/flutter/test/material/ink_well_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/src/services/keyboard_key.g.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -250,6 +249,7 @@ void main() { inkFeatures, paints ..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff0000ff)), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('ink response changes color on focus with overlayColor', (WidgetTester tester) async { @@ -298,6 +298,7 @@ void main() { inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff0000ff)), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('ink well changes color on pressed with overlayColor', (WidgetTester tester) async { @@ -370,6 +371,7 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor)); await gesture.up(); + focusNode.dispose(); }); testWidgetsWithLeakTracking('ink response splashColor matches resolved overlayColor for MaterialState.pressed', (WidgetTester tester) async { @@ -419,6 +421,7 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor)); await gesture.up(); + focusNode.dispose(); }); testWidgetsWithLeakTracking('ink response uses radius for focus highlight', (WidgetTester tester) async { @@ -449,6 +452,7 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(inkFeatures, paints..circle(radius: 20, color: const Color(0xff0000ff))); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell uses borderRadius for focus highlight', (WidgetTester tester) async { @@ -485,6 +489,7 @@ void main() { rrect: RRect.fromLTRBR(350.0, 250.0, 450.0, 350.0, const Radius.circular(10)), color: const Color(0xff0000ff), )); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell uses borderRadius for hover highlight', (WidgetTester tester) async { @@ -576,6 +581,7 @@ void main() { sampleSize: 100, )), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell customBorder clips for hover highlight', (WidgetTester tester) async { @@ -667,6 +673,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t await tester.pumpAndSettle(); expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 1)); expect(inkFeatures, paints..circle(radius: 20, color: const Color(0xff0000ff))); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkResponse highlightShape can be updated', (WidgetTester tester) async { @@ -708,6 +715,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t await tester.pumpAndSettle(); expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0)); expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 1)); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell borderRadius can be updated', (WidgetTester tester) async { @@ -753,6 +761,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t rrect: RRect.fromLTRBR(350.0, 250.0, 450.0, 350.0, const Radius.circular(30)), color: const Color(0xff0000ff), )); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell customBorder can be updated', (WidgetTester tester) async { @@ -820,6 +829,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t sampleSize: 100, )), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell splash customBorder can be updated', (WidgetTester tester) async { @@ -908,6 +918,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t ); await gesture.up(); + focusNode.dispose(); }); testWidgetsWithLeakTracking("ink response doesn't change color on focus when on touch device", (WidgetTester tester) async { @@ -940,6 +951,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t focusNode.requestFocus(); await tester.pumpAndSettle(); expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0)); + focusNode.dispose(); }); testWidgetsWithLeakTracking('InkWell.mouseCursor changes cursor on hover', (WidgetTester tester) async { @@ -1029,7 +1041,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); - testWidgetsWithLeakTracking('InkResponse containing selectable text changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('InkResponse containing selectable text changes mouse cursor when hovered', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/104595. await tester.pumpWidget(MaterialApp( home: SelectionArea( @@ -1218,6 +1230,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t ); await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + focusNode.dispose(); }); testWidgetsWithLeakTracking('ink response accepts focus when disabled in directional navigation mode', (WidgetTester tester) async { @@ -1264,6 +1277,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t ); await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isTrue); + focusNode.dispose(); }); testWidgetsWithLeakTracking("ink response doesn't hover when disabled", (WidgetTester tester) async { @@ -1317,6 +1331,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + focusNode.dispose(); }); testWidgetsWithLeakTracking('When ink wells are nested, only the inner one is triggered by tap splash', (WidgetTester tester) async { @@ -2071,7 +2086,7 @@ testWidgetsWithLeakTracking('InkResponse radius can be updated', (WidgetTester t expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0)); }); - testWidgetsWithLeakTracking('InkWell dispose statesController', (WidgetTester tester) async { + testWidgets('InkWell disposes statesController', (WidgetTester tester) async { int tapCount = 0; Widget buildFrame(MaterialStatesController? statesController) { return MaterialApp( diff --git a/packages/flutter/test/material/input_chip_test.dart b/packages/flutter/test/material/input_chip_test.dart index a7f341072d..bb43b64cf4 100644 --- a/packages/flutter/test/material/input_chip_test.dart +++ b/packages/flutter/test/material/input_chip_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; /// Adds the basic requirements for a Chip. Widget wrapForChip({ @@ -241,6 +240,8 @@ void main() { ); await tester.pump(); expect(focusNode.hasPrimaryFocus, isFalse); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('cannot be traversed to when disabled', (WidgetTester tester) async { @@ -276,6 +277,9 @@ void main() { await tester.pump(); expect(focusNode1.hasPrimaryFocus, isTrue); expect(focusNode2.hasPrimaryFocus, isFalse); + + focusNode1.dispose(); + focusNode2.dispose(); }); testWidgetsWithLeakTracking('Input chip check mark color is determined by platform brightness when light', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/input_date_picker_form_field_test.dart b/packages/flutter/test/material/input_date_picker_form_field_test.dart index 50275ffe79..076b3978f4 100644 --- a/packages/flutter/test/material/input_date_picker_form_field_test.dart +++ b/packages/flutter/test/material/input_date_picker_form_field_test.dart @@ -7,7 +7,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; import '../widgets/clipboard_utils.dart'; class TestMaterialLocalizations extends DefaultMaterialLocalizations { @@ -98,7 +97,7 @@ void main() { group('InputDatePickerFormField', () { - testWidgetsWithLeakTracking('Initial date is the default', (WidgetTester tester) async { + testWidgets('Initial date is the default', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); final DateTime initialDate = DateTime(2016, DateTime.february, 21); DateTime? inputDate; @@ -112,7 +111,7 @@ void main() { expect(inputDate, equals(initialDate)); }); - testWidgetsWithLeakTracking('Changing initial date is reflected in text value', (WidgetTester tester) async { + testWidgets('Changing initial date is reflected in text value', (WidgetTester tester) async { final DateTime initialDate = DateTime(2016, DateTime.february, 21); final DateTime updatedInitialDate = DateTime(2016, DateTime.february, 23); await tester.pumpWidget(inputDatePickerField( @@ -127,7 +126,7 @@ void main() { expect(textFieldController(tester).value.text, equals('02/23/2016')); }); - testWidgetsWithLeakTracking('Valid date entry', (WidgetTester tester) async { + testWidgets('Valid date entry', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); DateTime? inputDate; await tester.pumpWidget(inputDatePickerField( @@ -140,7 +139,7 @@ void main() { expect(inputDate, equals(DateTime(2016, DateTime.february, 21))); }); - testWidgetsWithLeakTracking('Invalid text entry shows errorFormat text', (WidgetTester tester) async { + testWidgets('Invalid text entry shows errorFormat text', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); DateTime? inputDate; await tester.pumpWidget(inputDatePickerField( @@ -167,7 +166,7 @@ void main() { expect(find.text('That is not a date.'), findsOneWidget); }); - testWidgetsWithLeakTracking('Valid text entry, but date outside first or last date shows bounds shows errorInvalid text', (WidgetTester tester) async { + testWidgets('Valid text entry, but date outside first or last date shows bounds shows errorInvalid text', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); DateTime? inputDate; await tester.pumpWidget(inputDatePickerField( @@ -202,7 +201,7 @@ void main() { expect(find.text('Not in given range.'), findsOneWidget); }); - testWidgetsWithLeakTracking('selectableDatePredicate will be used to show errorInvalid if date is not selectable', (WidgetTester tester) async { + testWidgets('selectableDatePredicate will be used to show errorInvalid if date is not selectable', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); DateTime? inputDate; await tester.pumpWidget(inputDatePickerField( @@ -228,7 +227,7 @@ void main() { expect(find.text('Out of range.'), findsNothing); }); - testWidgetsWithLeakTracking('Empty field shows hint text when focused', (WidgetTester tester) async { + testWidgets('Empty field shows hint text when focused', (WidgetTester tester) async { await tester.pumpWidget(inputDatePickerField()); // Focus on it await tester.tap(find.byType(TextField)); @@ -251,7 +250,7 @@ void main() { expect(textOpacity(tester, 'Enter some date'), equals(0.0)); }); - testWidgetsWithLeakTracking('Label text', (WidgetTester tester) async { + testWidgets('Label text', (WidgetTester tester) async { await tester.pumpWidget(inputDatePickerField()); // Default label expect(find.text('Enter Date'), findsOneWidget); @@ -263,7 +262,7 @@ void main() { expect(find.text('Give me a date!'), findsOneWidget); }); - testWidgetsWithLeakTracking('Semantics', (WidgetTester tester) async { + testWidgets('Semantics', (WidgetTester tester) async { final SemanticsHandle semantics = tester.ensureSemantics(); // Fill the clipboard so that the Paste option is available in the text @@ -292,7 +291,7 @@ void main() { semantics.dispose(); }); - testWidgetsWithLeakTracking('InputDecorationTheme is honored', (WidgetTester tester) async { + testWidgets('InputDecorationTheme is honored', (WidgetTester tester) async { const InputBorder border = InputBorder.none; await tester.pumpWidget(inputDatePickerField( theme: ThemeData.from(colorScheme: const ColorScheme.light()).copyWith( @@ -326,7 +325,7 @@ void main() { expect(containerColor, equals(Colors.transparent)); }); - testWidgetsWithLeakTracking('Date text localization', (WidgetTester tester) async { + testWidgets('Date text localization', (WidgetTester tester) async { final Iterable> delegates = >[ TestMaterialLocalizationsDelegate(), DefaultWidgetsLocalizations.delegate, @@ -349,7 +348,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('when an empty date is entered and acceptEmptyDate is true, then errorFormatText is not shown', (WidgetTester tester) async { + testWidgets('when an empty date is entered and acceptEmptyDate is true, then errorFormatText is not shown', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); const String errorFormatText = 'That is not a date.'; await tester.pumpWidget(inputDatePickerField( @@ -364,7 +363,7 @@ void main() { expect(find.text(errorFormatText), findsNothing); }); - testWidgetsWithLeakTracking('when an empty date is entered and acceptEmptyDate is false, then errorFormatText is shown', (WidgetTester tester) async { + testWidgets('when an empty date is entered and acceptEmptyDate is false, then errorFormatText is shown', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); const String errorFormatText = 'That is not a date.'; await tester.pumpWidget(inputDatePickerField( diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index c80d641bd6..8e491d7193 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -906,6 +905,8 @@ void main() { rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), ), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('ListTile can be hovered and has correct hover color', (WidgetTester tester) async { @@ -1236,6 +1237,8 @@ void main() { await tester.pump(); expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('ListTile respects tileColor & selectedTileColor', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/list_tile_theme_test.dart b/packages/flutter/test/material/list_tile_theme_test.dart index f07f79528b..8b92ae3ab6 100644 --- a/packages/flutter/test/material/list_tile_theme_test.dart +++ b/packages/flutter/test/material/list_tile_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; class TestIcon extends StatefulWidget { const TestIcon({ super.key }); @@ -568,7 +567,7 @@ void main() { expect(find.byType(Material), paints..rect(color: selectedTileColor)); }); - testWidgetsWithLeakTracking('ListTile uses ListTileTheme shape in a drawer', (WidgetTester tester) async { + testWidgets('ListTile uses ListTileTheme shape in a drawer', (WidgetTester tester) async { // This is a regression test for https://github.com/flutter/flutter/issues/106303 final GlobalKey scaffoldKey = GlobalKey(); diff --git a/packages/flutter/test/material/localizations_test.dart b/packages/flutter/test/material/localizations_test.dart index 83b3738f05..7382be5ac2 100644 --- a/packages/flutter/test/material/localizations_test.dart +++ b/packages/flutter/test/material/localizations_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('English translations exist for all MaterialLocalizations properties', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/magnifier_test.dart b/packages/flutter/test/material/magnifier_test.dart index f700ca40c9..9abf8906b2 100644 --- a/packages/flutter/test/material/magnifier_test.dart +++ b/packages/flutter/test/material/magnifier_test.dart @@ -9,8 +9,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { final MagnifierController magnifierController = MagnifierController(); const Rect reasonableTextField = Rect.fromLTRB(50, 100, 200, 100); @@ -112,7 +110,7 @@ void main() { group('magnifier', () { group('position', () { - testWidgetsWithLeakTracking( + testWidgets( 'should be at gesture position if does not violate any positioning rules', (WidgetTester tester) async { final Key textField = UniqueKey(); @@ -168,7 +166,7 @@ void main() { ); }); - testWidgetsWithLeakTracking( + testWidgets( 'should never move outside the right bounds of the editing line', (WidgetTester tester) async { const double gestureOutsideLine = 100; @@ -201,7 +199,7 @@ void main() { lessThanOrEqualTo(reasonableTextField.right)); }); - testWidgetsWithLeakTracking( + testWidgets( 'should never move outside the left bounds of the editing line', (WidgetTester tester) async { const double gestureOutsideLine = 100; @@ -233,7 +231,7 @@ void main() { greaterThanOrEqualTo(reasonableTextField.left)); }); - testWidgetsWithLeakTracking('should position vertically at the center of the line', (WidgetTester tester) async { + testWidgets('should position vertically at the center of the line', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp( home: Placeholder(), )); @@ -256,7 +254,7 @@ void main() { reasonableTextField.center.dy - basicOffset.dy); }); - testWidgetsWithLeakTracking('should reposition vertically if mashed against the ceiling', + testWidgets('should reposition vertically if mashed against the ceiling', (WidgetTester tester) async { final Rect topOfScreenTextFieldRect = Rect.fromPoints(Offset.zero, const Offset(200, 0)); @@ -291,7 +289,7 @@ void main() { return magnifier.additionalFocalPointOffset; } - testWidgetsWithLeakTracking( + testWidgets( 'should shift focal point so that the lens sees nothing out of bounds', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp( @@ -319,7 +317,7 @@ void main() { lessThan(reasonableTextField.left)); }); - testWidgetsWithLeakTracking( + testWidgets( 'focal point should shift if mashed against the top to always point to text', (WidgetTester tester) async { final Rect topOfScreenTextFieldRect = @@ -356,7 +354,7 @@ void main() { return animatedPositioned.duration.compareTo(Duration.zero) != 0; } - testWidgetsWithLeakTracking('should not be animated on the initial state', + testWidgets('should not be animated on the initial state', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp( home: Placeholder(), @@ -381,7 +379,7 @@ void main() { expect(getIsAnimated(tester), false); }); - testWidgetsWithLeakTracking('should not be animated on horizontal shifts', + testWidgets('should not be animated on horizontal shifts', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp( home: Placeholder(), @@ -415,7 +413,7 @@ void main() { expect(getIsAnimated(tester), false); }); - testWidgetsWithLeakTracking('should be animated on vertical shifts', + testWidgets('should be animated on vertical shifts', (WidgetTester tester) async { const Offset verticalShift = Offset(0, 200); @@ -451,7 +449,7 @@ void main() { expect(getIsAnimated(tester), true); }); - testWidgetsWithLeakTracking('should stop being animated when timer is up', + testWidgets('should stop being animated when timer is up', (WidgetTester tester) async { const Offset verticalShift = Offset(0, 200); diff --git a/packages/flutter/test/material/material_button_test.dart b/packages/flutter/test/material/material_button_test.dart index 1e79a48320..3ef6687f05 100644 --- a/packages/flutter/test/material/material_button_test.dart +++ b/packages/flutter/test/material/material_button_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -143,6 +142,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('MaterialButton elevation and colors have proper precedence', (WidgetTester tester) async { @@ -215,6 +216,8 @@ void main() { expect(inkFeatures, paints..rect(color: focusColor)..rect(color: highlightColor)); expect(material.elevation, equals(highlightElevation)); await gesture2.up(); + + focusNode.dispose(); }); testWidgetsWithLeakTracking("MaterialButton's disabledColor takes precedence over its default disabled color.", (WidgetTester tester) async { @@ -299,6 +302,8 @@ void main() { await tester.pump(); expect(focusNode.hasPrimaryFocus, isTrue); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('MaterialButton onPressed and onLongPress callbacks are correctly called when non-null', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/material_state_mixin_test.dart b/packages/flutter/test/material/material_state_mixin_test.dart index 684fe32e34..f45afb6539 100644 --- a/packages/flutter/test/material/material_state_mixin_test.dart +++ b/packages/flutter/test/material/material_state_mixin_test.dart @@ -6,8 +6,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; const Key key = Key('testContainer'); const Color trueColor = Colors.red; diff --git a/packages/flutter/test/material/material_test.dart b/packages/flutter/test/material/material_test.dart index e717fb242e..cbf76ec4de 100644 --- a/packages/flutter/test/material/material_test.dart +++ b/packages/flutter/test/material/material_test.dart @@ -10,8 +10,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/test_border.dart' show TestBorder; class NotifyMaterial extends StatelessWidget { diff --git a/packages/flutter/test/material/menu_bar_theme_test.dart b/packages/flutter/test/material/menu_bar_theme_test.dart index e5a8536754..2b9dabe7f4 100644 --- a/packages/flutter/test/material/menu_bar_theme_test.dart +++ b/packages/flutter/test/material/menu_bar_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { void onPressed(TestMenu item) {} @@ -54,7 +53,7 @@ void main() { expect(identical(MenuBarThemeData.lerp(data, data, 0.5), data), true); }); - testWidgetsWithLeakTracking('theme is honored', (WidgetTester tester) async { + testWidgets('theme is honored', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), diff --git a/packages/flutter/test/material/menu_style_test.dart b/packages/flutter/test/material/menu_style_test.dart index acc6d20797..dc501b68bc 100644 --- a/packages/flutter/test/material/menu_style_test.dart +++ b/packages/flutter/test/material/menu_style_test.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; void main() { Finder findMenuPanels() { @@ -43,7 +42,7 @@ void main() { expect(identical(MenuStyle.lerp(data, data, 0.5), data), true); }); - testWidgetsWithLeakTracking('fixedSize affects geometry', (WidgetTester tester) async { + testWidgets('fixedSize affects geometry', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -86,7 +85,7 @@ void main() { expect(tester.getRect(findMenuPanels().at(1)).size, equals(const Size(100.0, 100.0))); }); - testWidgetsWithLeakTracking('maximumSize affects geometry', (WidgetTester tester) async { + testWidgets('maximumSize affects geometry', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -129,7 +128,7 @@ void main() { expect(tester.getRect(findMenuPanels().at(1)).size, equals(const Size(100.0, 100.0))); }); - testWidgetsWithLeakTracking('minimumSize affects geometry', (WidgetTester tester) async { + testWidgets('minimumSize affects geometry', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -172,7 +171,7 @@ void main() { expect(tester.getRect(findMenuPanels().at(1)).size, equals(const Size(300.0, 300.0))); }); - testWidgetsWithLeakTracking('Material parameters are honored', (WidgetTester tester) async { + testWidgets('Material parameters are honored', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -238,7 +237,7 @@ void main() { expect(panelPadding.padding, equals(const EdgeInsets.all(20))); }); - testWidgetsWithLeakTracking('visual density', (WidgetTester tester) async { + testWidgets('visual density', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), diff --git a/packages/flutter/test/material/menu_theme_test.dart b/packages/flutter/test/material/menu_theme_test.dart index 868d4eb7f9..bb4c0cd3ce 100644 --- a/packages/flutter/test/material/menu_theme_test.dart +++ b/packages/flutter/test/material/menu_theme_test.dart @@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; -import '../foundation/leak_tracking.dart'; void main() { void onPressed(TestMenu item) {} @@ -54,7 +54,7 @@ void main() { expect(identical(MenuThemeData.lerp(data, data, 0.5), data), true); }); - testWidgetsWithLeakTracking('theme is honored', (WidgetTester tester) async { + testWidgets('theme is honored', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -107,7 +107,8 @@ void main() { expect(subMenuMaterial.color, equals(Colors.red)); }); - testWidgetsWithLeakTracking('Constructor parameters override theme parameters', (WidgetTester tester) async { + testWidgetsWithLeakTracking('Constructor parameters override theme parameters', + (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), diff --git a/packages/flutter/test/material/mergeable_material_test.dart b/packages/flutter/test/material/mergeable_material_test.dart index 1d184edb0f..7598403270 100644 --- a/packages/flutter/test/material/mergeable_material_test.dart +++ b/packages/flutter/test/material/mergeable_material_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; enum RadiusType { Sharp, @@ -80,7 +79,7 @@ void main() { expect(box.size.height, equals(0)); }); - testWidgetsWithLeakTracking('MergeableMaterial update slice', (WidgetTester tester) async { + testWidgets('MergeableMaterial update slice', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: Scaffold( @@ -234,7 +233,7 @@ void main() { debugDisableShadows = true; }); - testWidgetsWithLeakTracking('MergeableMaterial skips shadow for zero elevation', (WidgetTester tester) async { + testWidgets('MergeableMaterial skips shadow for zero elevation', (WidgetTester tester) async { debugDisableShadows = false; await tester.pumpWidget( const MaterialApp( @@ -1168,7 +1167,7 @@ void main() { ); } - testWidgetsWithLeakTracking('MergeableMaterial dividers', (WidgetTester tester) async { + testWidgets('MergeableMaterial dividers', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData(useMaterial3: false), @@ -1330,7 +1329,7 @@ void main() { expect(decoration.border!.top.color, dividerColor); }); - testWidgetsWithLeakTracking('MergeableMaterial respects MaterialSlice.color', (WidgetTester tester) async { + testWidgets('MergeableMaterial respects MaterialSlice.color', (WidgetTester tester) async { const Color themeCardColor = Colors.red; const Color materialSliceColor = Colors.green; diff --git a/packages/flutter/test/material/navigation_bar_test.dart b/packages/flutter/test/material/navigation_bar_test.dart index 1736729c91..f38a4830f6 100644 --- a/packages/flutter/test/material/navigation_bar_test.dart +++ b/packages/flutter/test/material/navigation_bar_test.dart @@ -13,8 +13,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('Navigation bar updates destinations when tapped', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/navigation_bar_theme_test.dart b/packages/flutter/test/material/navigation_bar_theme_test.dart index 0e1ce6dafb..71d27bafc2 100644 --- a/packages/flutter/test/material/navigation_bar_theme_test.dart +++ b/packages/flutter/test/material/navigation_bar_theme_test.dart @@ -11,8 +11,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/navigation_drawer_test.dart b/packages/flutter/test/material/navigation_drawer_test.dart index 2e8befad6d..cde4e4eb0e 100644 --- a/packages/flutter/test/material/navigation_drawer_test.dart +++ b/packages/flutter/test/material/navigation_drawer_test.dart @@ -5,10 +5,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { - testWidgetsWithLeakTracking('Navigation drawer updates destinations when tapped', + testWidgets('Navigation drawer updates destinations when tapped', (WidgetTester tester) async { int mutatedIndex = -1; final GlobalKey scaffoldKey = GlobalKey(); @@ -51,7 +49,7 @@ void main() { expect(mutatedIndex, 0); }); - testWidgetsWithLeakTracking('NavigationDrawer can update background color', + testWidgets('NavigationDrawer can update background color', (WidgetTester tester) async { const Color color = Colors.yellow; final GlobalKey scaffoldKey = GlobalKey(); @@ -84,7 +82,7 @@ void main() { expect(_getMaterial(tester).color, equals(color)); }); - testWidgetsWithLeakTracking('NavigationDrawer can update elevation', + testWidgets('NavigationDrawer can update elevation', (WidgetTester tester) async { const double elevation = 42.0; final GlobalKey scaffoldKey = GlobalKey(); @@ -116,7 +114,7 @@ void main() { expect(_getMaterial(tester).elevation, equals(elevation)); }); - testWidgetsWithLeakTracking( + testWidgets( 'NavigationDrawer uses proper defaults when no parameters are given', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); @@ -165,7 +163,7 @@ void main() { expect(iconBox.size, const Size(24.0, 24.0)); }); - testWidgetsWithLeakTracking('Navigation drawer is scrollable', (WidgetTester tester) async { + testWidgets('Navigation drawer is scrollable', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); widgetSetup(tester, 500, viewHeight: 300); await tester.pumpWidget( @@ -212,7 +210,7 @@ void main() { expect(find.text('Label10'), findsNothing); }); - testWidgetsWithLeakTracking('Safe Area test', (WidgetTester tester) async { + testWidgets('Safe Area test', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); const double viewHeight = 300; widgetSetup(tester, 500, viewHeight: viewHeight); @@ -253,7 +251,7 @@ void main() { expect(tester.getBottomRight(find.widgetWithText(NavigationDrawerDestination,'Label4')).dy, viewHeight); }); - testWidgetsWithLeakTracking('Navigation drawer semantics', (WidgetTester tester) async { + testWidgets('Navigation drawer semantics', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); final ThemeData theme= ThemeData.from(colorScheme: const ColorScheme.light()); Widget widget({int selectedIndex = 0}) { @@ -323,7 +321,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Navigation destination updates indicator color and shape', (WidgetTester tester) async { + testWidgets('Navigation destination updates indicator color and shape', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); final ThemeData theme = ThemeData(useMaterial3: true); const Color color = Color(0xff0000ff); @@ -374,7 +372,7 @@ void main() { expect(_getInkWell(tester)?.customBorder, shape); }); - testWidgetsWithLeakTracking('NavigationDrawer.tilePadding defaults to EdgeInsets.symmetric(horizontal: 12.0)', (WidgetTester tester) async { + testWidgets('NavigationDrawer.tilePadding defaults to EdgeInsets.symmetric(horizontal: 12.0)', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); widgetSetup(tester, 3000, viewHeight: 3000); final Widget widget = _buildWidget( diff --git a/packages/flutter/test/material/navigation_rail_test.dart b/packages/flutter/test/material/navigation_rail_test.dart index d2872221da..b94dc65194 100644 --- a/packages/flutter/test/material/navigation_rail_test.dart +++ b/packages/flutter/test/material/navigation_rail_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { diff --git a/packages/flutter/test/material/outlined_button_test.dart b/packages/flutter/test/material/outlined_button_test.dart index 61a14a6b96..a147a4651e 100644 --- a/packages/flutter/test/material/outlined_button_test.dart +++ b/packages/flutter/test/material/outlined_button_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -227,6 +226,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.primary.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does OutlinedButton work with hover', (WidgetTester tester) async { @@ -285,6 +286,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does OutlinedButton work with autofocus', (WidgetTester tester) async { @@ -315,6 +318,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgets('Default OutlinedButton meets a11y contrast guidelines', (WidgetTester tester) async { @@ -360,6 +365,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); await expectLater(tester, meetsGuideline(textContrastGuideline)); + + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -429,6 +436,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. await expectLater(tester, meetsGuideline(textContrastGuideline)); + + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -498,6 +507,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(textColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('OutlinedButton uses stateful color for icon color in different states', (WidgetTester tester) async { @@ -565,6 +576,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(iconColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('OutlinedButton uses stateful color for border color in different states', (WidgetTester tester) async { @@ -633,6 +646,8 @@ void main() { await gesture.down(center); await tester.pumpAndSettle(); expect(outlinedButton, paints..drrect(color: pressedColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('OutlinedButton onPressed and onLongPress callbacks are correctly called when non-null', (WidgetTester tester) async { @@ -727,6 +742,8 @@ void main() { await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('disabled and hovered OutlinedButton responds to mouse-exit', (WidgetTester tester) async { @@ -818,6 +835,8 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('When OutlinedButton disable, Can not set OutlinedButton focus.', (WidgetTester tester) async { @@ -841,6 +860,8 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking("Outline button doesn't crash if disabled during a gesture", (WidgetTester tester) async { @@ -1816,7 +1837,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); - testWidgetsWithLeakTracking('OutlinedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('OutlinedButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/104595. await tester.pumpWidget(MaterialApp( home: SelectionArea( @@ -1969,15 +1990,15 @@ void main() { await gesture.removePointer(); } - testWidgetsWithLeakTracking('OutlinedButton statesController', (WidgetTester tester) async { + testWidgets('OutlinedButton statesController', (WidgetTester tester) async { testStatesController(null, tester); }); - testWidgetsWithLeakTracking('OutlinedButton.icon statesController', (WidgetTester tester) async { + testWidgets('OutlinedButton.icon statesController', (WidgetTester tester) async { testStatesController(const Icon(Icons.add), tester); }); - testWidgetsWithLeakTracking('Disabled OutlinedButton statesController', (WidgetTester tester) async { + testWidgets('Disabled OutlinedButton statesController', (WidgetTester tester) async { int count = 0; void valueChanged() { count += 1; diff --git a/packages/flutter/test/material/outlined_button_theme_test.dart b/packages/flutter/test/material/outlined_button_theme_test.dart index 57a57f4e7b..d29697eaa8 100644 --- a/packages/flutter/test/material/outlined_button_theme_test.dart +++ b/packages/flutter/test/material/outlined_button_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('OutlinedButtonThemeData lerp special cases', () { diff --git a/packages/flutter/test/material/page_selector_test.dart b/packages/flutter/test/material/page_selector_test.dart index 2a46455781..3d2d0fed61 100644 --- a/packages/flutter/test/material/page_selector_test.dart +++ b/packages/flutter/test/material/page_selector_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; const Color kSelectedColor = Color(0xFF00FF00); const Color kUnselectedColor = Colors.transparent; @@ -208,7 +207,7 @@ void main() { expect(indicatorColors(tester), const [kBlue, kRed, kRed]); }); - testWidgetsWithLeakTracking('PageSelector indicatorSize', (WidgetTester tester) async { + testWidgets('PageSelector indicatorSize', (WidgetTester tester) async { final TabController tabController = TabController( vsync: const TestVSync(), initialIndex: 1, diff --git a/packages/flutter/test/material/page_transitions_theme_test.dart b/packages/flutter/test/material/page_transitions_theme_test.dart index d43fdc737c..210bc065c5 100644 --- a/packages/flutter/test/material/page_transitions_theme_test.dart +++ b/packages/flutter/test/material/page_transitions_theme_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('Default PageTransitionsTheme platform', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/persistent_bottom_sheet_test.dart b/packages/flutter/test/material/persistent_bottom_sheet_test.dart index eb7c6eec93..cb8025e14f 100644 --- a/packages/flutter/test/material/persistent_bottom_sheet_test.dart +++ b/packages/flutter/test/material/persistent_bottom_sheet_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { // Pumps and ensures that the BottomSheet animates non-linearly. @@ -124,7 +123,7 @@ void main() { expect(buildCount, equals(2)); }); - testWidgetsWithLeakTracking('Verify that a persistent BottomSheet cannot be dismissed', (WidgetTester tester) async { + testWidgets('Verify that a persistent BottomSheet cannot be dismissed', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: Scaffold( body: const Center(child: Text('body')), @@ -187,7 +186,7 @@ void main() { expect(find.text('Two'), findsNothing); }); - testWidgetsWithLeakTracking('Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal', (WidgetTester tester) async { + testWidgets('Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); await tester.pumpWidget(MaterialApp( @@ -299,7 +298,7 @@ void main() { expect(find.text('Two'), findsNothing); }); - testWidgetsWithLeakTracking('Verify that a persistent BottomSheet can fling up and hide the fab', (WidgetTester tester) async { + testWidgets('Verify that a persistent BottomSheet can fling up and hide the fab', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( @@ -410,7 +409,7 @@ void main() { expect(find.text('Item 22'), findsNothing); }); - testWidgetsWithLeakTracking('Verify that a scrollable BottomSheet hides the fab when scrolled up', (WidgetTester tester) async { + testWidgets('Verify that a scrollable BottomSheet hides the fab when scrolled up', (WidgetTester tester) async { final GlobalKey scaffoldKey = GlobalKey(); await tester.pumpWidget(MaterialApp( @@ -590,7 +589,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/71435 - testWidgetsWithLeakTracking( + testWidgets( 'Scaffold.bottomSheet should be updated without creating a new RO' ' when the new widget has the same key and type.', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/popup_menu_theme_test.dart b/packages/flutter/test/material/popup_menu_theme_test.dart index 4096d698f8..f17caec690 100644 --- a/packages/flutter/test/material/popup_menu_theme_test.dart +++ b/packages/flutter/test/material/popup_menu_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; PopupMenuThemeData _popupMenuThemeM2() { return PopupMenuThemeData( diff --git a/packages/flutter/test/material/progress_indicator_test.dart b/packages/flutter/test/material/progress_indicator_test.dart index 21545cb3f8..2c1a72ce88 100644 --- a/packages/flutter/test/material/progress_indicator_test.dart +++ b/packages/flutter/test/material/progress_indicator_test.dart @@ -17,8 +17,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { final ThemeData theme = ThemeData(); diff --git a/packages/flutter/test/material/radio_test.dart b/packages/flutter/test/material/radio_test.dart index 4ad6e7e9cb..f3605238b4 100644 --- a/packages/flutter/test/material/radio_test.dart +++ b/packages/flutter/test/material/radio_test.dart @@ -16,8 +16,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter/src/gestures/constants.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -584,6 +583,7 @@ void main() { ..circle(color: const Color(0x61000000)) ..circle(color: const Color(0x61000000)), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Radio is focusable and has correct focus color', (WidgetTester tester) async { @@ -662,6 +662,7 @@ void main() { ..circle(color: theme.colorScheme.onSurface.withOpacity(0.38)) ..circle(color: theme.colorScheme.onSurface.withOpacity(0.38)), ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material2 - Radio can be hovered and has correct hover color', (WidgetTester tester) async { @@ -908,6 +909,8 @@ void main() { await tester.sendKeyEvent(LogicalKeyboardKey.space); await tester.pumpAndSettle(); expect(groupValue, equals(2)); + + focusNode2.dispose(); }); testWidgetsWithLeakTracking('Radio responds to density changes.', (WidgetTester tester) async { @@ -1224,6 +1227,8 @@ void main() { ..circle(color: theme.hoverColor) ..circle(color: hoveredFillColor), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Radio fill color resolves in hovered/focused states', (WidgetTester tester) async { @@ -1302,6 +1307,8 @@ void main() { ..circle(color: theme.colorScheme.primary.withOpacity(0.08)) ..circle(color: hoveredFillColor), ); + + focusNode.dispose(); }); testWidgets('Radio overlay color resolves in active/pressed/focused/hovered states', (WidgetTester tester) async { @@ -1447,6 +1454,8 @@ void main() { ), reason: 'Hovered Radio should use overlay color $hoverOverlayColor over $hoverColor', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Do not crash when widget disappears while pointer is down', (WidgetTester tester) async { @@ -1710,6 +1719,8 @@ void main() { Material.of(tester.element(find.byType(Radio))), paints..circle(color: theme.hoverColor)..circle(color: colors.secondary) ); + + focusNode.dispose(); }); testWidgets('Material3 - Radio button default overlay colors in hover/focus/press states', (WidgetTester tester) async { @@ -1796,6 +1807,8 @@ void main() { Material.of(tester.element(find.byType(Radio))), paints..circle(color: colors.primary.withOpacity(0.08))..circle(color: colors.primary.withOpacity(1)) ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Radio.adaptive shows the correct platform widget', (WidgetTester tester) async { @@ -1892,6 +1905,7 @@ void main() { ..circle(color: theme.focusColor) ..circle(color: theme.colorScheme.secondary) ); + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Radio default overlayColor and fillColor resolves pressed state', (WidgetTester tester) async { @@ -1957,5 +1971,6 @@ void main() { ..circle(color: theme.colorScheme.primary.withOpacity(0.12)) ..circle(color: theme.colorScheme.primary) ); + focusNode.dispose(); }); } diff --git a/packages/flutter/test/material/radio_theme_test.dart b/packages/flutter/test/material/radio_theme_test.dart index d763972842..5c8c186121 100644 --- a/packages/flutter/test/material/radio_theme_test.dart +++ b/packages/flutter/test/material/radio_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('RadioThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/range_slider_test.dart b/packages/flutter/test/material/range_slider_test.dart index 0f4f227046..f89cfe9957 100644 --- a/packages/flutter/test/material/range_slider_test.dart +++ b/packages/flutter/test/material/range_slider_test.dart @@ -9,11 +9,9 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/src/physics/utils.dart' show nearEqual; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { // Regression test for https://github.com/flutter/flutter/issues/105833 - testWidgetsWithLeakTracking('Drag gesture uses provided gesture settings', (WidgetTester tester) async { + testWidgets('Drag gesture uses provided gesture settings', (WidgetTester tester) async { RangeValues values = const RangeValues(0.1, 0.5); bool dragStarted = false; final Key sliderKey = UniqueKey(); @@ -119,7 +117,7 @@ void main() { expect(dragStarted, false); }); - testWidgetsWithLeakTracking('Range Slider can move when tapped (continuous LTR)', (WidgetTester tester) async { + testWidgets('Range Slider can move when tapped (continuous LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -173,7 +171,7 @@ void main() { expect(values.end, moreOrLessEquals(0.9, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider can move when tapped (continuous RTL)', (WidgetTester tester) async { + testWidgets('Range Slider can move when tapped (continuous RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -227,7 +225,7 @@ void main() { expect(values.end, moreOrLessEquals(0.9, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider can move when tapped (discrete LTR)', (WidgetTester tester) async { + testWidgets('Range Slider can move when tapped (discrete LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -285,7 +283,7 @@ void main() { expect(values.end.round(), equals(90)); }); - testWidgetsWithLeakTracking('Range Slider can move when tapped (discrete RTL)', (WidgetTester tester) async { + testWidgets('Range Slider can move when tapped (discrete RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -343,7 +341,7 @@ void main() { expect(values.end.round(), equals(90)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged to the min and max (continuous LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged to the min and max (continuous LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -387,7 +385,7 @@ void main() { expect(values.end, equals(1)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged to the min and max (continuous RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged to the min and max (continuous RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -431,7 +429,7 @@ void main() { expect(values.start, equals(0)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged to the min and max (discrete LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged to the min and max (discrete LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -477,7 +475,7 @@ void main() { expect(values.end, equals(100)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged to the min and max (discrete RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged to the min and max (discrete RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -523,7 +521,7 @@ void main() { expect(values.start, equals(0)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (continuous LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (continuous LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -573,7 +571,7 @@ void main() { expect(values.start, moreOrLessEquals(0.2, epsilon: 0.05)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (continuous RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (continuous RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -623,7 +621,7 @@ void main() { expect(values.start, moreOrLessEquals(0.2, epsilon: 0.05)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (discrete LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (discrete LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -675,7 +673,7 @@ void main() { expect(values.start, moreOrLessEquals(20, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (discrete RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the start thumb can be dragged apart (discrete RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -727,7 +725,7 @@ void main() { expect(values.start, moreOrLessEquals(20, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (continuous LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (continuous LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -777,7 +775,7 @@ void main() { expect(values.end, moreOrLessEquals(0.8, epsilon: 0.05)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (continuous RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (continuous RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); await tester.pumpWidget( @@ -827,7 +825,7 @@ void main() { expect(values.end, moreOrLessEquals(0.8, epsilon: 0.05)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (discrete LTR)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (discrete LTR)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -879,7 +877,7 @@ void main() { expect(values.end, moreOrLessEquals(80, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (discrete RTL)', (WidgetTester tester) async { + testWidgets('Range Slider thumbs can be dragged together and the end thumb can be dragged apart (discrete RTL)', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); await tester.pumpWidget( @@ -931,7 +929,7 @@ void main() { expect(values.end, moreOrLessEquals(80, epsilon: 0.01)); }); - testWidgetsWithLeakTracking('Range Slider onChangeEnd and onChangeStart are called on an interaction initiated by tap', (WidgetTester tester) async { + testWidgets('Range Slider onChangeEnd and onChangeStart are called on an interaction initiated by tap', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); RangeValues? startValues; RangeValues? endValues; @@ -985,7 +983,7 @@ void main() { expect(endValues!.end, moreOrLessEquals(70, epsilon: 1)); }); - testWidgetsWithLeakTracking('Range Slider onChangeEnd and onChangeStart are called on an interaction initiated by drag', (WidgetTester tester) async { + testWidgets('Range Slider onChangeEnd and onChangeStart are called on an interaction initiated by drag', (WidgetTester tester) async { RangeValues values = const RangeValues(30, 70); late RangeValues startValues; late RangeValues endValues; @@ -1100,7 +1098,7 @@ void main() { ); } - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes for a default enabled slider', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes for a default enabled slider', (WidgetTester tester) async { final ThemeData theme = buildTheme(); final SliderThemeData sliderTheme = theme.sliderTheme; @@ -1129,7 +1127,7 @@ void main() { expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes when setting the active color', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes when setting the active color', (WidgetTester tester) async { const Color activeColor = Color(0xcafefeed); final ThemeData theme = buildTheme(); final SliderThemeData sliderTheme = theme.sliderTheme; @@ -1157,7 +1155,7 @@ void main() { expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes when setting the inactive color', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes when setting the inactive color', (WidgetTester tester) async { const Color inactiveColor = Color(0xdeadbeef); final ThemeData theme = buildTheme(); final SliderThemeData sliderTheme = theme.sliderTheme; @@ -1184,7 +1182,7 @@ void main() { expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes with active and inactive colors', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes with active and inactive colors', (WidgetTester tester) async { const Color activeColor = Color(0xcafefeed); const Color inactiveColor = Color(0xdeadbeef); final ThemeData theme = buildTheme(); @@ -1217,7 +1215,7 @@ void main() { expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes for a discrete slider', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes for a discrete slider', (WidgetTester tester) async { final ThemeData theme = buildTheme(); final SliderThemeData sliderTheme = theme.sliderTheme; @@ -1247,7 +1245,7 @@ void main() { expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes for a discrete slider with active and inactive colors', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes for a discrete slider with active and inactive colors', (WidgetTester tester) async { const Color activeColor = Color(0xcafefeed); const Color inactiveColor = Color(0xdeadbeef); final ThemeData theme = buildTheme(); @@ -1288,7 +1286,7 @@ void main() { expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes for a default disabled slider', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes for a default disabled slider', (WidgetTester tester) async { final ThemeData theme = buildTheme(); final SliderThemeData sliderTheme = theme.sliderTheme; @@ -1308,7 +1306,7 @@ void main() { expect(sliderBox, isNot(paints..rect(color: sliderTheme.inactiveTrackColor))); }); - testWidgetsWithLeakTracking('Range Slider uses the right theme colors for the right shapes for a disabled slider with active and inactive colors', (WidgetTester tester) async { + testWidgets('Range Slider uses the right theme colors for the right shapes for a disabled slider with active and inactive colors', (WidgetTester tester) async { const Color activeColor = Color(0xcafefeed); const Color inactiveColor = Color(0xdeadbeef); final ThemeData theme = buildTheme(); @@ -1497,7 +1495,7 @@ void main() { await tester.pumpAndSettle(); }); - testWidgetsWithLeakTracking('Range Slider top thumb gets stroked when overlapping', (WidgetTester tester) async { + testWidgets('Range Slider top thumb gets stroked when overlapping', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); final ThemeData theme = ThemeData( @@ -1564,7 +1562,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Range Slider top value indicator gets stroked when overlapping', (WidgetTester tester) async { + testWidgets('Range Slider top value indicator gets stroked when overlapping', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); final ThemeData theme = ThemeData( @@ -1638,7 +1636,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('Range Slider top value indicator gets stroked when overlapping with large text scale', (WidgetTester tester) async { + testWidgets('Range Slider top value indicator gets stroked when overlapping with large text scale', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); final ThemeData theme = ThemeData( @@ -1715,7 +1713,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('Range Slider thumb gets stroked when overlapping', (WidgetTester tester) async { + testWidgets('Range Slider thumb gets stroked when overlapping', (WidgetTester tester) async { RangeValues values = const RangeValues(0.3, 0.7); final ThemeData theme = ThemeData( @@ -1796,7 +1794,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/101868 - testWidgetsWithLeakTracking('RangeSlider.label info should not write to semantic node', (WidgetTester tester) async { + testWidgets('RangeSlider.label info should not write to semantic node', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Theme( @@ -1854,7 +1852,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Range Slider Semantics - ltr', (WidgetTester tester) async { + testWidgets('Range Slider Semantics - ltr', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Theme( @@ -1938,7 +1936,7 @@ void main() { ]); }); - testWidgetsWithLeakTracking('Range Slider Semantics - rtl', (WidgetTester tester) async { + testWidgets('Range Slider Semantics - rtl', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Theme( @@ -2020,7 +2018,7 @@ void main() { ]); }); - testWidgetsWithLeakTracking('Range Slider implements debugFillProperties', (WidgetTester tester) async { + testWidgets('Range Slider implements debugFillProperties', (WidgetTester tester) async { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); RangeSlider( @@ -2051,7 +2049,7 @@ void main() { ]); }); - testWidgetsWithLeakTracking('Range Slider can be painted in a narrower constraint when track shape is RoundedRectRange', (WidgetTester tester) async { + testWidgets('Range Slider can be painted in a narrower constraint when track shape is RoundedRectRange', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Directionality( @@ -2090,7 +2088,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Range Slider can be painted in a narrower constraint when track shape is Rectangular', (WidgetTester tester) async { + testWidgets('Range Slider can be painted in a narrower constraint when track shape is Rectangular', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData( @@ -2135,7 +2133,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Update the divisions and values at the same time for RangeSlider', (WidgetTester tester) async { + testWidgets('Update the divisions and values at the same time for RangeSlider', (WidgetTester tester) async { // Regress test for https://github.com/flutter/flutter/issues/65943 Widget buildFrame(double maxValue) { return MaterialApp( @@ -2179,7 +2177,7 @@ void main() { expect(nearEqual(activeTrackRect.right, (800.0 - 24.0 - 24.0) * (8 / 15) + 24.0, 0.01), true); }); - testWidgetsWithLeakTracking('RangeSlider changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('RangeSlider changes mouse cursor when hovered', (WidgetTester tester) async { const RangeValues values = RangeValues(50, 70); // Test default cursor. @@ -2234,7 +2232,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text); }); - testWidgetsWithLeakTracking('RangeSlider MaterialStateMouseCursor resolves correctly', (WidgetTester tester) async { + testWidgets('RangeSlider MaterialStateMouseCursor resolves correctly', (WidgetTester tester) async { RangeValues values = const RangeValues(50, 70); const MouseCursor disabledCursor = SystemMouseCursors.basic; const MouseCursor hoveredCursor = SystemMouseCursors.grab; @@ -2308,7 +2306,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), draggedCursor); }); - testWidgetsWithLeakTracking('RangeSlider can be hovered and has correct hover color', (WidgetTester tester) async { + testWidgets('RangeSlider can be hovered and has correct hover color', (WidgetTester tester) async { tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; RangeValues values = const RangeValues(50, 70); final ThemeData theme = ThemeData(); @@ -2371,7 +2369,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('RangeSlider is draggable and has correct dragged color', (WidgetTester tester) async { + testWidgets('RangeSlider is draggable and has correct dragged color', (WidgetTester tester) async { tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; RangeValues values = const RangeValues(50, 70); final ThemeData theme = ThemeData(); @@ -2427,7 +2425,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('RangeSlider overlayColor supports hovered and dragged states', (WidgetTester tester) async { + testWidgets('RangeSlider overlayColor supports hovered and dragged states', (WidgetTester tester) async { tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; RangeValues values = const RangeValues(50, 70); const Color hoverColor = Color(0xffff0000); @@ -2542,7 +2540,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('RangeSlider onChangeStart and onChangeEnd fire once', (WidgetTester tester) async { + testWidgets('RangeSlider onChangeStart and onChangeEnd fire once', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/128433 int startFired = 0; diff --git a/packages/flutter/test/material/raw_material_button_test.dart b/packages/flutter/test/material/raw_material_button_test.dart index 2306e083df..3736ab1a31 100644 --- a/packages/flutter/test/material/raw_material_button_test.dart +++ b/packages/flutter/test/material/raw_material_button_test.dart @@ -8,8 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/src/services/keyboard_key.g.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -108,6 +107,7 @@ void main() { await tester.pumpAndSettle(); expect(pressed, isTrue); + focusNode.dispose(); }); testWidgetsWithLeakTracking('materialTapTargetSize.padded expands hit test area', (WidgetTester tester) async { @@ -345,6 +345,7 @@ void main() { await tester.pumpAndSettle(const Duration(seconds: 1)); expect(box, paints..rect(color: focusColor)); + focusNode.dispose(); }); testWidgetsWithLeakTracking('RawMaterialButton loses focus when disabled.', (WidgetTester tester) async { @@ -379,6 +380,7 @@ void main() { await tester.pump(); expect(focusNode.hasPrimaryFocus, isFalse); + focusNode.dispose(); }); testWidgetsWithLeakTracking("Disabled RawMaterialButton can't be traversed to.", (WidgetTester tester) async { @@ -419,6 +421,9 @@ void main() { expect(focusNode1.hasPrimaryFocus, isTrue); expect(focusNode2.hasPrimaryFocus, isFalse); + + focusNode1.dispose(); + focusNode2.dispose(); }); testWidgetsWithLeakTracking('RawMaterialButton handles hover', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/refresh_indicator_test.dart b/packages/flutter/test/material/refresh_indicator_test.dart index 4378ff8cd8..23af466443 100644 --- a/packages/flutter/test/material/refresh_indicator_test.dart +++ b/packages/flutter/test/material/refresh_indicator_test.dart @@ -8,8 +8,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; bool refreshCalled = false; diff --git a/packages/flutter/test/material/scrollbar_paint_test.dart b/packages/flutter/test/material/scrollbar_paint_test.dart index 1686ff52e4..8c3ac02dd9 100644 --- a/packages/flutter/test/material/scrollbar_paint_test.dart +++ b/packages/flutter/test/material/scrollbar_paint_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; const Color _kAndroidThumbIdleColor = Color(0xffbcbcbc); @@ -79,7 +78,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('works with MaterialApp and Scaffold', (WidgetTester tester) async { + testWidgets('works with MaterialApp and Scaffold', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: MediaQuery( data: const MediaQueryData( @@ -123,7 +122,7 @@ void main() { ); }); - testWidgetsWithLeakTracking("should not paint when there isn't enough space", (WidgetTester tester) async { + testWidgets("should not paint when there isn't enough space", (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: MediaQuery( data: const MediaQueryData( diff --git a/packages/flutter/test/material/scrollbar_test.dart b/packages/flutter/test/material/scrollbar_test.dart index ffbaafea47..741adf448c 100644 --- a/packages/flutter/test/material/scrollbar_test.dart +++ b/packages/flutter/test/material/scrollbar_test.dart @@ -16,8 +16,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; const Duration _kScrollbarFadeDuration = Duration(milliseconds: 300); const Duration _kScrollbarTimeToFade = Duration(milliseconds: 600); diff --git a/packages/flutter/test/material/scrollbar_theme_test.dart b/packages/flutter/test/material/scrollbar_theme_test.dart index 15bb54f9f7..de07fda289 100644 --- a/packages/flutter/test/material/scrollbar_theme_test.dart +++ b/packages/flutter/test/material/scrollbar_theme_test.dart @@ -8,8 +8,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; // The const represents the starting position of the scrollbar thumb for // the below tests. The thumb is 90 pixels long, and 8 pixels wide, with a 2 diff --git a/packages/flutter/test/material/search_bar_theme_test.dart b/packages/flutter/test/material/search_bar_theme_test.dart index ce85e73e3c..cfa5064997 100644 --- a/packages/flutter/test/material/search_bar_theme_test.dart +++ b/packages/flutter/test/material/search_bar_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('SearchBarThemeData copyWith, ==, hashCode basics', () { @@ -243,19 +242,19 @@ void main() { expect(trailingRect.right, barRect.right - 16.0); } - testWidgetsWithLeakTracking('SearchBar properties overrides defaults', (WidgetTester tester) async { + testWidgets('SearchBar properties overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(useSearchBarProperties: true)); await tester.pumpAndSettle(); // allow the animations to finish checkSearchBar(tester); }); - testWidgetsWithLeakTracking('SearchBar theme data overrides defaults', (WidgetTester tester) async { + testWidgets('SearchBar theme data overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme)); await tester.pumpAndSettle(); checkSearchBar(tester); }); - testWidgetsWithLeakTracking('Overall Theme SearchBar theme overrides defaults', (WidgetTester tester) async { + testWidgets('Overall Theme SearchBar theme overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme)); await tester.pumpAndSettle(); checkSearchBar(tester); @@ -263,7 +262,7 @@ void main() { // Same as the previous tests with empty SearchBarThemeData's instead of null. - testWidgetsWithLeakTracking('SearchBar properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async { + testWidgets('SearchBar properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(useSearchBarProperties: true, searchBarThemeData: const SearchBarThemeData(), overallTheme: const SearchBarThemeData())); @@ -271,14 +270,14 @@ void main() { checkSearchBar(tester); }); - testWidgetsWithLeakTracking('SearchBar theme overrides defaults and overall theme', (WidgetTester tester) async { + testWidgets('SearchBar theme overrides defaults and overall theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(searchBarThemeData: searchBarTheme, overallTheme: const SearchBarThemeData())); await tester.pumpAndSettle(); // allow the animations to finish checkSearchBar(tester); }); - testWidgetsWithLeakTracking('Overall Theme SearchBar theme overrides defaults and null theme', (WidgetTester tester) async { + testWidgets('Overall Theme SearchBar theme overrides defaults and null theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(overallTheme: searchBarTheme)); await tester.pumpAndSettle(); // allow the animations to finish checkSearchBar(tester); diff --git a/packages/flutter/test/material/search_view_theme_test.dart b/packages/flutter/test/material/search_view_theme_test.dart index 98e8e379cc..647012c09f 100644 --- a/packages/flutter/test/material/search_view_theme_test.dart +++ b/packages/flutter/test/material/search_view_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('SearchViewThemeData copyWith, ==, hashCode basics', () { @@ -197,21 +196,21 @@ void main() { expect(inputText.style.fontSize, headerTextStyle.fontSize); } - testWidgetsWithLeakTracking('SearchView properties overrides defaults', (WidgetTester tester) async { + testWidgets('SearchView properties overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(useSearchViewProperties: true)); await tester.tap(find.byIcon(Icons.search)); await tester.pumpAndSettle(); // allow the animations to finish checkSearchView(tester); }); - testWidgetsWithLeakTracking('SearchView theme data overrides defaults', (WidgetTester tester) async { + testWidgets('SearchView theme data overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(searchViewThemeData: searchViewTheme)); await tester.tap(find.byIcon(Icons.search)); await tester.pumpAndSettle(); checkSearchView(tester); }); - testWidgetsWithLeakTracking('Overall Theme SearchView theme overrides defaults', (WidgetTester tester) async { + testWidgets('Overall Theme SearchView theme overrides defaults', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(overallTheme: searchViewTheme)); await tester.tap(find.byIcon(Icons.search)); await tester.pumpAndSettle(); @@ -220,7 +219,7 @@ void main() { // Same as the previous tests with empty SearchViewThemeData's instead of null. - testWidgetsWithLeakTracking('SearchView properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async { + testWidgets('SearchView properties overrides defaults, empty theme and overall theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(useSearchViewProperties: true, searchViewThemeData: const SearchViewThemeData(), overallTheme: const SearchViewThemeData())); @@ -229,7 +228,7 @@ void main() { checkSearchView(tester); }); - testWidgetsWithLeakTracking('SearchView theme overrides defaults and overall theme', (WidgetTester tester) async { + testWidgets('SearchView theme overrides defaults and overall theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(searchViewThemeData: searchViewTheme, overallTheme: const SearchViewThemeData())); await tester.tap(find.byIcon(Icons.search)); @@ -237,7 +236,7 @@ void main() { checkSearchView(tester); }); - testWidgetsWithLeakTracking('Overall Theme SearchView theme overrides defaults and null theme', (WidgetTester tester) async { + testWidgets('Overall Theme SearchView theme overrides defaults and null theme', (WidgetTester tester) async { await tester.pumpWidget(buildFrame(overallTheme: searchViewTheme)); await tester.tap(find.byIcon(Icons.search)); await tester.pumpAndSettle(); // allow the animations to finish diff --git a/packages/flutter/test/material/segmented_button_test.dart b/packages/flutter/test/material/segmented_button_test.dart index bc0caa645f..57b31588e8 100644 --- a/packages/flutter/test/material/segmented_button_test.dart +++ b/packages/flutter/test/material/segmented_button_test.dart @@ -10,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; import '../widgets/semantics_tester.dart'; Widget boilerplate({required Widget child}) { @@ -22,7 +21,7 @@ Widget boilerplate({required Widget child}) { void main() { - testWidgetsWithLeakTracking('SegmentedButton is built with Material of type MaterialType.transparency', (WidgetTester tester) async { + testWidgets('SegmentedButton is built with Material of type MaterialType.transparency', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: true); await tester.pumpWidget( MaterialApp( @@ -330,7 +329,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes }); - testWidgetsWithLeakTracking('SegmentedButtons have correct semantics', (WidgetTester tester) async { + testWidgets('SegmentedButtons have correct semantics', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); await tester.pumpWidget( @@ -409,7 +408,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes }); - testWidgetsWithLeakTracking('Multi-select SegmentedButtons have correct semantics', (WidgetTester tester) async { + testWidgets('Multi-select SegmentedButtons have correct semantics', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); await tester.pumpWidget( @@ -486,7 +485,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes semantics.dispose(); }); - testWidgetsWithLeakTracking('SegmentedButton default overlayColor and foregroundColor resolve pressed state', (WidgetTester tester) async { + testWidgets('SegmentedButton default overlayColor and foregroundColor resolve pressed state', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: true); await tester.pumpWidget( @@ -534,7 +533,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes expect(material.textStyle?.color, theme.colorScheme.onSurface); }); - testWidgetsWithLeakTracking('SegmentedButton has no tooltips by default', (WidgetTester tester) async { + testWidgets('SegmentedButton has no tooltips by default', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: true); await tester.pumpWidget( MaterialApp( @@ -558,7 +557,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes expect(find.byType(Tooltip), findsNothing); }); - testWidgetsWithLeakTracking('SegmentedButton has correct tooltips', (WidgetTester tester) async { + testWidgets('SegmentedButton has correct tooltips', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: true); await tester.pumpWidget( MaterialApp( diff --git a/packages/flutter/test/material/segmented_button_theme_test.dart b/packages/flutter/test/material/segmented_button_theme_test.dart index 6c2cf45a0d..a273f3633e 100644 --- a/packages/flutter/test/material/segmented_button_theme_test.dart +++ b/packages/flutter/test/material/segmented_button_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { @@ -43,7 +42,7 @@ void main() { expect(description, []); }); - testWidgetsWithLeakTracking('With no other configuration, defaults are used', (WidgetTester tester) async { + testWidgets('With no other configuration, defaults are used', (WidgetTester tester) async { final ThemeData theme = ThemeData(useMaterial3: true); await tester.pumpWidget( MaterialApp( @@ -110,7 +109,7 @@ void main() { } }); - testWidgetsWithLeakTracking('ThemeData.segmentedButtonTheme overrides defaults', (WidgetTester tester) async { + testWidgets('ThemeData.segmentedButtonTheme overrides defaults', (WidgetTester tester) async { final ThemeData theme = ThemeData( useMaterial3: true, segmentedButtonTheme: SegmentedButtonThemeData( @@ -203,7 +202,7 @@ void main() { } }); - testWidgetsWithLeakTracking('SegmentedButtonTheme overrides ThemeData and defaults', (WidgetTester tester) async { + testWidgets('SegmentedButtonTheme overrides ThemeData and defaults', (WidgetTester tester) async { final SegmentedButtonThemeData global = SegmentedButtonThemeData( style: ButtonStyle( backgroundColor: MaterialStateProperty.resolveWith((Set states) { @@ -330,7 +329,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Widget parameters overrides SegmentedTheme, ThemeData and defaults', (WidgetTester tester) async { + testWidgets('Widget parameters overrides SegmentedTheme, ThemeData and defaults', (WidgetTester tester) async { final SegmentedButtonThemeData global = SegmentedButtonThemeData( style: ButtonStyle( backgroundColor: MaterialStateProperty.resolveWith((Set states) { diff --git a/packages/flutter/test/material/selection_area_test.dart b/packages/flutter/test/material/selection_area_test.dart index 00211f70f5..8e19b78f6f 100644 --- a/packages/flutter/test/material/selection_area_test.dart +++ b/packages/flutter/test/material/selection_area_test.dart @@ -9,7 +9,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; Offset textOffsetToPosition(RenderParagraph paragraph, int offset) { const Rect caret = Rect.fromLTWH(0.0, 0.0, 2.0, 20.0); @@ -18,7 +17,7 @@ Offset textOffsetToPosition(RenderParagraph paragraph, int offset) { } void main() { - testWidgetsWithLeakTracking('SelectionArea uses correct selection controls', (WidgetTester tester) async { + testWidgets('SelectionArea uses correct selection controls', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp( home: SelectionArea( child: Text('abc'), @@ -40,7 +39,7 @@ void main() { } }, variant: TargetPlatformVariant.all()); - testWidgetsWithLeakTracking('Does not crash when long pressing on padding after dragging', (WidgetTester tester) async { + testWidgets('Does not crash when long pressing on padding after dragging', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/123378 await tester.pumpWidget( const MaterialApp( @@ -71,7 +70,7 @@ void main() { }); - testWidgetsWithLeakTracking('builds the default context menu by default', (WidgetTester tester) async { + testWidgets('builds the default context menu by default', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: SelectionArea( @@ -98,7 +97,7 @@ void main() { skip: kIsWeb, // [intended] ); - testWidgetsWithLeakTracking('builds a custom context menu if provided', (WidgetTester tester) async { + testWidgets('builds a custom context menu if provided', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( MaterialApp( @@ -134,7 +133,7 @@ void main() { skip: kIsWeb, // [intended] ); - testWidgetsWithLeakTracking('onSelectionChange is called when the selection changes', (WidgetTester tester) async { + testWidgets('onSelectionChange is called when the selection changes', (WidgetTester tester) async { SelectedContent? content; await tester.pumpWidget(MaterialApp( diff --git a/packages/flutter/test/material/slider_theme_test.dart b/packages/flutter/test/material/slider_theme_test.dart index 935e959aff..383dc49d4f 100644 --- a/packages/flutter/test/material/slider_theme_test.dart +++ b/packages/flutter/test/material/slider_theme_test.dart @@ -7,8 +7,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { test('SliderThemeData copyWith, ==, hashCode basics', () { expect(const SliderThemeData(), const SliderThemeData().copyWith()); @@ -20,7 +18,7 @@ void main() { expect(identical(SliderThemeData.lerp(data, data, 0.5), data), true); }); - testWidgetsWithLeakTracking('Default SliderThemeData debugFillProperties', (WidgetTester tester) async { + testWidgets('Default SliderThemeData debugFillProperties', (WidgetTester tester) async { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); const SliderThemeData().debugFillProperties(builder); @@ -32,7 +30,7 @@ void main() { expect(description, []); }); - testWidgetsWithLeakTracking('SliderThemeData implements debugFillProperties', (WidgetTester tester) async { + testWidgets('SliderThemeData implements debugFillProperties', (WidgetTester tester) async { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); const SliderThemeData( trackHeight: 7.0, @@ -502,7 +500,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Slider parameters overrides theme properties', (WidgetTester tester) async { + testWidgets('Slider parameters overrides theme properties', (WidgetTester tester) async { debugDisableShadows = false; const Color activeTrackColor = Color(0xffff0001); const Color inactiveTrackColor = Color(0xffff0002); @@ -556,7 +554,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Slider uses ThemeData slider theme if present', (WidgetTester tester) async { + testWidgets('Slider uses ThemeData slider theme if present', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.red, @@ -580,7 +578,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Slider overrides ThemeData theme if SliderTheme present', (WidgetTester tester) async { + testWidgets('Slider overrides ThemeData theme if SliderTheme present', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.red, @@ -604,7 +602,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('SliderThemeData generates correct opacities for fromPrimaryColors', (WidgetTester tester) async { + testWidgets('SliderThemeData generates correct opacities for fromPrimaryColors', (WidgetTester tester) async { const Color customColor1 = Color(0xcafefeed); const Color customColor2 = Color(0xdeadbeef); const Color customColor3 = Color(0xdecaface); @@ -634,7 +632,7 @@ void main() { expect(sliderTheme.valueIndicatorTextStyle!.color, equals(customColor4)); }); - testWidgetsWithLeakTracking('SliderThemeData generates correct shapes for fromPrimaryColors', (WidgetTester tester) async { + testWidgets('SliderThemeData generates correct shapes for fromPrimaryColors', (WidgetTester tester) async { const Color customColor1 = Color(0xcafefeed); const Color customColor2 = Color(0xdeadbeef); const Color customColor3 = Color(0xdecaface); @@ -658,7 +656,7 @@ void main() { expect(sliderTheme.rangeValueIndicatorShape, const PaddleRangeSliderValueIndicatorShape()); }); - testWidgetsWithLeakTracking('SliderThemeData lerps correctly', (WidgetTester tester) async { + testWidgets('SliderThemeData lerps correctly', (WidgetTester tester) async { final SliderThemeData sliderThemeBlack = SliderThemeData.fromPrimaryColors( primaryColor: Colors.black, primaryColorDark: Colors.black, @@ -692,7 +690,7 @@ void main() { expect(lerp.valueIndicatorTextStyle!.color, equals(middleGrey.withAlpha(0xff))); }); - testWidgetsWithLeakTracking('Default slider track draws correctly', (WidgetTester tester) async { + testWidgets('Default slider track draws correctly', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.blue, @@ -728,7 +726,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Default slider overlay draws correctly', (WidgetTester tester) async { + testWidgets('Default slider overlay draws correctly', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.blue, @@ -789,7 +787,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Slider can use theme overlay with material states', (WidgetTester tester) async { + testWidgets('Slider can use theme overlay with material states', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.blue, @@ -848,7 +846,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Default slider ticker and thumb shape draw correctly', (WidgetTester tester) async { + testWidgets('Default slider ticker and thumb shape draw correctly', (WidgetTester tester) async { final ThemeData theme = ThemeData( platform: TargetPlatform.android, primarySwatch: Colors.blue, @@ -892,7 +890,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Default paddle slider value indicator shape draws correctly', (WidgetTester tester) async { + testWidgets('Default paddle slider value indicator shape draws correctly', (WidgetTester tester) async { debugDisableShadows = false; try { final ThemeData theme = ThemeData( @@ -1076,7 +1074,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Default paddle slider value indicator shape draws correctly', (WidgetTester tester) async { + testWidgets('Default paddle slider value indicator shape draws correctly', (WidgetTester tester) async { debugDisableShadows = false; try { final ThemeData theme = ThemeData( @@ -1260,7 +1258,7 @@ void main() { } }); - testWidgetsWithLeakTracking('The slider track height can be overridden', (WidgetTester tester) async { + testWidgets('The slider track height can be overridden', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith(trackHeight: 16); const Radius radius = Radius.circular(8); const Radius activatedRadius = Radius.circular(9); @@ -1290,7 +1288,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('The default slider thumb shape sizes can be overridden', (WidgetTester tester) async { + testWidgets('The default slider thumb shape sizes can be overridden', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( thumbShape: const RoundSliderThumbShape( enabledThumbRadius: 7, @@ -1315,7 +1313,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('The default slider thumb shape disabled size can be inferred from the enabled size', (WidgetTester tester) async { + testWidgets('The default slider thumb shape disabled size can be inferred from the enabled size', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( thumbShape: const RoundSliderThumbShape( enabledThumbRadius: 9, @@ -1338,7 +1336,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('The default slider tick mark shape size can be overridden', (WidgetTester tester) async { + testWidgets('The default slider tick mark shape size can be overridden', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( tickMarkShape: const RoundSliderTickMarkShape(tickMarkRadius: 5), activeTickMarkColor: const Color(0xfadedead), @@ -1371,7 +1369,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('The default slider overlay shape size can be overridden', (WidgetTester tester) async { + testWidgets('The default slider overlay shape size can be overridden', (WidgetTester tester) async { const double uniqueOverlayRadius = 23; final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( overlayShape: const RoundSliderOverlayShape( @@ -1398,7 +1396,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/74503 - testWidgetsWithLeakTracking('The slider track layout correctly when the overlay size is smaller than the thumb size', (WidgetTester tester) async { + testWidgets('The slider track layout correctly when the overlay size is smaller than the thumb size', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( overlayShape: SliderComponentShape.noOverlay, ); @@ -1439,7 +1437,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/125467 - testWidgetsWithLeakTracking('The RangeSlider track layout correctly when the overlay size is smaller than the thumb size', (WidgetTester tester) async { + testWidgets('The RangeSlider track layout correctly when the overlay size is smaller than the thumb size', (WidgetTester tester) async { final SliderThemeData sliderTheme = ThemeData().sliderTheme.copyWith( overlayShape: SliderComponentShape.noOverlay, ); @@ -1490,7 +1488,7 @@ void main() { // // The value indicator can be skipped by passing the appropriate // [ShowValueIndicator]. - testWidgetsWithLeakTracking('The slider can skip all of its component painting', (WidgetTester tester) async { + testWidgets('The slider can skip all of its component painting', (WidgetTester tester) async { // Pump a slider with all shapes skipped. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1511,7 +1509,7 @@ void main() { expect(material, paintsExactlyCountTimes(#drawPath, 0)); }); - testWidgetsWithLeakTracking('The slider can skip all component painting except the track', (WidgetTester tester) async { + testWidgets('The slider can skip all component painting except the track', (WidgetTester tester) async { // Pump a slider with just a track. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1532,7 +1530,7 @@ void main() { expect(material, paintsExactlyCountTimes(#drawPath, 0)); }); - testWidgetsWithLeakTracking('The slider can skip all component painting except the tick marks', (WidgetTester tester) async { + testWidgets('The slider can skip all component painting except the tick marks', (WidgetTester tester) async { // Pump a slider with just tick marks. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1556,7 +1554,7 @@ void main() { expect(material, paintsExactlyCountTimes(#drawPath, 0)); }); - testWidgetsWithLeakTracking('The slider can skip all component painting except the thumb', (WidgetTester tester) async { + testWidgets('The slider can skip all component painting except the thumb', (WidgetTester tester) async { debugDisableShadows = false; try { // Pump a slider with just a thumb. @@ -1582,7 +1580,7 @@ void main() { } }); - testWidgetsWithLeakTracking('The slider can skip all component painting except the overlay', (WidgetTester tester) async { + testWidgets('The slider can skip all component painting except the overlay', (WidgetTester tester) async { // Pump a slider with just an overlay. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1610,7 +1608,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('The slider can skip all component painting except the value indicator', (WidgetTester tester) async { + testWidgets('The slider can skip all component painting except the value indicator', (WidgetTester tester) async { // Pump a slider with just a value indicator. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1640,7 +1638,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('PaddleSliderValueIndicatorShape skips all painting at zero scale', (WidgetTester tester) async { + testWidgets('PaddleSliderValueIndicatorShape skips all painting at zero scale', (WidgetTester tester) async { // Pump a slider with just a value indicator. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1675,7 +1673,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('Default slider value indicator shape skips all painting at zero scale', (WidgetTester tester) async { + testWidgets('Default slider value indicator shape skips all painting at zero scale', (WidgetTester tester) async { // Pump a slider with just a value indicator. await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( @@ -1707,7 +1705,7 @@ void main() { }); - testWidgetsWithLeakTracking('Default paddle range slider value indicator shape draws correctly', (WidgetTester tester) async { + testWidgets('Default paddle range slider value indicator shape draws correctly', (WidgetTester tester) async { debugDisableShadows = false; try { final ThemeData theme = ThemeData( @@ -1757,7 +1755,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Default paddle range slider value indicator shape draws correctly with debugDisableShadows', (WidgetTester tester) async { + testWidgets('Default paddle range slider value indicator shape draws correctly with debugDisableShadows', (WidgetTester tester) async { debugDisableShadows = true; final ThemeData theme = ThemeData( platform: TargetPlatform.android, @@ -1803,7 +1801,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('PaddleRangeSliderValueIndicatorShape skips all painting at zero scale', (WidgetTester tester) async { + testWidgets('PaddleRangeSliderValueIndicatorShape skips all painting at zero scale', (WidgetTester tester) async { debugDisableShadows = false; try { // Pump a slider with just a value indicator. @@ -1837,7 +1835,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Default range indicator shape skips all painting at zero scale', (WidgetTester tester) async { + testWidgets('Default range indicator shape skips all painting at zero scale', (WidgetTester tester) async { debugDisableShadows = false; try { // Pump a slider with just a value indicator. @@ -1873,7 +1871,7 @@ void main() { } }); - testWidgetsWithLeakTracking('activeTrackRadius is taken into account when painting the border of the active track', (WidgetTester tester) async { + testWidgets('activeTrackRadius is taken into account when painting the border of the active track', (WidgetTester tester) async { await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( trackShape: const RoundedRectSliderTrackShapeWithCustomAdditionalActiveTrackHeight( @@ -1900,7 +1898,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('The mouse cursor is themeable', (WidgetTester tester) async { + testWidgets('The mouse cursor is themeable', (WidgetTester tester) async { await tester.pumpWidget(_buildApp( ThemeData().sliderTheme.copyWith( mouseCursor: const MaterialStatePropertyAll(SystemMouseCursors.text), @@ -1915,7 +1913,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text); }); - testWidgetsWithLeakTracking('SliderTheme.allowedInteraction is themeable', (WidgetTester tester) async { + testWidgets('SliderTheme.allowedInteraction is themeable', (WidgetTester tester) async { double value = 0.0; Widget buildApp({ @@ -2022,7 +2020,7 @@ void main() { await gesture.up(); }); - testWidgetsWithLeakTracking('Default value indicator color', (WidgetTester tester) async { + testWidgets('Default value indicator color', (WidgetTester tester) async { debugDisableShadows = false; try { final ThemeData theme = ThemeData( @@ -2235,7 +2233,7 @@ void main() { } }); - testWidgetsWithLeakTracking('Default value indicator color', (WidgetTester tester) async { + testWidgets('Default value indicator color', (WidgetTester tester) async { debugDisableShadows = false; try { final ThemeData theme = ThemeData( diff --git a/packages/flutter/test/material/spell_check_suggestions_toolbar_layout_delegate_test.dart b/packages/flutter/test/material/spell_check_suggestions_toolbar_layout_delegate_test.dart index 002aba3fec..494dbe7308 100644 --- a/packages/flutter/test/material/spell_check_suggestions_toolbar_layout_delegate_test.dart +++ b/packages/flutter/test/material/spell_check_suggestions_toolbar_layout_delegate_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { testWidgetsWithLeakTracking('positions itself at anchorAbove if it fits and shifts up when not', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/spell_check_suggestions_toolbar_test.dart b/packages/flutter/test/material/spell_check_suggestions_toolbar_test.dart index 6a97355d0b..e9bbc4950e 100644 --- a/packages/flutter/test/material/spell_check_suggestions_toolbar_test.dart +++ b/packages/flutter/test/material/spell_check_suggestions_toolbar_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; // Vertical position at which to anchor the toolbar for testing. const double _kAnchor = 200; diff --git a/packages/flutter/test/material/switch_list_tile_test.dart b/packages/flutter/test/material/switch_list_tile_test.dart index c3801a8fcb..f3ee1be963 100644 --- a/packages/flutter/test/material/switch_list_tile_test.dart +++ b/packages/flutter/test/material/switch_list_tile_test.dart @@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -560,6 +560,7 @@ void main() { await tester.pump(); expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + node.dispose(); }); testWidgetsWithLeakTracking('SwitchListTile.adaptive onFocusChange Callback', (WidgetTester tester) async { @@ -589,6 +590,7 @@ void main() { await tester.pump(); expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + node.dispose(); }); group('feedback', () { @@ -863,7 +865,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Material3 - SwitchListTile respects thumbColor in hovered/pressed states', (WidgetTester tester) async { + testWidgets('Material3 - SwitchListTile respects thumbColor in hovered/pressed states', (WidgetTester tester) async { tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; const Color hoveredThumbColor = Color(0xFF4caf50); const Color pressedThumbColor = Color(0xFFF44336); diff --git a/packages/flutter/test/material/switch_test.dart b/packages/flutter/test/material/switch_test.dart index fa89e561f7..9fbf97f7ac 100644 --- a/packages/flutter/test/material/switch_test.dart +++ b/packages/flutter/test/material/switch_test.dart @@ -17,8 +17,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -701,6 +700,8 @@ void main() { expect(getSwitchMaterial(tester), paints..circle(color: theme.hoverColor) ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Switch default overlayColor resolves hovered/focused state', (WidgetTester tester) async { @@ -746,6 +747,8 @@ void main() { expect(getSwitchMaterial(tester), paints..circle(color: theme.colorScheme.primary.withOpacity(0.08)) ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material2 - Switch can be set color', (WidgetTester tester) async { @@ -1238,6 +1241,8 @@ void main() { ..rrect(color: const Color(0x1f000000)) ..rrect(color: const Color(0xffbdbdbd)), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Switch is focusable and has correct focus color', (WidgetTester tester) async { @@ -1325,6 +1330,8 @@ void main() { ) ..rrect(color: Color.alphaBlend(colors.onSurface.withOpacity(0.38), colors.surface)), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Switch with splash radius set', (WidgetTester tester) async { @@ -1985,6 +1992,8 @@ void main() { ..rrect(color: hoveredThumbColor), reason: 'Inactive disabled switch should default track and custom thumb color', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Switch thumb color resolves in hovered/focused states', (WidgetTester tester) async { @@ -2061,6 +2070,8 @@ void main() { ..rrect(color: hoveredThumbColor), reason: 'active enabled switch should default track and custom thumb color', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material2 - Track color resolves in active/enabled states', (WidgetTester tester) async { @@ -2312,6 +2323,8 @@ void main() { ), reason: 'Inactive enabled switch should match these colors', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material3 - Switch track color resolves in hovered/focused states', (WidgetTester tester) async { @@ -2382,6 +2395,8 @@ void main() { ), reason: 'Active enabled switch should match these colors', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Material2 - Switch thumb color is blended against surface color', (WidgetTester tester) async { @@ -2634,6 +2649,8 @@ void main() { ), reason: 'Hovered Switch should use overlay color $hoverOverlayColor over $hoverColor', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Do not crash when widget disappears while pointer is down', (WidgetTester tester) async { @@ -3187,6 +3204,8 @@ void main() { ..rrect(color: hoveredTrackOutlineColor, style: PaintingStyle.stroke), reason: 'Active enabled switch track outline should match this color', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Track outline width resolves in active/enabled states', (WidgetTester tester) async { @@ -3322,6 +3341,8 @@ void main() { ..rrect(strokeWidth: hoveredTrackOutlineWidth, style: PaintingStyle.stroke), reason: 'Active enabled switch track outline width should be 4.0', ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Switch can set icon - M3', (WidgetTester tester) async { @@ -3486,6 +3507,8 @@ void main() { ..rrect(color: const Color(0x0a000000)) ..rrect(color: const Color(0xffffffff)), ); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Switch.onFocusChange callback', (WidgetTester tester) async { @@ -3515,6 +3538,8 @@ void main() { await tester.pump(); expect(focused, isFalse); expect(focusNode.hasFocus, isFalse); + + focusNode.dispose(); }); } diff --git a/packages/flutter/test/material/switch_theme_test.dart b/packages/flutter/test/material/switch_theme_test.dart index 900e0bc06a..720c103da4 100644 --- a/packages/flutter/test/material/switch_theme_test.dart +++ b/packages/flutter/test/material/switch_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('SwitchThemeData copyWith, ==, hashCode basics', () { diff --git a/packages/flutter/test/material/tabbed_scrollview_warp_test.dart b/packages/flutter/test/material/tabbed_scrollview_warp_test.dart index 6f495bf9a3..98e1dd8280 100644 --- a/packages/flutter/test/material/tabbed_scrollview_warp_test.dart +++ b/packages/flutter/test/material/tabbed_scrollview_warp_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; // This is a regression test for https://github.com/flutter/flutter/issues/10549 // which was failing because _SliverPersistentHeaderElement.visitChildren() diff --git a/packages/flutter/test/material/text_button_test.dart b/packages/flutter/test/material/text_button_test.dart index 784ffb3a3c..862eadb1bb 100644 --- a/packages/flutter/test/material/text_button_test.dart +++ b/packages/flutter/test/material/text_button_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; void main() { @@ -198,6 +197,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); await expectLater(tester, meetsGuideline(textContrastGuideline)); + + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -265,6 +266,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. await expectLater(tester, meetsGuideline(textContrastGuideline)); + + focusNode.dispose(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 ); @@ -320,6 +323,8 @@ void main() { focusNode.requestFocus(); await tester.pumpAndSettle(); expect(overlayColor(), paints..rect(color: theme.colorScheme.primary.withOpacity(0.12))); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('TextButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -387,6 +392,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(textColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('TextButton uses stateful color for icon color in different states', (WidgetTester tester) async { @@ -454,6 +461,8 @@ void main() { await tester.pump(); // Start the splash and highlight animations. await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(iconColor(), pressedColor); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('TextButton has no clip by default', (WidgetTester tester) async { @@ -530,6 +539,8 @@ void main() { final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures'); expect(inkFeatures, paints..rect(color: focusColor)); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Does TextButton contribute semantics', (WidgetTester tester) async { @@ -795,6 +806,8 @@ void main() { await tester.pumpAndSettle(); expect(focusNode.hasPrimaryFocus, isFalse); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('disabled and hovered TextButton responds to mouse-exit', (WidgetTester tester) async { @@ -886,6 +899,8 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('When TextButton disable, Can not set TextButton focus.', (WidgetTester tester) async { @@ -909,6 +924,8 @@ void main() { expect(gotFocus, isFalse); expect(node.hasFocus, isFalse); + + node.dispose(); }); testWidgetsWithLeakTracking('TextButton responds to density changes.', (WidgetTester tester) async { @@ -1619,7 +1636,7 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); - testWidgetsWithLeakTracking('TextButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('TextButton in SelectionArea changes mouse cursor when hovered', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/104595. await tester.pumpWidget(MaterialApp( home: SelectionArea( @@ -1772,15 +1789,15 @@ void main() { await gesture.removePointer(); } - testWidgetsWithLeakTracking('TextButton statesController', (WidgetTester tester) async { + testWidgets('TextButton statesController', (WidgetTester tester) async { testStatesController(null, tester); }); - testWidgetsWithLeakTracking('TextButton.icon statesController', (WidgetTester tester) async { + testWidgets('TextButton.icon statesController', (WidgetTester tester) async { testStatesController(const Icon(Icons.add), tester); }); - testWidgetsWithLeakTracking('Disabled TextButton statesController', (WidgetTester tester) async { + testWidgets('Disabled TextButton statesController', (WidgetTester tester) async { int count = 0; void valueChanged() { count += 1; diff --git a/packages/flutter/test/material/text_button_theme_test.dart b/packages/flutter/test/material/text_button_theme_test.dart index fc0d023cc1..b9326fdcf1 100644 --- a/packages/flutter/test/material/text_button_theme_test.dart +++ b/packages/flutter/test/material/text_button_theme_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('TextButtonTheme lerp special cases', () { diff --git a/packages/flutter/test/material/text_field_helper_text_test.dart b/packages/flutter/test/material/text_field_helper_text_test.dart index 2193417527..a5b4a06a42 100644 --- a/packages/flutter/test/material/text_field_helper_text_test.dart +++ b/packages/flutter/test/material/text_field_helper_text_test.dart @@ -5,10 +5,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - void main() { - testWidgetsWithLeakTracking('TextField works correctly when changing helperText', (WidgetTester tester) async { + testWidgets('TextField works correctly when changing helperText', (WidgetTester tester) async { await tester.pumpWidget(const MaterialApp(home: Material(child: TextField(decoration: InputDecoration(helperText: 'Awesome'))))); expect(find.text('Awesome'), findsNWidgets(1)); await tester.pump(const Duration(milliseconds: 100)); diff --git a/packages/flutter/test/material/text_field_splash_test.dart b/packages/flutter/test/material/text_field_splash_test.dart index ab26df41cb..b16f0ced9b 100644 --- a/packages/flutter/test/material/text_field_splash_test.dart +++ b/packages/flutter/test/material/text_field_splash_test.dart @@ -6,8 +6,6 @@ import 'package:flutter/gestures.dart' show kPressTimeout; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../foundation/leak_tracking.dart'; - bool confirmCalled = false; bool cancelCalled = false; @@ -137,7 +135,7 @@ void main() { expect(cancelCalled, isFalse); }); - testWidgetsWithLeakTracking('Splash should never be created or canceled', (WidgetTester tester) async { + testWidgets('Splash should never be created or canceled', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Theme( diff --git a/packages/flutter/test/material/text_form_field_test.dart b/packages/flutter/test/material/text_form_field_test.dart index 36373fec38..97323bf4e7 100644 --- a/packages/flutter/test/material/text_form_field_test.dart +++ b/packages/flutter/test/material/text_form_field_test.dart @@ -11,8 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/clipboard_utils.dart'; import '../widgets/editable_text_utils.dart'; @@ -249,10 +248,10 @@ void main() { skip: kIsWeb, // [intended] we don't supply the cut/copy/paste buttons on the web. // TODO(polina-c): remove after fixing // https://github.com/flutter/flutter/issues/130467 - leakTrackingTestConfig: const LeakTrackingTestConfig(notDisposedAllowList: {'ValueNotifier<_OverlayEntryWidgetState?>': 16}), + leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true, allowAllNotGCed: true), ); - testWidgetsWithLeakTracking('the desktop cut/copy/paste buttons are disabled for read-only obscured form fields', (WidgetTester tester) async { + testWidgets('the desktop cut/copy/paste buttons are disabled for read-only obscured form fields', (WidgetTester tester) async { final TextEditingController controller = TextEditingController( text: 'blah1 blah2', ); @@ -347,7 +346,7 @@ void main() { skip: kIsWeb, // [intended] we don't supply the cut/copy/paste buttons on the web. ); - testWidgetsWithLeakTracking('TextFormField accepts TextField.noMaxLength as value to maxLength parameter', (WidgetTester tester) async { + testWidgets('TextFormField accepts TextField.noMaxLength as value to maxLength parameter', (WidgetTester tester) async { bool asserted; try { TextFormField( @@ -360,7 +359,7 @@ void main() { expect(asserted, false); }); - testWidgetsWithLeakTracking('Passes textAlign to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes textAlign to underlying TextField', (WidgetTester tester) async { const TextAlign alignment = TextAlign.center; await tester.pumpWidget( @@ -382,7 +381,7 @@ void main() { expect(textFieldWidget.textAlign, alignment); }); - testWidgetsWithLeakTracking('Passes scrollPhysics to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes scrollPhysics to underlying TextField', (WidgetTester tester) async { const ScrollPhysics scrollPhysics = ScrollPhysics(); await tester.pumpWidget( @@ -404,7 +403,7 @@ void main() { expect(textFieldWidget.scrollPhysics, scrollPhysics); }); - testWidgetsWithLeakTracking('Passes textAlignVertical to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes textAlignVertical to underlying TextField', (WidgetTester tester) async { const TextAlignVertical textAlignVertical = TextAlignVertical.bottom; await tester.pumpWidget( @@ -426,7 +425,7 @@ void main() { expect(textFieldWidget.textAlignVertical, textAlignVertical); }); - testWidgetsWithLeakTracking('Passes textInputAction to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes textInputAction to underlying TextField', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -446,7 +445,7 @@ void main() { expect(textFieldWidget.textInputAction, TextInputAction.next); }); - testWidgetsWithLeakTracking('Passes onEditingComplete to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes onEditingComplete to underlying TextField', (WidgetTester tester) async { void onEditingComplete() { } await tester.pumpWidget( @@ -468,7 +467,7 @@ void main() { expect(textFieldWidget.onEditingComplete, onEditingComplete); }); - testWidgetsWithLeakTracking('Passes cursor attributes to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes cursor attributes to underlying TextField', (WidgetTester tester) async { const double cursorWidth = 3.14; const double cursorHeight = 6.28; const Radius cursorRadius = Radius.circular(4); @@ -520,7 +519,7 @@ void main() { expect(called, true); }); - testWidgetsWithLeakTracking('onChanged callbacks are called', (WidgetTester tester) async { + testWidgets('onChanged callbacks are called', (WidgetTester tester) async { late String value; await tester.pumpWidget( @@ -542,7 +541,7 @@ void main() { expect(value, 'Soup'); }); - testWidgetsWithLeakTracking('autovalidateMode is passed to super', (WidgetTester tester) async { + testWidgets('autovalidateMode is passed to super', (WidgetTester tester) async { int validateCalled = 0; await tester.pumpWidget( @@ -567,7 +566,7 @@ void main() { expect(validateCalled, 2); }); - testWidgetsWithLeakTracking('validate is called if widget is enabled', (WidgetTester tester) async { + testWidgets('validate is called if widget is enabled', (WidgetTester tester) async { int validateCalled = 0; await tester.pumpWidget( @@ -594,7 +593,7 @@ void main() { }); - testWidgetsWithLeakTracking('Disabled field hides helper and counter in M2', (WidgetTester tester) async { + testWidgets('Disabled field hides helper and counter in M2', (WidgetTester tester) async { const String helperText = 'helper text'; const String counterText = 'counter text'; const String errorText = 'error text'; @@ -642,7 +641,7 @@ void main() { expect(errorWidget.style!.color, equals(Colors.transparent)); }); - testWidgetsWithLeakTracking('passing a buildCounter shows returned widget', (WidgetTester tester) async { + testWidgets('passing a buildCounter shows returned widget', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: Material( child: Center( @@ -707,7 +706,7 @@ void main() { expect(renderEditable, paintsExactlyCountTimes(#drawRect, 0)); }, skip: isBrowser); // [intended] We do not use Flutter-rendered context menu on the Web. - testWidgetsWithLeakTracking('onTap is called upon tap', (WidgetTester tester) async { + testWidgets('onTap is called upon tap', (WidgetTester tester) async { int tapCount = 0; await tester.pumpWidget( MaterialApp( @@ -734,7 +733,7 @@ void main() { expect(tapCount, 3); }); - testWidgetsWithLeakTracking('onTapOutside is called upon tap outside', (WidgetTester tester) async { + testWidgets('onTapOutside is called upon tap outside', (WidgetTester tester) async { int tapOutsideCount = 0; await tester.pumpWidget( MaterialApp( @@ -765,7 +764,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/54472. - testWidgetsWithLeakTracking('reset resets the text fields value to the initialValue', (WidgetTester tester) async { + testWidgets('reset resets the text fields value to the initialValue', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -788,7 +787,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/34847. - testWidgetsWithLeakTracking("didChange resets the text field's value to empty when passed null", (WidgetTester tester) async { + testWidgets("didChange resets the text field's value to empty when passed null", (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -811,7 +810,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/34847. - testWidgetsWithLeakTracking("reset resets the text field's value to empty when initialValue is null", (WidgetTester tester) async { + testWidgets("reset resets the text field's value to empty when initialValue is null", (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -834,7 +833,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/54472. - testWidgetsWithLeakTracking('didChange changes text fields value', (WidgetTester tester) async { + testWidgets('didChange changes text fields value', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -856,7 +855,7 @@ void main() { expect(find.text('changedValue'), findsOneWidget); }); - testWidgetsWithLeakTracking('onChanged callbacks value and FormFieldState.value are sync', (WidgetTester tester) async { + testWidgets('onChanged callbacks value and FormFieldState.value are sync', (WidgetTester tester) async { bool called = false; late FormFieldState state; @@ -883,7 +882,7 @@ void main() { expect(called, true); }); - testWidgetsWithLeakTracking('autofillHints is passed to super', (WidgetTester tester) async { + testWidgets('autofillHints is passed to super', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -900,7 +899,7 @@ void main() { expect(widget.autofillHints, equals(const [AutofillHints.countryName])); }); - testWidgetsWithLeakTracking('autovalidateMode is passed to super', (WidgetTester tester) async { + testWidgets('autovalidateMode is passed to super', (WidgetTester tester) async { int validateCalled = 0; await tester.pumpWidget( @@ -925,7 +924,7 @@ void main() { expect(validateCalled, 1); }); - testWidgetsWithLeakTracking('textSelectionControls is passed to super', (WidgetTester tester) async { + testWidgets('textSelectionControls is passed to super', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -942,7 +941,7 @@ void main() { expect(widget.selectionControls, equals(materialTextSelectionControls)); }); - testWidgetsWithLeakTracking('TextFormField respects hintTextDirection', (WidgetTester tester) async { + testWidgets('TextFormField respects hintTextDirection', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( home: Material( child: Directionality( @@ -984,7 +983,7 @@ void main() { expect(textDirection, TextDirection.rtl); }); - testWidgetsWithLeakTracking('Passes scrollController to underlying TextField', (WidgetTester tester) async { + testWidgets('Passes scrollController to underlying TextField', (WidgetTester tester) async { final ScrollController scrollController = ScrollController(); await tester.pumpWidget( @@ -1006,7 +1005,7 @@ void main() { expect(textFieldWidget.scrollController, scrollController); }); - testWidgetsWithLeakTracking('TextFormField changes mouse cursor when hovered', (WidgetTester tester) async { + testWidgets('TextFormField changes mouse cursor when hovered', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Material( @@ -1151,7 +1150,7 @@ void main() { skip: kIsWeb, // [intended] we don't supply the cut/copy/paste buttons on the web. ); - testWidgetsWithLeakTracking('spellCheckConfiguration passes through to EditableText', (WidgetTester tester) async { + testWidgets('spellCheckConfiguration passes through to EditableText', (WidgetTester tester) async { final SpellCheckConfiguration mySpellCheckConfiguration = SpellCheckConfiguration( spellCheckService: DefaultSpellCheckService(), misspelledTextStyle: TextField.materialMisspelledTextStyle, @@ -1181,7 +1180,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('magnifierConfiguration passes through to EditableText', (WidgetTester tester) async { + testWidgets('magnifierConfiguration passes through to EditableText', (WidgetTester tester) async { final TextMagnifierConfiguration myTextMagnifierConfiguration = TextMagnifierConfiguration( magnifierBuilder: (BuildContext context, MagnifierController controller, ValueNotifier notifier) { return const Placeholder(); @@ -1202,7 +1201,7 @@ void main() { expect(editableText.magnifierConfiguration, equals(myTextMagnifierConfiguration)); }); - testWidgetsWithLeakTracking('Passes undoController to undoController TextField', (WidgetTester tester) async { + testWidgets('Passes undoController to undoController TextField', (WidgetTester tester) async { final UndoHistoryController undoController = UndoHistoryController(value: UndoHistoryValue.empty); await tester.pumpWidget( @@ -1224,7 +1223,7 @@ void main() { expect(textFieldWidget.undoController, undoController); }); - testWidgetsWithLeakTracking('Passes cursorOpacityAnimates to cursorOpacityAnimates TextField', (WidgetTester tester) async { + testWidgets('Passes cursorOpacityAnimates to cursorOpacityAnimates TextField', (WidgetTester tester) async { const bool cursorOpacityAnimates = true; await tester.pumpWidget( @@ -1246,7 +1245,7 @@ void main() { expect(textFieldWidget.cursorOpacityAnimates, cursorOpacityAnimates); }); - testWidgetsWithLeakTracking('Passes contentInsertionConfiguration to contentInsertionConfiguration TextField', (WidgetTester tester) async { + testWidgets('Passes contentInsertionConfiguration to contentInsertionConfiguration TextField', (WidgetTester tester) async { final ContentInsertionConfiguration contentInsertionConfiguration = ContentInsertionConfiguration(onContentInserted: (KeyboardInsertedContent value) {}); @@ -1269,7 +1268,7 @@ void main() { expect(textFieldWidget.contentInsertionConfiguration, contentInsertionConfiguration); }); - testWidgetsWithLeakTracking('Passes clipBehavior to clipBehavior TextField', (WidgetTester tester) async { + testWidgets('Passes clipBehavior to clipBehavior TextField', (WidgetTester tester) async { const Clip clipBehavior = Clip.antiAlias; await tester.pumpWidget( @@ -1291,7 +1290,7 @@ void main() { expect(textFieldWidget.clipBehavior, clipBehavior); }); - testWidgetsWithLeakTracking('Passes scribbleEnabled to scribbleEnabled TextField', (WidgetTester tester) async { + testWidgets('Passes scribbleEnabled to scribbleEnabled TextField', (WidgetTester tester) async { const bool scribbleEnabled = false; await tester.pumpWidget( @@ -1313,7 +1312,7 @@ void main() { expect(textFieldWidget.scribbleEnabled, scribbleEnabled); }); - testWidgetsWithLeakTracking('Passes canRequestFocus to canRequestFocus TextField', (WidgetTester tester) async { + testWidgets('Passes canRequestFocus to canRequestFocus TextField', (WidgetTester tester) async { const bool canRequestFocus = false; await tester.pumpWidget( @@ -1335,7 +1334,7 @@ void main() { expect(textFieldWidget.canRequestFocus, canRequestFocus); }); - testWidgetsWithLeakTracking('Passes onAppPrivateCommand to onAppPrivateCommand TextField', (WidgetTester tester) async { + testWidgets('Passes onAppPrivateCommand to onAppPrivateCommand TextField', (WidgetTester tester) async { void onAppPrivateCommand(String p0, Map p1) {} await tester.pumpWidget( @@ -1357,7 +1356,7 @@ void main() { expect(textFieldWidget.onAppPrivateCommand, onAppPrivateCommand); }); - testWidgetsWithLeakTracking('Passes selectionHeightStyle to selectionHeightStyle TextField', (WidgetTester tester) async { + testWidgets('Passes selectionHeightStyle to selectionHeightStyle TextField', (WidgetTester tester) async { const BoxHeightStyle selectionHeightStyle = BoxHeightStyle.max; await tester.pumpWidget( @@ -1379,7 +1378,7 @@ void main() { expect(textFieldWidget.selectionHeightStyle, selectionHeightStyle); }); - testWidgetsWithLeakTracking('Passes selectionWidthStyle to selectionWidthStyle TextField', (WidgetTester tester) async { + testWidgets('Passes selectionWidthStyle to selectionWidthStyle TextField', (WidgetTester tester) async { const BoxWidthStyle selectionWidthStyle = BoxWidthStyle.max; await tester.pumpWidget( @@ -1401,7 +1400,7 @@ void main() { expect(textFieldWidget.selectionWidthStyle, selectionWidthStyle); }); - testWidgetsWithLeakTracking('Passes dragStartBehavior to dragStartBehavior TextField', (WidgetTester tester) async { + testWidgets('Passes dragStartBehavior to dragStartBehavior TextField', (WidgetTester tester) async { const DragStartBehavior dragStartBehavior = DragStartBehavior.down; await tester.pumpWidget( @@ -1423,7 +1422,7 @@ void main() { expect(textFieldWidget.dragStartBehavior, dragStartBehavior); }); - testWidgetsWithLeakTracking('Error color for cursor while validating', (WidgetTester tester) async { + testWidgets('Error color for cursor while validating', (WidgetTester tester) async { const Color errorColor = Color(0xff123456); await tester.pumpWidget(MaterialApp( theme: ThemeData( diff --git a/packages/flutter/test/material/text_selection_theme_test.dart b/packages/flutter/test/material/text_selection_theme_test.dart index 1e7ba83ced..ecd0850d80 100644 --- a/packages/flutter/test/material/text_selection_theme_test.dart +++ b/packages/flutter/test/material/text_selection_theme_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('TextSelectionThemeData copyWith, ==, hashCode basics', () { @@ -113,7 +112,8 @@ void main() { notDisposedAllowList: { 'ValueNotifier': 1, 'ValueNotifier<_OverlayEntryWidgetState?>': 2, - 'ValueNotifier': 1, + 'ValueNotifier': 2, + '_InputBorderGap': 1, }, // TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed. allowAllNotGCed: true, @@ -173,7 +173,8 @@ void main() { notDisposedAllowList: { 'ValueNotifier': 1, 'ValueNotifier<_OverlayEntryWidgetState?>': 2, - 'ValueNotifier': 1, + 'ValueNotifier': 2, + '_InputBorderGap': 1, }, // TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed. allowAllNotGCed: true, diff --git a/packages/flutter/test/material/text_selection_toolbar_test.dart b/packages/flutter/test/material/text_selection_toolbar_test.dart index f37714db21..f3317c109c 100644 --- a/packages/flutter/test/material/text_selection_toolbar_test.dart +++ b/packages/flutter/test/material/text_selection_toolbar_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/editable_text_utils.dart' show textOffsetToPosition; const double _kToolbarContentDistance = 8.0; @@ -173,7 +172,7 @@ void main() { expect(toolbarY, equals(anchorAboveY - height - _kToolbarContentDistance)); }); - testWidgetsWithLeakTracking('can create and use a custom toolbar', (WidgetTester tester) async { + testWidgets('can create and use a custom toolbar', (WidgetTester tester) async { await tester.pumpWidget( MaterialApp( home: Scaffold( diff --git a/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart b/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart index a6d6faaa82..f2f6cbd10c 100644 --- a/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart +++ b/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index b5b67bd6c9..0ec084f255 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('Theme data control test', () { diff --git a/packages/flutter/test/material/time_test.dart b/packages/flutter/test/material/time_test.dart index 7c6d42c2fa..6c71fef456 100644 --- a/packages/flutter/test/material/time_test.dart +++ b/packages/flutter/test/material/time_test.dart @@ -4,8 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { group('TimeOfDay.format', () { @@ -62,7 +61,7 @@ void main() { expect(() => RestorableTimeOfDay(const TimeOfDay(hour: 20, minute: 4)).value, throwsAssertionError); }); - testWidgetsWithLeakTracking('work when not in restoration scope', (WidgetTester tester) async { + testWidgets('work when not in restoration scope', (WidgetTester tester) async { await tester.pumpWidget(const _RestorableWidget()); final _RestorableWidgetState state = tester.state(find.byType(_RestorableWidget)); @@ -107,7 +106,7 @@ void main() { expect(state.timeOfDay.value, const TimeOfDay(hour: 2, minute: 2)); }); - testWidgetsWithLeakTracking('restore to older state', (WidgetTester tester) async { + testWidgets('restore to older state', (WidgetTester tester) async { await tester.pumpWidget(const RootRestorationScope( restorationId: 'root-child', child: _RestorableWidget(), @@ -138,7 +137,7 @@ void main() { expect(state.timeOfDay.value, const TimeOfDay(hour: 10, minute: 5)); }); - testWidgetsWithLeakTracking('call notifiers when value changes', (WidgetTester tester) async { + testWidgets('call notifiers when value changes', (WidgetTester tester) async { await tester.pumpWidget(const RootRestorationScope( restorationId: 'root-child', child: _RestorableWidget(), diff --git a/packages/flutter/test/material/toggle_buttons_test.dart b/packages/flutter/test/material/toggle_buttons_test.dart index a14363033b..0a31859bd8 100644 --- a/packages/flutter/test/material/toggle_buttons_test.dart +++ b/packages/flutter/test/material/toggle_buttons_test.dart @@ -11,8 +11,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; const double _defaultBorderWidth = 1.0; @@ -817,6 +816,8 @@ void main() { expect(inkFeatures, paints..rect(color: theme.colorScheme.onSurface.withOpacity(0.12))); await hoverGesture.removePointer(); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Default InkWell colors - selected', (WidgetTester tester) async { @@ -882,6 +883,8 @@ void main() { expect(inkFeatures, paints..rect(color: theme.colorScheme.primary.withOpacity(0.12))); await hoverGesture.removePointer(); + + focusNode.dispose(); }); testWidgetsWithLeakTracking('Custom InkWell colors', (WidgetTester tester) async { @@ -951,6 +954,8 @@ void main() { expect(inkFeatures, paints..rect(color: focusColor)); await hoverGesture.removePointer(); + + focusNode.dispose(); }); testWidgetsWithLeakTracking( @@ -1863,6 +1868,10 @@ void main() { expect(toggleButtonElevation('two'), 0); await hoverGesture.removePointer(); + + for (final FocusNode n in focusNodes) { + n.dispose(); + } }); testWidgetsWithLeakTracking('Toggle buttons height matches MaterialTapTargetSize.padded height', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/toggle_buttons_theme_test.dart b/packages/flutter/test/material/toggle_buttons_theme_test.dart index 7b67cbe901..a041f1d767 100644 --- a/packages/flutter/test/material/toggle_buttons_theme_test.dart +++ b/packages/flutter/test/material/toggle_buttons_theme_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; Widget boilerplate({required Widget child}) { return Directionality( @@ -512,6 +511,8 @@ void main() { expect(inkFeatures, paints..rect(color: focusColor)); await hoverGesture.removePointer(); + + focusNode.dispose(); }); testWidgetsWithLeakTracking( diff --git a/packages/flutter/test/material/tooltip_test.dart b/packages/flutter/test/material/tooltip_test.dart index 8b68be4cbd..94fcde0662 100644 --- a/packages/flutter/test/material/tooltip_test.dart +++ b/packages/flutter/test/material/tooltip_test.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; import 'feedback_tester.dart'; @@ -25,7 +24,7 @@ Finder _findTooltipContainer(String tooltipText) { } void main() { - testWidgetsWithLeakTracking('Does tooltip end up in the right place - center', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - center', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Directionality( @@ -79,7 +78,7 @@ void main() { expect(tipInGlobal.dy, 20.0); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - center with padding outside overlay', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - center with padding outside overlay', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Directionality( @@ -138,7 +137,7 @@ void main() { expect(tipInGlobal.dy, 40.0); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - top left', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - top left', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Theme( @@ -192,7 +191,7 @@ void main() { expect(tip.localToGlobal(tip.size.topLeft(Offset.zero)), equals(const Offset(10.0, 20.0))); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - center prefer above fits', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - center prefer above fits', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Directionality( @@ -245,7 +244,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(200.0)); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - center prefer above does not fit', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - center prefer above does not fit', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Directionality( @@ -309,7 +308,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(589.0)); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - center prefer below fits', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - center prefer below fits', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Directionality( @@ -361,7 +360,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(590.0)); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Theme( @@ -418,7 +417,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(324.0)); }); - testWidgetsWithLeakTracking('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async { + testWidgets('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Theme( @@ -475,7 +474,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(324.0)); }); - testWidgetsWithLeakTracking('Tooltip should be fully visible when MediaQuery.viewInsets > 0', (WidgetTester tester) async { + testWidgets('Tooltip should be fully visible when MediaQuery.viewInsets > 0', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/23666 Widget materialAppWithViewInsets(double viewInsetsHeight) { final Widget scaffold = Scaffold( @@ -530,7 +529,7 @@ void main() { expect(tooltipTopRight.dy, lessThan(fabTopRight.dy)); }); - testWidgetsWithLeakTracking('Custom tooltip margin', (WidgetTester tester) async { + testWidgets('Custom tooltip margin', (WidgetTester tester) async { const double customMarginValue = 10.0; final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( @@ -767,7 +766,7 @@ void main() { expect(textStyle.decorationStyle, isNot(TextDecorationStyle.double)); }); - testWidgetsWithLeakTracking('Does tooltip end up with the right default size, shape, and color', (WidgetTester tester) async { + testWidgets('Does tooltip end up with the right default size, shape, and color', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); await tester.pumpWidget( Theme( @@ -835,7 +834,7 @@ void main() { expect(tooltipContainer.padding, const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0)); }, variant: const TargetPlatformVariant({TargetPlatform.macOS, TargetPlatform.linux, TargetPlatform.windows})); - testWidgetsWithLeakTracking('Can tooltip decoration be customized', (WidgetTester tester) async { + testWidgets('Can tooltip decoration be customized', (WidgetTester tester) async { final GlobalKey tooltipKey = GlobalKey(); const Decoration customDecoration = ShapeDecoration( shape: StadiumBorder(), @@ -1393,7 +1392,7 @@ void main() { await tester.pump(waitDuration); }); - testWidgetsWithLeakTracking('Does tooltip contribute semantics', (WidgetTester tester) async { + testWidgets('Does tooltip contribute semantics', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); final GlobalKey tooltipKey = GlobalKey(); diff --git a/packages/flutter/test/material/tooltip_theme_test.dart b/packages/flutter/test/material/tooltip_theme_test.dart index 75d623b1f0..1c328e6b25 100644 --- a/packages/flutter/test/material/tooltip_theme_test.dart +++ b/packages/flutter/test/material/tooltip_theme_test.dart @@ -7,8 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; const String tooltipText = 'TIP'; @@ -113,7 +112,7 @@ void main() { ]); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center prefer above fits - ThemeData.tooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center prefer above fits - ThemeData.tooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -170,7 +169,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(200.0)); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center prefer above fits - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center prefer above fits - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -225,7 +224,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(200.0)); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center prefer above does not fit - ThemeData.tooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center prefer above does not fit - ThemeData.tooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -293,7 +292,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(589.0)); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center prefer above does not fit - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center prefer above does not fit - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -359,7 +358,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(589.0)); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center preferBelow fits - ThemeData.tooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center preferBelow fits - ThemeData.tooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -415,7 +414,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(590.0)); }); - testWidgetsWithLeakTracking('Tooltip verticalOffset, preferBelow; center prefer below fits - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip verticalOffset, preferBelow; center prefer below fits - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -469,7 +468,7 @@ void main() { expect(tip.localToGlobal(tip.size.bottomRight(Offset.zero)).dy, equals(590.0)); }); - testWidgetsWithLeakTracking('Tooltip margin - ThemeData', (WidgetTester tester) async { + testWidgets('Tooltip margin - ThemeData', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -524,7 +523,7 @@ void main() { expect(bottomRightTooltipContentInGlobal.dy, bottomRightTipInGlobal.dy - _customPaddingValue); }); - testWidgetsWithLeakTracking('Tooltip margin - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip margin - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget( Directionality( @@ -675,7 +674,7 @@ void main() { expect(textAlign, TextAlign.end); }); - testWidgetsWithLeakTracking('Tooltip decoration - ThemeData.tooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip decoration - ThemeData.tooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); const Decoration customDecoration = ShapeDecoration( shape: StadiumBorder(), @@ -717,7 +716,7 @@ void main() { expect(tip, paints..rrect(color: const Color(0x80800000))); }); - testWidgetsWithLeakTracking('Tooltip decoration - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip decoration - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); const Decoration customDecoration = ShapeDecoration( shape: StadiumBorder(), @@ -757,7 +756,7 @@ void main() { expect(tip, paints..rrect(color: const Color(0x80800000))); }); - testWidgetsWithLeakTracking('Tooltip height and padding - ThemeData.tooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip height and padding - ThemeData.tooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); const double customTooltipHeight = 100.0; const double customPaddingVal = 20.0; @@ -804,7 +803,7 @@ void main() { expect(content.size.width, equals(tip.size.width - 2 * customPaddingVal)); }); - testWidgetsWithLeakTracking('Tooltip height and padding - TooltipTheme', (WidgetTester tester) async { + testWidgets('Tooltip height and padding - TooltipTheme', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); const double customTooltipHeight = 100.0; const double customPaddingValue = 20.0; diff --git a/packages/flutter/test/material/tooltip_visibility_test.dart b/packages/flutter/test/material/tooltip_visibility_test.dart index c1f88e5e46..e607bd9f7e 100644 --- a/packages/flutter/test/material/tooltip_visibility_test.dart +++ b/packages/flutter/test/material/tooltip_visibility_test.dart @@ -7,8 +7,7 @@ import 'dart:ui'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; const String tooltipText = 'TIP'; diff --git a/packages/flutter/test/material/typography_test.dart b/packages/flutter/test/material/typography_test.dart index 515c90e76b..a7e91eb6f5 100644 --- a/packages/flutter/test/material/typography_test.dart +++ b/packages/flutter/test/material/typography_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; void main() { test('Typography is defined for all target platforms', () { diff --git a/packages/flutter/test/material/user_accounts_drawer_header_test.dart b/packages/flutter/test/material/user_accounts_drawer_header_test.dart index 65dac36e4c..004c801d0b 100644 --- a/packages/flutter/test/material/user_accounts_drawer_header_test.dart +++ b/packages/flutter/test/material/user_accounts_drawer_header_test.dart @@ -5,8 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; - -import '../foundation/leak_tracking.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import '../widgets/semantics_tester.dart'; const Key avatarA = Key('A'); diff --git a/packages/flutter/test/material/value_indicating_slider_test.dart b/packages/flutter/test/material/value_indicating_slider_test.dart index fb8029b935..c0c255badd 100644 --- a/packages/flutter/test/material/value_indicating_slider_test.dart +++ b/packages/flutter/test/material/value_indicating_slider_test.dart @@ -9,11 +9,11 @@ library; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; -import '../foundation/leak_tracking.dart'; void main() { - testWidgetsWithLeakTracking('Slider value indicator', (WidgetTester tester) async { + testWidgets('Slider value indicator', (WidgetTester tester) async { await _buildValueIndicatorStaticSlider( tester, value: 0, @@ -54,7 +54,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Slider value indicator wide text', (WidgetTester tester) async { + testWidgets('Slider value indicator wide text', (WidgetTester tester) async { await _buildValueIndicatorStaticSlider( tester, value: 0, @@ -195,7 +195,7 @@ void main() { // support is deprecated and the APIs are removed, these tests // can be deleted. - testWidgetsWithLeakTracking('Slider value indicator', (WidgetTester tester) async { + testWidgets('Slider value indicator', (WidgetTester tester) async { await _buildValueIndicatorStaticSlider( tester, value: 0, @@ -233,7 +233,7 @@ void main() { ); }); - testWidgetsWithLeakTracking('Slider value indicator wide text', (WidgetTester tester) async { + testWidgets('Slider value indicator wide text', (WidgetTester tester) async { await _buildValueIndicatorStaticSlider( tester, value: 0, diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index 92e6a81a2c..5d240051fb 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -38,10 +38,6 @@ const Map kManuallyPinnedDependencies = { 'url_launcher_android': '6.0.17', // https://github.com/flutter/flutter/issues/115660 'archive': '3.3.2', - // https://github.com/flutter/flutter/issues/132222 - 'leak_tracker': '8.0.3', - // https://github.com/flutter/flutter/issues/132222 - 'leak_tracker_testing': '1.0.2', }; class UpdatePackagesCommand extends FlutterCommand { diff --git a/packages/flutter_tools/test/general.shard/update_packages_test.dart b/packages/flutter_tools/test/general.shard/update_packages_test.dart index 34b24592e2..b92fe6b15a 100644 --- a/packages/flutter_tools/test/general.shard/update_packages_test.dart +++ b/packages/flutter_tools/test/general.shard/update_packages_test.dart @@ -108,8 +108,6 @@ void main() { 'material_color_utilities', 'url_launcher_android', 'archive', - 'leak_tracker', - 'leak_tracker_testing', ]), ); });