Unverified Commit 3df6078b authored by droidbg's avatar droidbg Committed by GitHub

[leak-tracking] Cover testwidgets with leak tracking in test/gestures (#136166)

parent a1e10ee4
...@@ -11,7 +11,7 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; ...@@ -11,7 +11,7 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
group('Horizontal', () { group('Horizontal', () {
testWidgets('gets local coordinates', (WidgetTester tester) async { testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async {
int dragCancelCount = 0; int dragCancelCount = 0;
final List<DragDownDetails> downDetails = <DragDownDetails>[]; final List<DragDownDetails> downDetails = <DragDownDetails>[];
final List<DragEndDetails> endDetails = <DragEndDetails>[]; final List<DragEndDetails> endDetails = <DragEndDetails>[];
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('gets local coordinates', (WidgetTester tester) async { testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async {
final List<ScaleStartDetails> startDetails = <ScaleStartDetails>[]; final List<ScaleStartDetails> startDetails = <ScaleStartDetails>[];
final List<ScaleUpdateDetails> updateDetails = <ScaleUpdateDetails>[]; final List<ScaleUpdateDetails> updateDetails = <ScaleUpdateDetails>[];
...@@ -30,7 +31,7 @@ void main() { ...@@ -30,7 +31,7 @@ void main() {
), ),
); );
await tester.startGesture(tester.getCenter(find.byKey(redContainer)) - const Offset(20, 20)); final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byKey(redContainer)) - const Offset(20, 20));
final TestGesture pointer2 = await tester.startGesture(tester.getCenter(find.byKey(redContainer)) + const Offset(30, 30)); final TestGesture pointer2 = await tester.startGesture(tester.getCenter(find.byKey(redContainer)) + const Offset(30, 30));
await pointer2.moveTo(tester.getCenter(find.byKey(redContainer)) + const Offset(20, 20)); await pointer2.moveTo(tester.getCenter(find.byKey(redContainer)) + const Offset(20, 20));
...@@ -42,5 +43,11 @@ void main() { ...@@ -42,5 +43,11 @@ void main() {
expect(startDetails.first.focalPoint, const Offset(380, 280)); expect(startDetails.first.focalPoint, const Offset(380, 280));
expect(startDetails.last.localFocalPoint, const Offset(50, 50)); expect(startDetails.last.localFocalPoint, const Offset(50, 50));
expect(startDetails.last.focalPoint, const Offset(400, 300)); expect(startDetails.last.focalPoint, const Offset(400, 300));
await tester.pumpAndSettle();
await gesture.up();
await pointer2.up();
await tester.pumpAndSettle();
}); });
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment