Skip to content

Commit

Permalink
Cover cupertino/form_section_test with leak tracing (#135158)
Browse files Browse the repository at this point in the history
  • Loading branch information
derdilla authored Sep 20, 2023
1 parent e6d160a commit a96bf71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class _CupertinoTextFormFieldRowState extends FormFieldState<String> {
@override
void dispose() {
_cupertinoTextFormFieldRow.controller?.removeListener(_handleControllerChanged);
_controller?.dispose();
super.dispose();
}

Expand Down
19 changes: 10 additions & 9 deletions packages/flutter/test/cupertino/form_section_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

void main() {
testWidgets('Shows header', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Shows header', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
Expand All @@ -22,7 +23,7 @@ void main() {
expect(find.text('Header'), findsOneWidget);
});

testWidgets('Shows footer', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Shows footer', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
Expand All @@ -37,7 +38,7 @@ void main() {
expect(find.text('Footer'), findsOneWidget);
});

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

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

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

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

testWidgets('Sets background color for section', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Sets background color for section', (WidgetTester tester) async {
const Color backgroundColor = CupertinoColors.systemBlue;

await tester.pumpWidget(
Expand All @@ -138,7 +139,7 @@ void main() {
expect(boxDecoration.color, backgroundColor);
});

testWidgets('Setting clipBehavior clips children section', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Setting clipBehavior clips children section', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
Expand All @@ -153,7 +154,7 @@ void main() {
expect(find.byType(ClipRRect), findsOneWidget);
});

testWidgets('Not setting clipBehavior does not produce a RenderClipRRect object', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Not setting clipBehavior does not produce a RenderClipRRect object', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
Expand Down

0 comments on commit a96bf71

Please sign in to comment.