[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tester.startGesture less async, for better stack traces #123946

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make tester.startGesture less async, for better stack traces
  • Loading branch information
gnprice committed Apr 1, 2023
commit dcaff7d774fb3c3ff452f9adeb1765dae5162525
26 changes: 15 additions & 11 deletions packages/flutter_test/lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,19 @@ abstract class WidgetController {
return result;
}

TestGesture _createGesture({
int? pointer,
required PointerDeviceKind kind,
required int buttons,
}) {
return TestGesture(
dispatcher: sendEventToBinding,
kind: kind,
pointer: pointer ?? _getNextPointer(),
buttons: buttons,
);
}

/// Creates gesture and returns the [TestGesture] object which you can use
/// to continue the gesture using calls on the [TestGesture] object.
///
Expand All @@ -1143,12 +1156,7 @@ abstract class WidgetController {
PointerDeviceKind kind = PointerDeviceKind.touch,
int buttons = kPrimaryButton,
}) async {
return TestGesture(
dispatcher: sendEventToBinding,
kind: kind,
pointer: pointer ?? _getNextPointer(),
buttons: buttons,
);
return _createGesture(pointer: pointer, kind: kind, buttons: buttons);
}

/// Creates a gesture with an initial appropriate starting gesture at a
Expand All @@ -1172,11 +1180,7 @@ abstract class WidgetController {
PointerDeviceKind kind = PointerDeviceKind.touch,
int buttons = kPrimaryButton,
}) async {
final TestGesture result = await createGesture(
pointer: pointer,
kind: kind,
buttons: buttons,
);
final TestGesture result = _createGesture(pointer: pointer, kind: kind, buttons: buttons);
if (kind == PointerDeviceKind.trackpad) {
await result.panZoomStart(downLocation);
} else {
Expand Down