Cover cupertino/form_section_test with leak tracing (#135158)

This commit is contained in:
derdilla 2023-09-20 22:29:41 +02:00 committed by GitHub
parent e6d160a5c7
commit a96bf714cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -313,6 +313,7 @@ class _CupertinoTextFormFieldRowState extends FormFieldState<String> {
@override
void dispose() {
_cupertinoTextFormFieldRow.controller?.removeListener(_handleControllerChanged);
_controller?.dispose();
super.dispose();
}

View File

@ -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(
@ -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(
@ -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(
@ -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(
@ -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(
@ -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',
@ -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(
@ -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(
@ -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(