Skip to content

Commit a96bf71

Browse files
authored
Cover cupertino/form_section_test with leak tracing (#135158)
1 parent e6d160a commit a96bf71

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

packages/flutter/lib/src/cupertino/text_form_field_row.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class _CupertinoTextFormFieldRowState extends FormFieldState<String> {
313313
@override
314314
void dispose() {
315315
_cupertinoTextFormFieldRow.controller?.removeListener(_handleControllerChanged);
316+
_controller?.dispose();
316317
super.dispose();
317318
}
318319

packages/flutter/test/cupertino/form_section_test.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import 'package:flutter/cupertino.dart';
66
import 'package:flutter/rendering.dart';
77
import 'package:flutter_test/flutter_test.dart';
8+
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
89

910
void main() {
10-
testWidgets('Shows header', (WidgetTester tester) async {
11+
testWidgetsWithLeakTracking('Shows header', (WidgetTester tester) async {
1112
await tester.pumpWidget(
1213
CupertinoApp(
1314
home: Center(
@@ -22,7 +23,7 @@ void main() {
2223
expect(find.text('Header'), findsOneWidget);
2324
});
2425

25-
testWidgets('Shows footer', (WidgetTester tester) async {
26+
testWidgetsWithLeakTracking('Shows footer', (WidgetTester tester) async {
2627
await tester.pumpWidget(
2728
CupertinoApp(
2829
home: Center(
@@ -37,7 +38,7 @@ void main() {
3738
expect(find.text('Footer'), findsOneWidget);
3839
});
3940

40-
testWidgets('Shows long dividers in edge-to-edge section part 1', (WidgetTester tester) async {
41+
testWidgetsWithLeakTracking('Shows long dividers in edge-to-edge section part 1', (WidgetTester tester) async {
4142
await tester.pumpWidget(
4243
CupertinoApp(
4344
home: Center(
@@ -54,7 +55,7 @@ void main() {
5455
expect(childrenColumn.children.length, 3);
5556
});
5657

57-
testWidgets('Shows long dividers in edge-to-edge section part 2', (WidgetTester tester) async {
58+
testWidgetsWithLeakTracking('Shows long dividers in edge-to-edge section part 2', (WidgetTester tester) async {
5859
await tester.pumpWidget(
5960
CupertinoApp(
6061
home: Center(
@@ -75,7 +76,7 @@ void main() {
7576
expect(childrenColumn.children.length, 5);
7677
});
7778

78-
testWidgets('Does not show long dividers in insetGrouped section part 1', (WidgetTester tester) async {
79+
testWidgetsWithLeakTracking('Does not show long dividers in insetGrouped section part 1', (WidgetTester tester) async {
7980
await tester.pumpWidget(
8081
CupertinoApp(
8182
home: Center(
@@ -93,7 +94,7 @@ void main() {
9394
expect(childrenColumn.children.length, 1);
9495
});
9596

96-
testWidgets('Does not show long dividers in insetGrouped section part 2', (WidgetTester tester) async {
97+
testWidgetsWithLeakTracking('Does not show long dividers in insetGrouped section part 2', (WidgetTester tester) async {
9798
await tester.pumpWidget(
9899
CupertinoApp(
99100
restorationScopeId: 'App',
@@ -115,7 +116,7 @@ void main() {
115116
expect(childrenColumn.children.length, 3);
116117
});
117118

118-
testWidgets('Sets background color for section', (WidgetTester tester) async {
119+
testWidgetsWithLeakTracking('Sets background color for section', (WidgetTester tester) async {
119120
const Color backgroundColor = CupertinoColors.systemBlue;
120121

121122
await tester.pumpWidget(
@@ -138,7 +139,7 @@ void main() {
138139
expect(boxDecoration.color, backgroundColor);
139140
});
140141

141-
testWidgets('Setting clipBehavior clips children section', (WidgetTester tester) async {
142+
testWidgetsWithLeakTracking('Setting clipBehavior clips children section', (WidgetTester tester) async {
142143
await tester.pumpWidget(
143144
CupertinoApp(
144145
home: Center(
@@ -153,7 +154,7 @@ void main() {
153154
expect(find.byType(ClipRRect), findsOneWidget);
154155
});
155156

156-
testWidgets('Not setting clipBehavior does not produce a RenderClipRRect object', (WidgetTester tester) async {
157+
testWidgetsWithLeakTracking('Not setting clipBehavior does not produce a RenderClipRRect object', (WidgetTester tester) async {
157158
await tester.pumpWidget(
158159
CupertinoApp(
159160
home: Center(

0 commit comments

Comments
 (0)