flutter/packages/flutter/test/gestures/gesture_tester.dart
Greg Spencer 6c56bb2420
Update typedef syntax to use Function notation and turn on lint for old notation. (#18362)
Now that Dart 1 is turned off, reapplying my change to turn on the prefer_generic_function_type_aliases analysis option, and fix all the typedefs to Dart 2 preferred syntax.

Also eliminated the unused analysis_options_repo.yaml file and turned on public_member_api_docs in analysys_options.yaml.

No logic changes, just changing the typedef syntax for all typedefs, and updating analysis options.
2018-06-11 15:51:45 -07:00

44 lines
1.1 KiB
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:quiver/testing/async.dart';
class TestGestureFlutterBinding extends BindingBase with GestureBinding { }
void ensureGestureBinding() {
if (GestureBinding.instance == null)
new TestGestureFlutterBinding();
assert(GestureBinding.instance != null);
}
class GestureTester {
GestureTester._(this.async);
final FakeAsync async;
void closeArena(int pointer) {
GestureBinding.instance.gestureArena.close(pointer);
}
void route(PointerEvent event) {
GestureBinding.instance.pointerRouter.route(event);
async.flushMicrotasks();
}
}
typedef GestureTest = void Function(GestureTester tester);
@isTest
void testGesture(String description, GestureTest callback) {
test(description, () {
new FakeAsync().run((FakeAsync async) {
callback(new GestureTester._(async));
});
});
}