Create a TestGesture by starting with a pointerDown at the given point.
By default, the pointer ID used is 1. This can be overridden by
providing the pointer argument.
A function to use for hit testing should be provided via the hitTester
argument, and a function to use for dispatching events should be provided
via the dispatcher argument.
Source
static Future<TestGesture> down(Point downLocation, {
int pointer: 1,
HitTester hitTester,
EventDispatcher dispatcher
}) async {
assert(hitTester != null);
assert(dispatcher != null);
final Completer<TestGesture> completer = new Completer<TestGesture>();
TestGesture result;
TestAsyncUtils.guard(() async {
// dispatch down event
final HitTestResult hitTestResult = hitTester(downLocation);
final TestPointer testPointer = new TestPointer(pointer);
await dispatcher(testPointer.down(downLocation), hitTestResult);
// create a TestGesture
result = new TestGesture._(dispatcher, hitTestResult, testPointer);
return null;
}).whenComplete(() {
completer.complete(result);
});
return completer.future;
}