4
4
5
5
import 'package:flutter/material.dart' ;
6
6
import 'package:flutter_test/flutter_test.dart' ;
7
+ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart' ;
7
8
8
9
void main () {
9
- testWidgets ('gets local coordinates' , (WidgetTester tester) async {
10
+ testWidgetsWithLeakTracking ('gets local coordinates' , (WidgetTester tester) async {
10
11
final List <ScaleStartDetails > startDetails = < ScaleStartDetails > [];
11
12
final List <ScaleUpdateDetails > updateDetails = < ScaleUpdateDetails > [];
12
13
@@ -30,7 +31,7 @@ void main() {
30
31
),
31
32
);
32
33
33
- await tester.startGesture (tester.getCenter (find.byKey (redContainer)) - const Offset (20 , 20 ));
34
+ final TestGesture gesture = await tester.startGesture (tester.getCenter (find.byKey (redContainer)) - const Offset (20 , 20 ));
34
35
final TestGesture pointer2 = await tester.startGesture (tester.getCenter (find.byKey (redContainer)) + const Offset (30 , 30 ));
35
36
await pointer2.moveTo (tester.getCenter (find.byKey (redContainer)) + const Offset (20 , 20 ));
36
37
@@ -42,5 +43,11 @@ void main() {
42
43
expect (startDetails.first.focalPoint, const Offset (380 , 280 ));
43
44
expect (startDetails.last.localFocalPoint, const Offset (50 , 50 ));
44
45
expect (startDetails.last.focalPoint, const Offset (400 , 300 ));
46
+
47
+ await tester.pumpAndSettle ();
48
+ await gesture.up ();
49
+ await pointer2.up ();
50
+ await tester.pumpAndSettle ();
51
+
45
52
});
46
53
}
0 commit comments