@@ -8,11 +8,12 @@ import 'package:flutter/gestures.dart';
8
8
import 'package:flutter/material.dart' ;
9
9
import 'package:flutter/rendering.dart' ;
10
10
import 'package:flutter_test/flutter_test.dart' ;
11
+ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart' ;
11
12
12
13
import 'gesture_utils.dart' ;
13
14
14
15
void main () {
15
- testWidgets ('Events bubble up the tree' , (WidgetTester tester) async {
16
+ testWidgetsWithLeakTracking ('Events bubble up the tree' , (WidgetTester tester) async {
16
17
final List <String > log = < String > [];
17
18
18
19
await tester.pumpWidget (
@@ -46,7 +47,7 @@ void main() {
46
47
]));
47
48
});
48
49
49
- testWidgets ('Detects hover events from touch devices' , (WidgetTester tester) async {
50
+ testWidgetsWithLeakTracking ('Detects hover events from touch devices' , (WidgetTester tester) async {
50
51
final List <String > log = < String > [];
51
52
52
53
await tester.pumpWidget (
@@ -74,7 +75,7 @@ void main() {
74
75
});
75
76
76
77
group ('transformed events' , () {
77
- testWidgets ('simple offset for touch/signal' , (WidgetTester tester) async {
78
+ testWidgetsWithLeakTracking ('simple offset for touch/signal' , (WidgetTester tester) async {
78
79
final List <PointerEvent > events = < PointerEvent > [];
79
80
final Key key = UniqueKey ();
80
81
@@ -145,7 +146,7 @@ void main() {
145
146
expect (events.single.transform, expectedTransform);
146
147
});
147
148
148
- testWidgets ('scaled for touch/signal' , (WidgetTester tester) async {
149
+ testWidgetsWithLeakTracking ('scaled for touch/signal' , (WidgetTester tester) async {
149
150
final List <PointerEvent > events = < PointerEvent > [];
150
151
final Key key = UniqueKey ();
151
152
@@ -222,7 +223,7 @@ void main() {
222
223
expect (events.single.transform, expectedTransform);
223
224
});
224
225
225
- testWidgets ('scaled and offset for touch/signal' , (WidgetTester tester) async {
226
+ testWidgetsWithLeakTracking ('scaled and offset for touch/signal' , (WidgetTester tester) async {
226
227
final List <PointerEvent > events = < PointerEvent > [];
227
228
final Key key = UniqueKey ();
228
229
@@ -300,7 +301,7 @@ void main() {
300
301
expect (events.single.transform, expectedTransform);
301
302
});
302
303
303
- testWidgets ('rotated for touch/signal' , (WidgetTester tester) async {
304
+ testWidgetsWithLeakTracking ('rotated for touch/signal' , (WidgetTester tester) async {
304
305
final List <PointerEvent > events = < PointerEvent > [];
305
306
final Key key = UniqueKey ();
306
307
@@ -378,9 +379,12 @@ void main() {
378
379
});
379
380
});
380
381
381
- testWidgets ("RenderPointerListener's debugFillProperties when default" , (WidgetTester tester) async {
382
+ testWidgetsWithLeakTracking ("RenderPointerListener's debugFillProperties when default" , (WidgetTester tester) async {
382
383
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder ();
383
- RenderPointerListener ().debugFillProperties (builder);
384
+ final RenderPointerListener renderListener = RenderPointerListener ();
385
+ addTearDown (renderListener.dispose);
386
+
387
+ renderListener.debugFillProperties (builder);
384
388
385
389
final List <String > description = builder.properties
386
390
.where ((DiagnosticsNode node) => ! node.isFiltered (DiagnosticLevel .info))
@@ -396,18 +400,25 @@ void main() {
396
400
]);
397
401
});
398
402
399
- testWidgets ("RenderPointerListener's debugFillProperties when full" , (WidgetTester tester) async {
403
+ testWidgetsWithLeakTracking ("RenderPointerListener's debugFillProperties when full" , (WidgetTester tester) async {
400
404
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder ();
401
- RenderPointerListener (
405
+
406
+ final RenderErrorBox renderErrorBox = RenderErrorBox ();
407
+ addTearDown (() => renderErrorBox.dispose ());
408
+
409
+ final RenderPointerListener renderListener = RenderPointerListener (
402
410
onPointerDown: (PointerDownEvent event) {},
403
411
onPointerUp: (PointerUpEvent event) {},
404
412
onPointerMove: (PointerMoveEvent event) {},
405
413
onPointerHover: (PointerHoverEvent event) {},
406
414
onPointerCancel: (PointerCancelEvent event) {},
407
415
onPointerSignal: (PointerSignalEvent event) {},
408
416
behavior: HitTestBehavior .opaque,
409
- child: RenderErrorBox (),
410
- ).debugFillProperties (builder);
417
+ child: renderErrorBox,
418
+ );
419
+ addTearDown (renderListener.dispose);
420
+
421
+ renderListener.debugFillProperties (builder);
411
422
412
423
final List <String > description = builder.properties
413
424
.where ((DiagnosticsNode node) => ! node.isFiltered (DiagnosticLevel .info))
0 commit comments