Fix leaky test. (#150235)

This commit is contained in:
Polina Cherkasova
2024-06-13 16:48:35 -07:00
committed by GitHub
parent 3bdc451802
commit 3226cafca7

View File

@@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.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 '../image_data.dart';
import '../rendering/rendering_tester.dart' show TestCallbackPainter;
@@ -40,9 +39,6 @@ class MockCupertinoTabController extends CupertinoTabController {
}
void main() {
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
LeakTesting.settings = LeakTesting.settings.withIgnoredAll();
setUp(() {
selectedTabs = <int>[];
});
@@ -252,9 +248,7 @@ void main() {
);
});
testWidgets('Programmatic tab switching by changing the index of an existing controller',
experimentalLeakTesting: LeakTesting.settings.withCreationStackTrace(),
(WidgetTester tester) async {
testWidgets('Programmatic tab switching by changing the index of an existing controller', (WidgetTester tester) async {
final CupertinoTabController controller = CupertinoTabController(initialIndex: 1);
addTearDown(controller.dispose);
final List<int> tabsPainted = <int>[];
@@ -636,9 +630,7 @@ void main() {
});
// Regression test for https://github.com/flutter/flutter/issues/33455
testWidgets('Adding new tabs does not crash the app',
experimentalLeakTesting: LeakTesting.settings.withTrackedAll(),
(WidgetTester tester) async {
testWidgets('Adding new tabs does not crash the app', (WidgetTester tester) async {
final List<int> tabsPainted = <int>[];
final CupertinoTabController controller = CupertinoTabController();
addTearDown(controller.dispose);
@@ -1106,9 +1098,7 @@ void main() {
expect(find.text("don't lose me"), findsOneWidget);
});
testWidgets('textScaleFactor is set to 1.0',
experimentalLeakTesting: LeakTesting.settings.withCreationStackTrace(),
(WidgetTester tester) async {
testWidgets('textScaleFactor is set to 1.0', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Builder(builder: (BuildContext context) {
@@ -1377,6 +1367,8 @@ void main() {
expect(find.text('Page 1 of tab 2'), findsOneWidget);
expect(find.text('Page 2 of tab 2'), findsNothing);
expect(lastFrameworkHandlesBack, isFalse);
imageCache.clear();
},
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android }),
skip: kIsWeb, // [intended] frameworkHandlesBack not used on web.