Skip to content

Commit

Permalink
[leak-tracking] Cover testwidgets with leak tracking in test/gestures…
Browse files Browse the repository at this point in the history
… (#136166)
  • Loading branch information
droidbg authored Oct 9, 2023
1 parent a1e10ee commit 3df6078
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

void main() {
group('Horizontal', () {
testWidgets('gets local coordinates', (WidgetTester tester) async {
testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async {
int dragCancelCount = 0;
final List<DragDownDetails> downDetails = <DragDownDetails>[];
final List<DragEndDetails> endDetails = <DragEndDetails>[];
Expand Down
11 changes: 9 additions & 2 deletions packages/flutter/test/gestures/transformed_scale_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

void main() {
testWidgets('gets local coordinates', (WidgetTester tester) async {
testWidgetsWithLeakTracking('gets local coordinates', (WidgetTester tester) async {
final List<ScaleStartDetails> startDetails = <ScaleStartDetails>[];
final List<ScaleUpdateDetails> updateDetails = <ScaleUpdateDetails>[];

Expand All @@ -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));
await pointer2.moveTo(tester.getCenter(find.byKey(redContainer)) + const Offset(20, 20));

Expand All @@ -42,5 +43,11 @@ void main() {
expect(startDetails.first.focalPoint, const Offset(380, 280));
expect(startDetails.last.localFocalPoint, const Offset(50, 50));
expect(startDetails.last.focalPoint, const Offset(400, 300));

await tester.pumpAndSettle();
await gesture.up();
await pointer2.up();
await tester.pumpAndSettle();

});
}

0 comments on commit 3df6078

Please sign in to comment.